@ngxs/store 21.0.0-dev.master-f3cf7bf → 21.0.0-dev.master-77ed591
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
CHANGED
|
@@ -2,7 +2,6 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { ModuleWithProviders, Signal, EnvironmentProviders, Type } from '@angular/core';
|
|
3
3
|
import { ɵActionOptions as _ActionOptions, StateToken, ɵSharedSelectorOptions as _SharedSelectorOptions, ɵStateClass as _StateClass, ɵStoreOptions as _StoreOptions } from '@ngxs/store/internals';
|
|
4
4
|
export { ɵActionOptions as ActionOptions, StateToken } from '@ngxs/store/internals';
|
|
5
|
-
import * as rxjs from 'rxjs';
|
|
6
5
|
import { Observable, Subscription, OperatorFunction } from 'rxjs';
|
|
7
6
|
import { StateOperator } from '@ngxs/store/operators';
|
|
8
7
|
export { StateOperator } from '@ngxs/store/operators';
|
|
@@ -609,7 +608,12 @@ declare function withNgxsPreboot(prebootFn: VoidFunction): i0.EnvironmentProvide
|
|
|
609
608
|
*/
|
|
610
609
|
declare function select<T>(selector: TypedSelector<T>): Signal<T>;
|
|
611
610
|
|
|
612
|
-
declare
|
|
611
|
+
declare class AsyncReturnType<T> extends Observable<T> implements PromiseLike<void> {
|
|
612
|
+
private dispatchResult$;
|
|
613
|
+
constructor(dispatchResult$: Observable<T>);
|
|
614
|
+
then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
615
|
+
}
|
|
616
|
+
declare function dispatch<TArgs extends any[]>(ActionType: ActionDef<TArgs>): (...args: TArgs) => AsyncReturnType<void>;
|
|
613
617
|
|
|
614
618
|
type SelectorMap = Record<string, TypedSelector<unknown>>;
|
|
615
619
|
declare function createSelectMap<T extends SelectorMap>(selectorMap: T): { readonly [K in keyof T]: Signal<ɵSelectorReturnType<T[K]>>; };
|
|
@@ -650,7 +654,78 @@ interface DefaultExport<T> {
|
|
|
650
654
|
*/
|
|
651
655
|
declare function lazyProvider(factory: () => Promise<EnvironmentProviders | DefaultExport<EnvironmentProviders>>): () => Promise<boolean>;
|
|
652
656
|
|
|
657
|
+
/**
|
|
658
|
+
* Dynamically registers an NGXS plugin in the current injection context.
|
|
659
|
+
*
|
|
660
|
+
* This function allows you to register NGXS plugins at runtime, creating an isolated
|
|
661
|
+
* environment injector for the plugin. The plugin is automatically cleaned up when
|
|
662
|
+
* the injection context is destroyed. In development mode, the function validates
|
|
663
|
+
* that the same plugin is not registered multiple times.
|
|
664
|
+
*
|
|
665
|
+
* @param plugin - The NGXS plugin to register. Can be either a class type implementing
|
|
666
|
+
* `NgxsPlugin` or a plugin function (`NgxsPluginFn`).
|
|
667
|
+
*
|
|
668
|
+
* @throws {Error} Throws an error if called outside of an injection context.
|
|
669
|
+
* @throws {Error} In development mode, throws an error if the plugin has already been registered.
|
|
670
|
+
*
|
|
671
|
+
* @remarks
|
|
672
|
+
* - Must be called within an injection context (e.g., constructor, field initializer, or `runInInjectionContext`).
|
|
673
|
+
* - The created environment injector is automatically destroyed when the parent context is destroyed.
|
|
674
|
+
* - Duplicate plugin registration is only checked in development mode for performance reasons.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```ts
|
|
678
|
+
* // Register a plugin class
|
|
679
|
+
* import { MyThirdPartyIntegrationPlugin } from './plugins/third-party.plugin';
|
|
680
|
+
*
|
|
681
|
+
* @Component({
|
|
682
|
+
* selector: 'app-root',
|
|
683
|
+
* template: '...'
|
|
684
|
+
* })
|
|
685
|
+
* export class AppComponent {
|
|
686
|
+
* constructor() {
|
|
687
|
+
* registerNgxsPlugin(MyThirdPartyIntegrationPlugin);
|
|
688
|
+
* }
|
|
689
|
+
* }
|
|
690
|
+
* ```
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```ts
|
|
694
|
+
* // Register a plugin function
|
|
695
|
+
* import { myThirdPartyIntegrationPluginFn } from './plugins/third-party.plugin';
|
|
696
|
+
*
|
|
697
|
+
* @Component({
|
|
698
|
+
* selector: 'app-feature',
|
|
699
|
+
* template: '...'
|
|
700
|
+
* })
|
|
701
|
+
* export class FeatureComponent {
|
|
702
|
+
* constructor() {
|
|
703
|
+
* registerNgxsPlugin(myThirdPartyIntegrationPluginFn);
|
|
704
|
+
* }
|
|
705
|
+
* }
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```ts
|
|
710
|
+
* // Register conditionally based on environment
|
|
711
|
+
* import { MyDevtoolsPlugin } from './plugins/devtools.plugin';
|
|
712
|
+
*
|
|
713
|
+
* @Component({
|
|
714
|
+
* selector: 'app-root',
|
|
715
|
+
* template: '...'
|
|
716
|
+
* })
|
|
717
|
+
* export class AppComponent {
|
|
718
|
+
* constructor() {
|
|
719
|
+
* if (ngDevMode) {
|
|
720
|
+
* registerNgxsPlugin(MyDevtoolsPlugin);
|
|
721
|
+
* }
|
|
722
|
+
* }
|
|
723
|
+
* }
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
declare function registerNgxsPlugin(plugin: Type<NgxsPlugin> | NgxsPluginFn): void;
|
|
727
|
+
|
|
653
728
|
declare function ɵprovideNgxsInternalStateTokens(): i0.EnvironmentProviders;
|
|
654
729
|
|
|
655
|
-
export { Action, ActionDirector, ActionStatus, Actions, NgxsConfig, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NgxsUnhandledErrorHandler, Select, Selector, SelectorOptions, State, Store, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, lazyProvider, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, select, withNgxsDevelopmentOptions, withNgxsNoopExecutionStrategy, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, ɵprovideNgxsInternalStateTokens };
|
|
730
|
+
export { Action, ActionDirector, ActionStatus, Actions, NgxsConfig, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NgxsUnhandledErrorHandler, Select, Selector, SelectorOptions, State, Store, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, lazyProvider, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, registerNgxsPlugin, select, withNgxsDevelopmentOptions, withNgxsNoopExecutionStrategy, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, ɵprovideNgxsInternalStateTokens };
|
|
656
731
|
export type { ActionCompletion, ActionContext, ActionDef, ActionMap, ActionType, NgxsAfterBootstrap, NgxsDevelopmentOptions, NgxsModuleOptions, NgxsOnChanges, NgxsOnInit, NgxsUnhandledErrorContext, PropertySelectors, SelectorMap, StateContext, TypedSelector, ɵSelectorDef, ɵSelectorFunc, ɵSelectorReturnType, ɵStateSelector };
|