@ngrx/signals 19.0.0 → 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/entities/src/helpers.d.ts +4 -4
- package/entities/src/index.d.ts +4 -0
- package/entities/src/updaters/prepend-entities.d.ts +17 -0
- package/entities/src/updaters/prepend-entity.d.ts +17 -0
- package/entities/src/updaters/upsert-entities.d.ts +17 -0
- package/entities/src/updaters/upsert-entity.d.ts +17 -0
- package/fesm2022/ngrx-signals-entities.mjs +68 -10
- package/fesm2022/ngrx-signals-entities.mjs.map +1 -1
- package/fesm2022/ngrx-signals-rxjs-interop.mjs +9 -2
- package/fesm2022/ngrx-signals-rxjs-interop.mjs.map +1 -1
- package/fesm2022/ngrx-signals-testing.mjs +15 -0
- package/fesm2022/ngrx-signals-testing.mjs.map +1 -0
- package/fesm2022/ngrx-signals.mjs +74 -52
- package/fesm2022/ngrx-signals.mjs.map +1 -1
- package/package.json +6 -1
- package/rxjs-interop/src/index.d.ts +1 -1
- package/rxjs-interop/src/rx-method.d.ts +1 -1
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/src/index.d.ts +3 -2
- package/src/signal-method.d.ts +1 -2
- package/src/signal-store-assertions.d.ts +1 -1
- package/src/state-source.d.ts +1 -0
- package/src/with-feature.d.ts +25 -0
- package/testing/index.d.ts +1 -0
- package/testing/src/index.d.ts +1 -0
- package/testing/src/unprotected.d.ts +4 -0
- package/src/deep-freeze.d.ts +0 -2
package/src/state-source.d.ts
CHANGED
|
@@ -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 {};
|
package/src/deep-freeze.d.ts
DELETED