@ngrx/signals 19.0.1 → 19.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrx/signals",
3
- "version": "19.0.1",
3
+ "version": "19.1.0",
4
4
  "description": "Reactive Store and Set of Utilities for Angular Signals",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,6 +69,10 @@
69
69
  "./rxjs-interop": {
70
70
  "types": "./rxjs-interop/index.d.ts",
71
71
  "default": "./fesm2022/ngrx-signals-rxjs-interop.mjs"
72
+ },
73
+ "./testing": {
74
+ "types": "./testing/index.d.ts",
75
+ "default": "./fesm2022/ngrx-signals-testing.mjs"
72
76
  }
73
77
  }
74
78
  }
@@ -1 +1 @@
1
- export { rxMethod } from './rx-method';
1
+ export { rxMethod, RxMethod } from './rx-method';
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
3
3
  type RxMethodRef = {
4
4
  destroy: () => void;
5
5
  };
6
- type RxMethod<Input> = ((input: Input | Signal<Input> | Observable<Input>, config?: {
6
+ export type RxMethod<Input> = ((input: Input | Signal<Input> | Observable<Input>, config?: {
7
7
  injector?: Injector;
8
8
  }) => RxMethodRef) & RxMethodRef;
9
9
  export declare function rxMethod<Input>(generator: (source$: Observable<Input>) => Observable<unknown>, config?: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.platformVersion = void 0;
4
- exports.platformVersion = '^19.0.1';
4
+ exports.platformVersion = '^19.1.0';
5
5
  //# sourceMappingURL=libs-version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^19.0.1';\n"]}
1
+ {"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/signals/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^19.1.0';\n"]}
package/src/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  export { deepComputed } from './deep-computed';
2
2
  export { DeepSignal } from './deep-signal';
3
- export { signalMethod } from './signal-method';
3
+ export { signalMethod, SignalMethod } from './signal-method';
4
4
  export { signalState, SignalState } from './signal-state';
5
5
  export { signalStore } from './signal-store';
6
6
  export { signalStoreFeature, type } from './signal-store-feature';
7
7
  export { EmptyFeatureResult, SignalStoreFeature, SignalStoreFeatureResult, StateSignals, } from './signal-store-models';
8
- export { getState, PartialStateUpdater, patchState, StateSource, StateWatcher, watchState, WritableStateSource, } from './state-source';
8
+ export { getState, isWritableStateSource, PartialStateUpdater, patchState, StateSource, StateWatcher, watchState, WritableStateSource, } from './state-source';
9
9
  export { Prettify } from './ts-helpers';
10
10
  export { withComputed } from './with-computed';
11
+ export { withFeature } from './with-feature';
11
12
  export { withHooks } from './with-hooks';
12
13
  export { withMethods } from './with-methods';
13
14
  export { withProps } from './with-props';
@@ -1,8 +1,7 @@
1
1
  import { EffectRef, Injector, Signal } from '@angular/core';
2
- type SignalMethod<Input> = ((input: Input | Signal<Input>, config?: {
2
+ export type SignalMethod<Input> = ((input: Input | Signal<Input>, config?: {
3
3
  injector?: Injector;
4
4
  }) => EffectRef) & EffectRef;
5
5
  export declare function signalMethod<Input>(processingFn: (value: Input) => void, config?: {
6
6
  injector?: Injector;
7
7
  }): SignalMethod<Input>;
8
- export {};
@@ -9,6 +9,7 @@ export type StateSource<State extends object> = {
9
9
  };
10
10
  export type PartialStateUpdater<State extends object> = (state: State) => Partial<State>;
11
11
  export type StateWatcher<State extends object> = (state: NoInfer<State>) => void;
12
+ export declare function isWritableStateSource<State extends object>(stateSource: StateSource<State>): stateSource is WritableStateSource<State>;
12
13
  export declare function patchState<State extends object>(stateSource: WritableStateSource<State>, ...updaters: Array<Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>>): void;
13
14
  export declare function getState<State extends object>(stateSource: StateSource<State>): State;
14
15
  export declare function watchState<State extends object>(stateSource: StateSource<State>, watcher: StateWatcher<State>, config?: {
@@ -0,0 +1,25 @@
1
+ import { SignalStoreFeature, SignalStoreFeatureResult, StateSignals } from './signal-store-models';
2
+ import { Prettify } from './ts-helpers';
3
+ /**
4
+ * @description
5
+ * Allows passing properties, methods, or signals from a SignalStore
6
+ * to a feature.
7
+ *
8
+ * @usageNotes
9
+ * ```typescript
10
+ * signalStore(
11
+ * withMethods((store) => ({
12
+ * load(id: number): Observable<Entity> {
13
+ * return of({ id, name: 'John' });
14
+ * },
15
+ * })),
16
+ * withFeature(
17
+ * // 👇 has full access to the store
18
+ * (store) => withEntityLoader((id) => firstValueFrom(store.load(id)))
19
+ * )
20
+ * );
21
+ * ```
22
+ *
23
+ * @param featureFactory function returning the actual feature
24
+ */
25
+ export declare function withFeature<Input extends SignalStoreFeatureResult, Output extends SignalStoreFeatureResult>(featureFactory: (store: Prettify<StateSignals<Input['state']> & Input['props'] & Input['methods']>) => SignalStoreFeature<Input, Output>): SignalStoreFeature<Input, Output>;
@@ -0,0 +1 @@
1
+ export * from './src/index';
@@ -0,0 +1 @@
1
+ export { unprotected } from './unprotected';
@@ -0,0 +1,4 @@
1
+ import { Prettify, StateSource, WritableStateSource } from '@ngrx/signals';
2
+ type UnprotectedSource<Source extends StateSource<object>> = Source extends StateSource<infer State> ? Prettify<Omit<Source, keyof StateSource<State>> & WritableStateSource<State>> : never;
3
+ export declare function unprotected<Source extends StateSource<object>>(source: Source): UnprotectedSource<Source>;
4
+ export {};