@ngxs/store 19.0.0-dev.master-287dcb1 → 19.0.0-dev.master-f0409e4

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
@@ -520,6 +520,9 @@ declare function provideStore(states?: _StateClass[], options?: NgxsModuleOption
520
520
  * }
521
521
  * ];
522
522
  * ```
523
+ *
524
+ * To lazy-load feature states at the route level,
525
+ * please refer to the `lazyProvider` utility function.
523
526
  */
524
527
  declare function provideStates(states: _StateClass[], ...features: EnvironmentProviders[]): EnvironmentProviders;
525
528
 
@@ -584,6 +587,39 @@ declare function createSelectMap<T extends SelectorMap>(selectorMap: T): { reado
584
587
  type ActionMap = Record<string, ActionDef<any>>;
585
588
  declare function createDispatchMap<T extends ActionMap>(actionMap: T): { readonly [K in keyof T]: (...args: ConstructorParameters<T[K]>) => Observable<void>; };
586
589
 
590
+ interface DefaultExport<T> {
591
+ default: T;
592
+ }
593
+ /**
594
+ * This function serves as a utility to lazy-load providers at the injection
595
+ * context level — for example, at the route level. If the feature state needs
596
+ * to be provided in more than one place, it might be indirectly included in
597
+ * the main bundle, which we want to avoid. This function can be used at the
598
+ * guard level to lazy-load the state provider before resolvers run and the
599
+ * component is initialized:
600
+ *
601
+ * ```ts
602
+ * const routes = [
603
+ * {
604
+ * path: 'home',
605
+ * loadComponent: () => import(...),
606
+ * canActivate: [
607
+ * lazyProvider(async () => (await import('path-to-state-library')).invoicesStateProvider)
608
+ * ]
609
+ * }
610
+ * ];
611
+ * ```
612
+ *
613
+ * Where `invoicesStateProvider` is the following:
614
+ *
615
+ * ```ts
616
+ * // path-to-state-library/index.ts
617
+ *
618
+ * export const invoicesStateProvider = provideStates([InvoicesState]);
619
+ * ```
620
+ */
621
+ declare function lazyProvider(factory: () => Promise<EnvironmentProviders | DefaultExport<EnvironmentProviders>>): () => Promise<boolean>;
622
+
587
623
  declare function ɵprovideNgxsInternalStateTokens(): i0.EnvironmentProviders;
588
624
 
589
- export { Action, type ActionCompletion, type ActionContext, type ActionDef, type ActionMap, ActionStatus, type ActionType, Actions, type NgxsAfterBootstrap, NgxsConfig, NgxsDevelopmentModule, type NgxsDevelopmentOptions, NgxsModule, type NgxsModuleOptions, type NgxsOnChanges, type NgxsOnInit, NgxsSimpleChange, NgxsUnhandledActionsLogger, type NgxsUnhandledErrorContext, NgxsUnhandledErrorHandler, type PropertySelectors, Select, Selector, type SelectorMap, SelectorOptions, State, type StateContext, Store, type TypedSelector, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, select, withNgxsDevelopmentOptions, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, type ɵSelectorDef, type ɵSelectorFunc, type ɵSelectorReturnType, type ɵStateSelector, ɵprovideNgxsInternalStateTokens };
625
+ export { Action, type ActionCompletion, type ActionContext, type ActionDef, type ActionMap, ActionStatus, type ActionType, Actions, type NgxsAfterBootstrap, NgxsConfig, NgxsDevelopmentModule, type NgxsDevelopmentOptions, NgxsModule, type NgxsModuleOptions, type NgxsOnChanges, type NgxsOnInit, NgxsSimpleChange, NgxsUnhandledActionsLogger, type NgxsUnhandledErrorContext, NgxsUnhandledErrorHandler, type PropertySelectors, Select, Selector, type SelectorMap, SelectorOptions, State, type StateContext, Store, type TypedSelector, createDispatchMap, createModelSelector, createPickSelector, createPropertySelectors, createSelectMap, createSelector, dispatch, lazyProvider, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, provideStates, provideStore, select, withNgxsDevelopmentOptions, withNgxsPendingTasks, withNgxsPlugin, withNgxsPreboot, NgxsFeatureModule as ɵNgxsFeatureModule, NgxsRootModule as ɵNgxsRootModule, type ɵSelectorDef, type ɵSelectorFunc, type ɵSelectorReturnType, type ɵStateSelector, ɵprovideNgxsInternalStateTokens };
@@ -201,8 +201,6 @@ declare class ɵStateStream extends ɵOrderedBehaviorSubject<ɵPlainObject> {
201
201
  static ɵprov: i0.ɵɵInjectableDeclaration<ɵStateStream>;
202
202
  }
203
203
 
204
- declare function ɵof<T>(value: T): Observable<T>;
205
-
206
204
  declare const ɵhasOwnProperty: (target: any, key: PropertyKey) => boolean;
207
205
  declare const ɵdefineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
208
206
 
@@ -216,4 +214,4 @@ declare class ɵNgxsActionRegistry {
216
214
  static ɵprov: i0.ɵɵInjectableDeclaration<ɵNgxsActionRegistry>;
217
215
  }
218
216
 
219
- 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, ɵNgxsActionRegistry, ɵ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, ɵdefineProperty, ɵensureSelectorMetadata, ɵensureStoreMetadata, ɵgetSelectorMetadata, ɵgetStoreMetadata, ɵhasOwnProperty, ɵmemoize, ɵof, ɵwrapObserverCalls };
217
+ 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, ɵNgxsActionRegistry, ɵ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, ɵdefineProperty, ɵensureSelectorMetadata, ɵensureStoreMetadata, ɵgetSelectorMetadata, ɵgetStoreMetadata, ɵhasOwnProperty, ɵmemoize, ɵwrapObserverCalls };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngxs/store",
3
- "version": "19.0.0-dev.master-287dcb1",
3
+ "version": "19.0.0-dev.master-f0409e4",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {