@ngxs/store
Advanced tools
Comparing version 18.1.5-dev.master-4720c7c to 18.1.5-dev.master-6ec891b
217
index.d.ts
import * as i0 from '@angular/core'; | ||
import { Type, ModuleWithProviders, OnDestroy, NgZone, Signal, EnvironmentProviders } from '@angular/core'; | ||
import { ɵSharedSelectorOptions as _SharedSelectorOptions, ɵStateClass as _StateClass, ɵActionOptions as _ActionOptions, ɵPlainObjectOf as _PlainObjectOf, ɵStateClassInternal as _StateClassInternal, ɵActionHandlerMetaData as _ActionHandlerMetaData, ɵOrderedSubject as _OrderedSubject, ɵStateStream as _StateStream, ɵRuntimeSelectorContext as _RuntimeSelectorContext, StateToken, ɵStoreOptions as _StoreOptions } from '@ngxs/store/internals'; | ||
import { Type, ModuleWithProviders, Signal, EnvironmentProviders } from '@angular/core'; | ||
import { ɵSharedSelectorOptions as _SharedSelectorOptions, ɵStateClass as _StateClass, ɵActionOptions as _ActionOptions, StateToken, ɵStoreOptions as _StoreOptions } from '@ngxs/store/internals'; | ||
export { ɵActionOptions as ActionOptions, StateToken } from '@ngxs/store/internals'; | ||
import * as rxjs from 'rxjs'; | ||
import { Observable, Subject, Subscription, OperatorFunction } from 'rxjs'; | ||
import { Observable, Subscription, OperatorFunction } from 'rxjs'; | ||
import { StateOperator } from '@ngxs/store/operators'; | ||
export { StateOperator } from '@ngxs/store/operators'; | ||
import { NgxsPluginFn, NgxsPlugin } from '@ngxs/store/plugins'; | ||
import { NgxsPlugin, NgxsPluginFn } from '@ngxs/store/plugins'; | ||
export { InitState, NGXS_PLUGINS, NgxsNextPluginFn, NgxsPlugin, NgxsPluginFn, UpdateState, actionMatcher, getActionTypeFromInstance, getValue, setValue } from '@ngxs/store/plugins'; | ||
@@ -173,178 +173,2 @@ | ||
declare class InternalNgxsExecutionStrategy implements NgxsExecutionStrategy { | ||
private _executionStrategy; | ||
constructor(_executionStrategy: NgxsExecutionStrategy); | ||
enter<T>(func: () => T): T; | ||
leave<T>(func: () => T): T; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<InternalNgxsExecutionStrategy, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<InternalNgxsExecutionStrategy>; | ||
} | ||
type StatesByName = _PlainObjectOf<_StateClassInternal>; | ||
interface StateOperations<T> { | ||
getState(): T; | ||
setState(val: T): void; | ||
dispatch(actionOrActions: any | any[]): Observable<void>; | ||
} | ||
interface MappedStore { | ||
name: string; | ||
isInitialised: boolean; | ||
actions: _PlainObjectOf<_ActionHandlerMetaData[]>; | ||
defaults: any; | ||
instance: any; | ||
path: string; | ||
} | ||
interface StatesAndDefaults { | ||
defaults: any; | ||
states: MappedStore[]; | ||
} | ||
/** | ||
* Status of a dispatched action | ||
*/ | ||
declare const enum ActionStatus { | ||
Dispatched = "DISPATCHED", | ||
Successful = "SUCCESSFUL", | ||
Canceled = "CANCELED", | ||
Errored = "ERRORED" | ||
} | ||
interface ActionContext<T = any> { | ||
status: ActionStatus; | ||
action: T; | ||
error?: Error; | ||
} | ||
/** | ||
* Internal Action stream that is emitted anytime an action is dispatched. | ||
*/ | ||
declare class InternalActions extends _OrderedSubject<ActionContext> implements OnDestroy { | ||
readonly dispatched$: Subject<ActionContext<any>>; | ||
constructor(); | ||
ngOnDestroy(): void; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<InternalActions, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<InternalActions>; | ||
} | ||
/** | ||
* Action stream that is emitted anytime an action is dispatched. | ||
* | ||
* You can listen to this in services to react without stores. | ||
*/ | ||
declare class Actions extends Observable<ActionContext> { | ||
constructor(internalActions$: InternalActions, internalExecutionStrategy: InternalNgxsExecutionStrategy); | ||
static ɵfac: i0.ɵɵFactoryDeclaration<Actions, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<Actions>; | ||
} | ||
declare class PluginManager { | ||
readonly plugins: NgxsPluginFn[]; | ||
private readonly _parentManager; | ||
private readonly _pluginHandlers; | ||
constructor(); | ||
private get _rootPlugins(); | ||
private registerHandlers; | ||
private getPluginHandlers; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<PluginManager, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<PluginManager>; | ||
} | ||
/** | ||
* Internal Action result stream that is emitted when an action is completed. | ||
* This is used as a method of returning the action result to the dispatcher | ||
* for the observable returned by the dispatch(...) call. | ||
* The dispatcher then asynchronously pushes the result from this stream onto the main action stream as a result. | ||
*/ | ||
declare class InternalDispatchedActionResults extends Subject<ActionContext> { | ||
static ɵfac: i0.ɵɵFactoryDeclaration<InternalDispatchedActionResults, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<InternalDispatchedActionResults>; | ||
} | ||
declare class InternalDispatcher { | ||
private _ngZone; | ||
private _actions; | ||
private _actionResults; | ||
private _pluginManager; | ||
private _stateStream; | ||
private _ngxsExecutionStrategy; | ||
constructor(_ngZone: NgZone, _actions: InternalActions, _actionResults: InternalDispatchedActionResults, _pluginManager: PluginManager, _stateStream: _StateStream, _ngxsExecutionStrategy: InternalNgxsExecutionStrategy); | ||
/** | ||
* Dispatches event(s). | ||
*/ | ||
dispatch(actionOrActions: any | any[]): Observable<void>; | ||
private dispatchByEvents; | ||
private dispatchSingle; | ||
private getActionResultStream; | ||
private createDispatchObservable; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<InternalDispatcher, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<InternalDispatcher>; | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
declare class InternalStateOperations { | ||
private _stateStream; | ||
private _dispatcher; | ||
private _config; | ||
constructor(_stateStream: _StateStream, _dispatcher: InternalDispatcher, _config: NgxsConfig); | ||
/** | ||
* Returns the root state operators. | ||
*/ | ||
getRootStateOperations(): StateOperations<any>; | ||
setStateToTheCurrentWithNew(results: StatesAndDefaults): void; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<InternalStateOperations, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<InternalStateOperations>; | ||
} | ||
/** | ||
* The `StateFactory` class adds root and feature states to the graph. | ||
* This extracts state names from state classes, checks if they already | ||
* exist in the global graph, throws errors if their names are invalid, etc. | ||
* See its constructor, state factories inject state factories that are | ||
* parent-level providers. This is required to get feature states from the | ||
* injector on the same level. | ||
* | ||
* The `NgxsModule.forFeature(...)` returns `providers: [StateFactory, ...states]`. | ||
* The `StateFactory` is initialized on the feature level and goes through `...states` | ||
* to get them from the injector through `injector.get(state)`. | ||
* @ignore | ||
*/ | ||
declare class StateFactory implements OnDestroy { | ||
private readonly _injector; | ||
private readonly _config; | ||
private readonly _parentFactory; | ||
private readonly _stateContextFactory; | ||
private readonly _actions; | ||
private readonly _actionResults; | ||
private readonly _initialState; | ||
private readonly _actionRegistry; | ||
private readonly _propGetter; | ||
private _actionsSubscription; | ||
private _ngxsUnhandledErrorHandler; | ||
private _states; | ||
get states(): MappedStore[]; | ||
private _statesByName; | ||
get statesByName(): StatesByName; | ||
private _statePaths; | ||
private get statePaths(); | ||
getRuntimeSelectorContext: () => _RuntimeSelectorContext; | ||
ngOnDestroy(): void; | ||
/** | ||
* Add a new state to the global defs. | ||
*/ | ||
add(stateClasses: _StateClassInternal[]): MappedStore[]; | ||
/** | ||
* Add a set of states to the store and return the defaults | ||
*/ | ||
addAndReturnDefaults(stateClasses: _StateClassInternal[]): StatesAndDefaults; | ||
connectActionHandlers(): void; | ||
/** | ||
* Invoke actions on the states. | ||
*/ | ||
private invokeActions; | ||
private addToStatesMap; | ||
private addRuntimeInfoToMeta; | ||
private hasBeenMountedAndBootstrapped; | ||
private hydrateActionMetasMap; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<StateFactory, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<StateFactory>; | ||
} | ||
type ɵSelectorFunc<TModel> = (...arg: any[]) => TModel; | ||
@@ -411,3 +235,3 @@ type TypedSelector<TModel> = StateToken<TModel> | ɵSelectorFunc<TModel>; | ||
private _selectableStateStream; | ||
constructor(_stateStream: _StateStream, _internalStateOperations: InternalStateOperations, _config: NgxsConfig, _internalExecutionStrategy: InternalNgxsExecutionStrategy, _stateFactory: StateFactory, initialStateValue: any); | ||
constructor(); | ||
/** | ||
@@ -448,3 +272,3 @@ * Dispatches action(s). | ||
private initStateStream; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<Store, [null, null, null, null, null, { optional: true; }]>; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<Store, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<Store>; | ||
@@ -471,2 +295,27 @@ } | ||
/** | ||
* Status of a dispatched action | ||
*/ | ||
declare const enum ActionStatus { | ||
Dispatched = "DISPATCHED", | ||
Successful = "SUCCESSFUL", | ||
Canceled = "CANCELED", | ||
Errored = "ERRORED" | ||
} | ||
interface ActionContext<T = any> { | ||
status: ActionStatus; | ||
action: T; | ||
error?: Error; | ||
} | ||
/** | ||
* Action stream that is emitted anytime an action is dispatched. | ||
* | ||
* You can listen to this in services to react without stores. | ||
*/ | ||
declare class Actions extends Observable<ActionContext> { | ||
constructor(); | ||
static ɵfac: i0.ɵɵFactoryDeclaration<Actions, never>; | ||
static ɵprov: i0.ɵɵInjectableDeclaration<Actions>; | ||
} | ||
type TupleKeys<T extends any[]> = Exclude<keyof T, keyof []>; | ||
@@ -649,3 +498,3 @@ /** | ||
private _ignoredActions; | ||
constructor(options: NgxsDevelopmentOptions); | ||
constructor(); | ||
/** | ||
@@ -710,3 +559,3 @@ * Adds actions to the internal list of actions that should be ignored. | ||
*/ | ||
declare function withNgxsPlugin(plugin: Type<NgxsPlugin>): EnvironmentProviders; | ||
declare function withNgxsPlugin(plugin: Type<NgxsPlugin> | NgxsPluginFn): EnvironmentProviders; | ||
@@ -713,0 +562,0 @@ /** |
{ | ||
"name": "@ngxs/store", | ||
"version": "18.1.5-dev.master-4720c7c", | ||
"version": "18.1.5-dev.master-6ec891b", | ||
"license": "MIT", | ||
@@ -35,2 +35,8 @@ "sideEffects": false, | ||
}, | ||
"./plugins": { | ||
"types": "./plugins/index.d.ts", | ||
"esm2022": "./esm2022/plugins/ngxs-store-plugins.mjs", | ||
"esm": "./esm2022/plugins/ngxs-store-plugins.mjs", | ||
"default": "./fesm2022/ngxs-store-plugins.mjs" | ||
}, | ||
"./operators": { | ||
@@ -42,8 +48,2 @@ "types": "./operators/index.d.ts", | ||
}, | ||
"./plugins": { | ||
"types": "./plugins/index.d.ts", | ||
"esm2022": "./esm2022/plugins/ngxs-store-plugins.mjs", | ||
"esm": "./esm2022/plugins/ngxs-store-plugins.mjs", | ||
"default": "./fesm2022/ngxs-store-plugins.mjs" | ||
}, | ||
"./internals/testing": { | ||
@@ -50,0 +50,0 @@ "types": "./internals/testing/index.d.ts", |
import { ɵPlainObject as _PlainObject } from '@ngxs/store/internals'; | ||
import { InjectionToken } from '@angular/core'; | ||
import { InjectionToken, Type } from '@angular/core'; | ||
@@ -19,5 +19,4 @@ /** | ||
declare const NGXS_PLUGINS: InjectionToken<unknown>; | ||
type NgxsPluginFn = (state: any, mutation: any, next: NgxsNextPluginFn) => any; | ||
type NgxsNextPluginFn = (state: any, mutation: any) => any; | ||
type NgxsNextPluginFn = (state: any, action: any) => any; | ||
type NgxsPluginFn = (state: any, action: any, next: NgxsNextPluginFn) => any; | ||
/** | ||
@@ -32,2 +31,10 @@ * Plugin interface | ||
} | ||
/** | ||
* A multi-provider token used to resolve to custom NGXS plugins provided | ||
* at the root and feature levels through the `{provide}` scheme. | ||
* | ||
* @deprecated from v18.0.0, use `withNgxsPlugin` instead. | ||
*/ | ||
declare const NGXS_PLUGINS: InjectionToken<NgxsPlugin[]>; | ||
declare function ɵisPluginClass(plugin: Type<NgxsPlugin> | NgxsPluginFn): plugin is Type<NgxsPlugin>; | ||
@@ -64,2 +71,2 @@ /** | ||
export { InitState, NGXS_PLUGINS, type NgxsNextPluginFn, type NgxsPlugin, type NgxsPluginFn, UpdateState, actionMatcher, getActionTypeFromInstance, getValue, setValue }; | ||
export { InitState, NGXS_PLUGINS, type NgxsNextPluginFn, type NgxsPlugin, type NgxsPluginFn, UpdateState, actionMatcher, getActionTypeFromInstance, getValue, setValue, ɵisPluginClass }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1014855
183
8263