@angular-architects/ngrx-toolkit 19.2.0 → 20.0.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/fesm2022/angular-architects-ngrx-toolkit-redux-connector.mjs +3 -3
- package/fesm2022/angular-architects-ngrx-toolkit-redux-connector.mjs.map +1 -1
- package/fesm2022/angular-architects-ngrx-toolkit.mjs +36 -34
- package/fesm2022/angular-architects-ngrx-toolkit.mjs.map +1 -1
- package/index.d.ts +938 -24
- package/package.json +5 -5
- package/redux-connector/index.d.ts +59 -2
- package/lib/assertions/assertions.d.ts +0 -2
- package/lib/devtools/features/with-disabled-name-indicies.d.ts +0 -27
- package/lib/devtools/features/with-glitch-tracking.d.ts +0 -30
- package/lib/devtools/features/with-mapper.d.ts +0 -28
- package/lib/devtools/internal/current-action-names.d.ts +0 -1
- package/lib/devtools/internal/default-tracker.d.ts +0 -13
- package/lib/devtools/internal/devtools-feature.d.ts +0 -24
- package/lib/devtools/internal/devtools-syncer.service.d.ts +0 -35
- package/lib/devtools/internal/glitch-tracker.service.d.ts +0 -18
- package/lib/devtools/internal/models.d.ts +0 -24
- package/lib/devtools/provide-devtools-config.d.ts +0 -20
- package/lib/devtools/rename-devtools-name.d.ts +0 -7
- package/lib/devtools/update-state.d.ts +0 -16
- package/lib/devtools/with-dev-tools-stub.d.ts +0 -5
- package/lib/devtools/with-devtools.d.ts +0 -24
- package/lib/immutable-state/deep-freeze.d.ts +0 -11
- package/lib/immutable-state/is-dev-mode.d.ts +0 -1
- package/lib/immutable-state/with-immutable-state.d.ts +0 -60
- package/lib/shared/prettify.d.ts +0 -3
- package/lib/shared/signal-store-models.d.ts +0 -26
- package/lib/shared/throw-if-null.d.ts +0 -1
- package/lib/storage-sync/features/with-indexed-db.d.ts +0 -2
- package/lib/storage-sync/features/with-local-storage.d.ts +0 -3
- package/lib/storage-sync/internal/indexeddb.service.d.ts +0 -29
- package/lib/storage-sync/internal/local-storage.service.d.ts +0 -8
- package/lib/storage-sync/internal/models.d.ts +0 -34
- package/lib/storage-sync/internal/session-storage.service.d.ts +0 -8
- package/lib/storage-sync/with-storage-sync.d.ts +0 -45
- package/lib/with-call-state.d.ts +0 -58
- package/lib/with-conditional.d.ts +0 -50
- package/lib/with-data-service.d.ts +0 -109
- package/lib/with-feature-factory.d.ts +0 -28
- package/lib/with-pagination.d.ts +0 -101
- package/lib/with-redux.d.ts +0 -147
- package/lib/with-reset.d.ts +0 -29
- package/lib/with-undo-redo.d.ts +0 -31
- package/redux-connector/src/lib/create-redux.d.ts +0 -13
- package/redux-connector/src/lib/model.d.ts +0 -40
- package/redux-connector/src/lib/rxjs-interop/redux-method.d.ts +0 -14
- package/redux-connector/src/lib/signal-redux-store.d.ts +0 -11
- package/redux-connector/src/lib/util.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-architects/ngrx-toolkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "GitHub",
|
|
7
7
|
"url": "https://github.com/angular-architects/ngrx-toolkit"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
|
-
"@angular/core": "^
|
|
11
|
-
"@angular/common": "^
|
|
12
|
-
"@ngrx/signals": "
|
|
13
|
-
"@ngrx/store": "^
|
|
10
|
+
"@angular/core": "^20.0.0",
|
|
11
|
+
"@angular/common": "^20.0.0",
|
|
12
|
+
"@ngrx/signals": "^20.0.0",
|
|
13
|
+
"@ngrx/store": "^20.0.0",
|
|
14
14
|
"rxjs": "^7.0.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependenciesMeta": {
|
|
@@ -1,2 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ActionCreator, ActionType, Prettify, Action } from '@ngrx/store/src/models';
|
|
2
|
+
import { Type, EnvironmentProviders, Signal, Injector } from '@angular/core';
|
|
3
|
+
import { DeepSignal } from '@ngrx/signals/src/deep-signal';
|
|
4
|
+
import { StateSignals, SignalStoreFeatureResult } from '@ngrx/signals/src/signal-store-models';
|
|
5
|
+
import { Observable, Unsubscribable } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
type IncludePropType<T, V, WithNevers = {
|
|
8
|
+
[K in keyof T]: Exclude<T[K], undefined> extends V ? T[K] extends Record<string, unknown> ? IncludePropType<T[K], V> : T[K] : never;
|
|
9
|
+
}> = Prettify<Pick<WithNevers, {
|
|
10
|
+
[K in keyof WithNevers]: WithNevers[K] extends never ? never : K extends string ? K : never;
|
|
11
|
+
}[keyof WithNevers]>>;
|
|
12
|
+
type Store = Type<Record<string, unknown> & StateSignals<SignalStoreFeatureResult['state']>>;
|
|
13
|
+
type CreateReduxState<StoreName extends string, STORE extends Store> = {
|
|
14
|
+
[K in StoreName as `provide${Capitalize<K>}Store`]: (connectReduxDevtools?: boolean) => EnvironmentProviders;
|
|
15
|
+
} & {
|
|
16
|
+
[K in StoreName as `inject${Capitalize<K>}Store`]: () => InjectableReduxSlice<STORE>;
|
|
17
|
+
};
|
|
18
|
+
type Selectors<STORE extends Store> = IncludePropType<InstanceType<STORE>, Signal<unknown> | DeepSignal<unknown>>;
|
|
19
|
+
type Dispatch = {
|
|
20
|
+
dispatch: (input: Action | Observable<Action> | Signal<Action>) => Unsubscribable;
|
|
21
|
+
};
|
|
22
|
+
type InjectableReduxSlice<STORE extends Store> = Selectors<STORE> & Dispatch;
|
|
23
|
+
type ExtractActionTypes<Creators extends readonly ActionCreator[]> = {
|
|
24
|
+
[Key in keyof Creators]: Creators[Key] extends ActionCreator<infer T> ? T : never;
|
|
25
|
+
};
|
|
26
|
+
interface StoreMethod<Creators extends readonly ActionCreator[], ResultState = unknown> {
|
|
27
|
+
(action: ActionType<Creators[number]>): ResultState;
|
|
28
|
+
}
|
|
29
|
+
interface MapperTypes<Creators extends readonly ActionCreator[]> {
|
|
30
|
+
types: ExtractActionTypes<Creators>;
|
|
31
|
+
storeMethod: StoreMethod<Creators>;
|
|
32
|
+
resultMethod?: (...args: unknown[]) => unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare function mapAction<Creators extends readonly ActionCreator[]>(...args: [
|
|
36
|
+
...creators: Creators,
|
|
37
|
+
storeMethod: (action: ActionType<Creators[number]>) => unknown
|
|
38
|
+
]): MapperTypes<Creators>;
|
|
39
|
+
declare function mapAction<Creators extends readonly ActionCreator[], T>(...args: [
|
|
40
|
+
...creators: Creators,
|
|
41
|
+
storeMethod: (action: ActionType<Creators[number]>, resultMethod: (input: T) => unknown) => unknown,
|
|
42
|
+
resultMethod: (input: T) => unknown
|
|
43
|
+
]): MapperTypes<Creators>;
|
|
44
|
+
declare function withActionMappers(...mappers: MapperTypes<ActionCreator[]>[]): MapperTypes<ActionCreator[]>[];
|
|
45
|
+
declare function createReduxState<StoreName extends string, STORE extends Store>(storeName: StoreName, signalStore: STORE, withActionMappers: (store: InstanceType<STORE>) => MapperTypes<ActionCreator[]>[]): CreateReduxState<StoreName, STORE>;
|
|
46
|
+
|
|
47
|
+
type RxMethodInput<Input> = Input | Observable<Input> | Signal<Input>;
|
|
48
|
+
type RxMethodRef = {
|
|
49
|
+
destroy: () => void;
|
|
50
|
+
};
|
|
51
|
+
type RxMethod<Input, MethodInput = Input, MethodResult = unknown> = ((input: RxMethodInput<Input>, resultMethod: (input: MethodInput) => MethodResult) => RxMethodRef) & RxMethodRef;
|
|
52
|
+
declare function reduxMethod<Input, MethodInput = Input>(generator: (source$: Observable<Input>) => Observable<MethodInput>, config?: {
|
|
53
|
+
injector?: Injector;
|
|
54
|
+
}): RxMethod<Input, MethodInput>;
|
|
55
|
+
declare function reduxMethod<Input, MethodInput = Input, MethodResult = unknown>(generator: (source$: Observable<Input>) => Observable<MethodInput>, resultMethod: (input: MethodInput) => MethodResult, config?: {
|
|
56
|
+
injector?: Injector;
|
|
57
|
+
}): RxMethod<Input, MethodInput, MethodResult>;
|
|
58
|
+
|
|
59
|
+
export { createReduxState, mapAction, reduxMethod, withActionMappers };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If multiple instances of the same SignalStore class
|
|
3
|
-
* exist, their devtool names are indexed.
|
|
4
|
-
*
|
|
5
|
-
* For example:
|
|
6
|
-
*
|
|
7
|
-
* ```typescript
|
|
8
|
-
* const Store = signalStore(
|
|
9
|
-
* withDevtools('flights')
|
|
10
|
-
* )
|
|
11
|
-
*
|
|
12
|
-
* const store1 = new Store(); // will show up as 'flights'
|
|
13
|
-
* const store2 = new Store(); // will show up as 'flights-1'
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* With adding `withDisabledNameIndices` to the store:
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const Store = signalStore(
|
|
19
|
-
* withDevtools('flights', withDisabledNameIndices())
|
|
20
|
-
* )
|
|
21
|
-
*
|
|
22
|
-
* const store1 = new Store(); // will show up as 'flights'
|
|
23
|
-
* const store2 = new Store(); //💥 throws an error
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
export declare function withDisabledNameIndices(): import("../internal/devtools-feature").DevtoolsFeature;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* It tracks all state changes of the State, including intermediary updates
|
|
3
|
-
* that are typically suppressed by Angular's glitch-free mechanism.
|
|
4
|
-
*
|
|
5
|
-
* This feature is especially useful for debugging.
|
|
6
|
-
*
|
|
7
|
-
* Example:
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const Store = signalStore(
|
|
11
|
-
* { providedIn: 'root' },
|
|
12
|
-
* withState({ count: 0 }),
|
|
13
|
-
* withDevtools('counter', withGlitchTracking()),
|
|
14
|
-
* withMethods((store) => ({
|
|
15
|
-
* increase: () =>
|
|
16
|
-
* patchState(store, (value) => ({ count: value.count + 1 })),
|
|
17
|
-
* }))
|
|
18
|
-
* );
|
|
19
|
-
*
|
|
20
|
-
* // would show up in the DevTools with value 0
|
|
21
|
-
* const store = inject(Store);
|
|
22
|
-
*
|
|
23
|
-
* store.increase(); // would show up in the DevTools with value 1
|
|
24
|
-
* store.increase(); // would show up in the DevTools with value 2
|
|
25
|
-
* store.increase(); // would show up in the DevTools with value 3
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* Without `withGlitchTracking`, the DevTools would only show the final value of 3.
|
|
29
|
-
*/
|
|
30
|
-
export declare function withGlitchTracking(): import("../internal/devtools-feature").DevtoolsFeature;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Allows you to define a function to map the state.
|
|
3
|
-
*
|
|
4
|
-
* It is needed for huge states, that slows down the Devtools and where
|
|
5
|
-
* you don't need to see the whole state or other reasons.
|
|
6
|
-
*
|
|
7
|
-
* Example:
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const initialState = {
|
|
11
|
-
* id: 1,
|
|
12
|
-
* email: 'john.list@host.com',
|
|
13
|
-
* name: 'John List',
|
|
14
|
-
* enteredPassword: ''
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* const Store = signalStore(
|
|
18
|
-
* withState(initialState),
|
|
19
|
-
* withDevtools(
|
|
20
|
-
* 'user',
|
|
21
|
-
* withMapper(state => ({...state, enteredPassword: '***' }))
|
|
22
|
-
* )
|
|
23
|
-
* )
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @param map function which maps the state
|
|
27
|
-
*/
|
|
28
|
-
export declare function withMapper<State extends object>(map: (state: State) => Record<string, unknown>): import("../internal/devtools-feature").DevtoolsFeature;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const currentActionNames: Set<string>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StateSource } from '@ngrx/signals';
|
|
2
|
-
import { Tracker, TrackerStores } from './models';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class DefaultTracker implements Tracker {
|
|
5
|
-
#private;
|
|
6
|
-
get stores(): TrackerStores;
|
|
7
|
-
track(id: string, store: StateSource<object>): void;
|
|
8
|
-
onChange(callback: (changedState: Record<string, object>) => void): void;
|
|
9
|
-
removeStore(id: string): void;
|
|
10
|
-
notifyRenamedStore(id: string): void;
|
|
11
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultTracker, never>;
|
|
12
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DefaultTracker>;
|
|
13
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Tracker } from './models';
|
|
2
|
-
export declare const DEVTOOLS_FEATURE: unique symbol;
|
|
3
|
-
export type Mapper = (state: object) => object;
|
|
4
|
-
export type DevtoolsOptions = {
|
|
5
|
-
indexNames?: boolean;
|
|
6
|
-
map?: Mapper;
|
|
7
|
-
tracker?: new () => Tracker;
|
|
8
|
-
};
|
|
9
|
-
export type DevtoolsInnerOptions = {
|
|
10
|
-
indexNames: boolean;
|
|
11
|
-
map: Mapper;
|
|
12
|
-
tracker: Tracker;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* A DevtoolsFeature adds or modifies the behavior of the
|
|
16
|
-
* devtools extension.
|
|
17
|
-
*
|
|
18
|
-
* We use them (function calls) instead of a config object,
|
|
19
|
-
* because of tree-shaking.
|
|
20
|
-
*/
|
|
21
|
-
export type DevtoolsFeature = {
|
|
22
|
-
[DEVTOOLS_FEATURE]: true;
|
|
23
|
-
} & Partial<DevtoolsOptions>;
|
|
24
|
-
export declare function createDevtoolsFeature(options: DevtoolsOptions): DevtoolsFeature;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { StateSource } from '@ngrx/signals';
|
|
3
|
-
import { DevtoolsInnerOptions } from './devtools-feature';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
/**
|
|
6
|
-
* A service provided by the root injector is
|
|
7
|
-
* required because the synchronization runs
|
|
8
|
-
* globally.
|
|
9
|
-
*
|
|
10
|
-
* The SignalStore could be provided in a component.
|
|
11
|
-
* If the effect starts in the injection
|
|
12
|
-
* context of the SignalStore, the complete sync
|
|
13
|
-
* process would shut down once the component gets
|
|
14
|
-
* destroyed.
|
|
15
|
-
*/
|
|
16
|
-
export declare class DevtoolsSyncer implements OnDestroy {
|
|
17
|
-
#private;
|
|
18
|
-
constructor();
|
|
19
|
-
ngOnDestroy(): void;
|
|
20
|
-
syncToDevTools(changedStatePerId: Record<string, object>): void;
|
|
21
|
-
getNextId(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Consumer provides the id. That is because we can only start
|
|
24
|
-
* tracking the store in the init hook.
|
|
25
|
-
* Unfortunately, methods for renaming having the final id
|
|
26
|
-
* need to be defined already before.
|
|
27
|
-
* That's why `withDevtools` requests first the id and
|
|
28
|
-
* then registers itself later.
|
|
29
|
-
*/
|
|
30
|
-
addStore(id: string, name: string, store: StateSource<object>, options: DevtoolsInnerOptions): void;
|
|
31
|
-
removeStore(id: string): void;
|
|
32
|
-
renameStore(oldName: string, newName: string): void;
|
|
33
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DevtoolsSyncer, never>;
|
|
34
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DevtoolsSyncer>;
|
|
35
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StateSource } from '@ngrx/signals';
|
|
2
|
-
import { Tracker, TrackerStores } from './models';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Internal Service used by {@link withGlitchTracking}. It does not rely
|
|
6
|
-
* on `effect` as {@link DefaultTracker} does but uses the NgRx function
|
|
7
|
-
* `watchState` to track all state changes.
|
|
8
|
-
*/
|
|
9
|
-
export declare class GlitchTrackerService implements Tracker {
|
|
10
|
-
#private;
|
|
11
|
-
get stores(): TrackerStores;
|
|
12
|
-
onChange(callback: (changedState: Record<string, object>) => void): void;
|
|
13
|
-
removeStore(id: string): void;
|
|
14
|
-
track(id: string, store: StateSource<object>): void;
|
|
15
|
-
notifyRenamedStore(id: string): void;
|
|
16
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<GlitchTrackerService, never>;
|
|
17
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<GlitchTrackerService>;
|
|
18
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { StateSource } from '@ngrx/signals';
|
|
2
|
-
import { ReduxDevtoolsConfig } from '../provide-devtools-config';
|
|
3
|
-
import { DevtoolsInnerOptions } from './devtools-feature';
|
|
4
|
-
export type Action = {
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
export type Connection = {
|
|
8
|
-
send: (action: Action, state: Record<string, unknown>) => void;
|
|
9
|
-
};
|
|
10
|
-
export type ReduxDevtoolsExtension = {
|
|
11
|
-
connect: (options: ReduxDevtoolsConfig) => Connection;
|
|
12
|
-
};
|
|
13
|
-
export type StoreRegistry = Record<string, {
|
|
14
|
-
options: DevtoolsInnerOptions;
|
|
15
|
-
name: string;
|
|
16
|
-
}>;
|
|
17
|
-
export type Tracker = {
|
|
18
|
-
track(id: string, store: StateSource<object>): void;
|
|
19
|
-
onChange(callback: (changedState: Record<string, object>) => void): void;
|
|
20
|
-
notifyRenamedStore(id: string): void;
|
|
21
|
-
removeStore(id: string): void;
|
|
22
|
-
get stores(): TrackerStores;
|
|
23
|
-
};
|
|
24
|
-
export type TrackerStores = Record<string, StateSource<object>>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, ValueProvider } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Provides the configuration options for connecting to the Redux DevTools Extension.
|
|
4
|
-
*/
|
|
5
|
-
export declare function provideDevtoolsConfig(config: ReduxDevtoolsConfig): ValueProvider;
|
|
6
|
-
/**
|
|
7
|
-
* Injection token for the configuration options for connecting to the Redux DevTools Extension.
|
|
8
|
-
*/
|
|
9
|
-
export declare const REDUX_DEVTOOLS_CONFIG: InjectionToken<ReduxDevtoolsConfig>;
|
|
10
|
-
/**
|
|
11
|
-
* Options for connecting to the Redux DevTools Extension.
|
|
12
|
-
* @example
|
|
13
|
-
* const devToolsOptions: ReduxDevtoolsConfig = {
|
|
14
|
-
* name: 'My App',
|
|
15
|
-
* };
|
|
16
|
-
*/
|
|
17
|
-
export type ReduxDevtoolsConfig = {
|
|
18
|
-
/** Optional name for the devtools instance. If empty, "NgRx SignalStore" will be used. */
|
|
19
|
-
name?: string;
|
|
20
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { StateSource } from '@ngrx/signals';
|
|
2
|
-
/**
|
|
3
|
-
* Renames the name of a store how it appears in the Devtools.
|
|
4
|
-
* @param store instance of the SignalStore
|
|
5
|
-
* @param newName new name for the Devtools
|
|
6
|
-
*/
|
|
7
|
-
export declare function renameDevtoolsName<State extends object>(store: StateSource<State>, newName: string): void;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { patchState as originalPatchState, PartialStateUpdater, WritableStateSource } from '@ngrx/signals';
|
|
2
|
-
import { Prettify } from '../shared/prettify';
|
|
3
|
-
type PatchFn = typeof originalPatchState extends (arg1: infer First, ...args: infer Rest) => infer Returner ? (state: First, action: string, ...rest: Rest) => Returner : never;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Has been renamed to `updateState`
|
|
6
|
-
*/
|
|
7
|
-
export declare const patchState: PatchFn;
|
|
8
|
-
/**
|
|
9
|
-
* Wrapper of `patchState` for DevTools integration. Next to updating the state,
|
|
10
|
-
* it also sends the action to the DevTools.
|
|
11
|
-
* @param stateSource state of Signal Store
|
|
12
|
-
* @param action name of action how it will show in DevTools
|
|
13
|
-
* @param updaters updater functions or objects
|
|
14
|
-
*/
|
|
15
|
-
export declare function updateState<State extends object>(stateSource: WritableStateSource<State>, action: string, ...updaters: Array<Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>>): void;
|
|
16
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EmptyFeatureResult, SignalStoreFeature } from '@ngrx/signals';
|
|
2
|
-
import { DevtoolsFeature } from './internal/devtools-feature';
|
|
3
|
-
import { ReduxDevtoolsExtension } from './internal/models';
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
__REDUX_DEVTOOLS_EXTENSION__: ReduxDevtoolsExtension | undefined;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export declare const renameDevtoolsMethodName = "___renameDevtoolsName";
|
|
10
|
-
export declare const uniqueDevtoolsId = "___uniqueDevtoolsId";
|
|
11
|
-
/**
|
|
12
|
-
* Adds this store as a feature state to the Redux DevTools.
|
|
13
|
-
*
|
|
14
|
-
* By default, the action name is 'Store Update'. You can
|
|
15
|
-
* change that via the {@link updateState} method, which has as second
|
|
16
|
-
* parameter the action name.
|
|
17
|
-
*
|
|
18
|
-
* The standalone function {@link renameDevtoolsName} can rename
|
|
19
|
-
* the store name.
|
|
20
|
-
*
|
|
21
|
-
* @param name name of the store as it should appear in the DevTools
|
|
22
|
-
* @param features features to extend or modify the behavior of the Devtools
|
|
23
|
-
*/
|
|
24
|
-
export declare function withDevtools(name: string, ...features: DevtoolsFeature[]): SignalStoreFeature<EmptyFeatureResult, EmptyFeatureResult>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep freezes a state object along its properties with primitive values
|
|
3
|
-
* on the first level.
|
|
4
|
-
*
|
|
5
|
-
* The reason for this is that the final state is a merge of all
|
|
6
|
-
* root properties of all states, i.e. `withState`,....
|
|
7
|
-
*
|
|
8
|
-
* Since the root object will not be part of the state (shadow clone),
|
|
9
|
-
* we are not freezing it.
|
|
10
|
-
*/
|
|
11
|
-
export declare function deepFreeze<T extends Record<string | symbol, unknown>>(target: T, propertyNamesToBeFrozen: (string | symbol)[], isRoot?: boolean): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isDevMode(): boolean;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { EmptyFeatureResult, SignalStoreFeature, SignalStoreFeatureResult } from '@ngrx/signals';
|
|
2
|
-
/**
|
|
3
|
-
* The implementation of this feature is a little bit tricky.
|
|
4
|
-
*
|
|
5
|
-
* `signalStore` does a shallow clone in the initial phase, in order to
|
|
6
|
-
* merge all different states together.
|
|
7
|
-
*
|
|
8
|
-
* Shallow cloning also happens in `patchState`.
|
|
9
|
-
*
|
|
10
|
-
* With shallow cloning, the root state object is replaced, which means,
|
|
11
|
-
* the freezing only stays for its nested properties but not for
|
|
12
|
-
* the primitive and immediate properties.
|
|
13
|
-
*
|
|
14
|
-
* For example:
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* const state = {
|
|
18
|
-
* id: 1,
|
|
19
|
-
* address: {
|
|
20
|
-
* street: 'Main St',
|
|
21
|
-
* city: 'Springfield',
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* Running `Object.freeze` on `state` will freeze the `address` object, and
|
|
27
|
-
* the `id`. But since `state` is shallow cloned, the "frozing" state of the
|
|
28
|
-
* `id` is lost. `address`, being an object, is still frozen.
|
|
29
|
-
*
|
|
30
|
-
* To overcome that, we run `watchState` and run `deepFreeze`
|
|
31
|
-
* on every change.
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* Prevents mutation of the state.
|
|
35
|
-
*
|
|
36
|
-
* This is done by deeply applying `Object.freeze`. Any mutable change within
|
|
37
|
-
* or outside the `SignalStore` will throw an error.
|
|
38
|
-
*
|
|
39
|
-
* @param state the state object
|
|
40
|
-
* @param options enable protection in production (default: false)
|
|
41
|
-
*/
|
|
42
|
-
export declare function withImmutableState<State extends object>(state: State, options?: {
|
|
43
|
-
enableInProduction?: boolean;
|
|
44
|
-
}): SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & {
|
|
45
|
-
state: State;
|
|
46
|
-
}>;
|
|
47
|
-
/**
|
|
48
|
-
* Prevents mutation of the state.
|
|
49
|
-
*
|
|
50
|
-
* This is done by deeply applying `Object.freeze`. Any mutable change within
|
|
51
|
-
* or outside the `SignalStore` will throw an error.
|
|
52
|
-
*
|
|
53
|
-
* @param stateFactory a function returning the state object
|
|
54
|
-
* @param options enable protection in production (default: false)
|
|
55
|
-
*/
|
|
56
|
-
export declare function withImmutableState<State extends object>(stateFactory: () => State, options?: {
|
|
57
|
-
enableInProduction?: boolean;
|
|
58
|
-
}): SignalStoreFeature<SignalStoreFeatureResult, EmptyFeatureResult & {
|
|
59
|
-
state: State;
|
|
60
|
-
}>;
|
package/lib/shared/prettify.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains copies of types of the Signal Store which are not public.
|
|
3
|
-
*
|
|
4
|
-
* Since certain features depend on them, if we don't want to break
|
|
5
|
-
* the encapsulation of @ngrx/signals, we decided to copy them.
|
|
6
|
-
*
|
|
7
|
-
* Since TypeScript is based on structural typing, we can get away with it.
|
|
8
|
-
*
|
|
9
|
-
* If @ngrx/signals changes its internal types, we catch them via integration
|
|
10
|
-
* tests.
|
|
11
|
-
*
|
|
12
|
-
* Because of the "tight coupling", the toolkit doesn't have version range
|
|
13
|
-
* to @ngrx/signal, but is very precise.
|
|
14
|
-
*/
|
|
15
|
-
import { Signal } from '@angular/core';
|
|
16
|
-
import { EntityId } from '@ngrx/signals/entities';
|
|
17
|
-
export type EntityState<Entity> = {
|
|
18
|
-
entityMap: Record<EntityId, Entity>;
|
|
19
|
-
ids: EntityId[];
|
|
20
|
-
};
|
|
21
|
-
export type EntityComputed<Entity> = {
|
|
22
|
-
entities: Signal<Entity[]>;
|
|
23
|
-
};
|
|
24
|
-
export type NamedEntityComputed<Entity, Collection extends string> = {
|
|
25
|
-
[K in keyof EntityComputed<Entity> as `${Collection}${Capitalize<K>}`]: EntityComputed<Entity>[K];
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function throwIfNull<T>(obj: T): NonNullable<T>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
export declare const keyPath = "ngrxToolkitKeyPath";
|
|
3
|
-
export declare const dbName = "ngrxToolkitDb";
|
|
4
|
-
export declare const storeName = "ngrxToolkitStore";
|
|
5
|
-
export declare const VERSION: number;
|
|
6
|
-
export declare class IndexedDBService {
|
|
7
|
-
/**
|
|
8
|
-
* write to indexedDB
|
|
9
|
-
* @param key
|
|
10
|
-
* @param data
|
|
11
|
-
*/
|
|
12
|
-
setItem(key: string, data: string): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* read from indexedDB
|
|
15
|
-
* @param key
|
|
16
|
-
*/
|
|
17
|
-
getItem(key: string): Promise<string | null>;
|
|
18
|
-
/**
|
|
19
|
-
* delete indexedDB
|
|
20
|
-
* @param key
|
|
21
|
-
*/
|
|
22
|
-
clear(key: string): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* open indexedDB
|
|
25
|
-
*/
|
|
26
|
-
private openDB;
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<IndexedDBService, never>;
|
|
28
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<IndexedDBService>;
|
|
29
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
export declare class LocalStorageService {
|
|
3
|
-
getItem(key: string): string | null;
|
|
4
|
-
setItem(key: string, data: string): void;
|
|
5
|
-
clear(key: string): void;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
|
|
7
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
|
|
8
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Signal, WritableSignal } from '@angular/core';
|
|
2
|
-
import { EmptyFeatureResult, WritableStateSource } from '@ngrx/signals';
|
|
3
|
-
import { SyncConfig } from '../with-storage-sync';
|
|
4
|
-
export type SyncMethods = {
|
|
5
|
-
clearStorage(): void;
|
|
6
|
-
readFromStorage(): void;
|
|
7
|
-
writeToStorage(): void;
|
|
8
|
-
};
|
|
9
|
-
export type SyncFeatureResult = EmptyFeatureResult & {
|
|
10
|
-
methods: SyncMethods;
|
|
11
|
-
};
|
|
12
|
-
export type SyncStoreForFactory<State extends object> = WritableStateSource<State>;
|
|
13
|
-
export type SyncStorageStrategy<State extends object> = ((config: Required<SyncConfig<State>>, store: SyncStoreForFactory<State>, useStubs: boolean) => SyncMethods) & {
|
|
14
|
-
type: 'sync';
|
|
15
|
-
};
|
|
16
|
-
export type AsyncMethods = {
|
|
17
|
-
clearStorage(): Promise<void>;
|
|
18
|
-
readFromStorage(): Promise<void>;
|
|
19
|
-
writeToStorage(): Promise<void>;
|
|
20
|
-
};
|
|
21
|
-
export declare const SYNC_STATUS: unique symbol;
|
|
22
|
-
export type SyncStatus = 'idle' | 'syncing' | 'synced';
|
|
23
|
-
export type AsyncFeatureResult = EmptyFeatureResult & {
|
|
24
|
-
methods: AsyncMethods;
|
|
25
|
-
props: {
|
|
26
|
-
isSynced: Signal<boolean>;
|
|
27
|
-
whenSynced: () => Promise<void>;
|
|
28
|
-
[SYNC_STATUS]: WritableSignal<SyncStatus>;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export type AsyncStoreForFactory<State extends object> = WritableStateSource<State> & AsyncFeatureResult['props'];
|
|
32
|
-
export type AsyncStorageStrategy<State extends object> = ((config: Required<SyncConfig<State>>, store: AsyncStoreForFactory<State>, useStubs: boolean) => AsyncMethods) & {
|
|
33
|
-
type: 'async';
|
|
34
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
export declare class SessionStorageService {
|
|
3
|
-
getItem(key: string): string | null;
|
|
4
|
-
setItem(key: string, data: string): void;
|
|
5
|
-
clear(key: string): void;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageService, never>;
|
|
7
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageService>;
|
|
8
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { SignalStoreFeature, SignalStoreFeatureResult } from '@ngrx/signals';
|
|
2
|
-
import { AsyncFeatureResult, AsyncStorageStrategy, SyncFeatureResult, SyncStorageStrategy } from './internal/models';
|
|
3
|
-
export type SyncConfig<State> = {
|
|
4
|
-
/**
|
|
5
|
-
* The key which is used to access the storage.
|
|
6
|
-
*/
|
|
7
|
-
key: string;
|
|
8
|
-
/**
|
|
9
|
-
* Flag indicating if the store should read from storage on init and write to storage on every state change.
|
|
10
|
-
*
|
|
11
|
-
* `true` by default
|
|
12
|
-
*/
|
|
13
|
-
autoSync?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Function to select that portion of the state which should be stored.
|
|
16
|
-
*
|
|
17
|
-
* Returns the whole state object by default
|
|
18
|
-
*/
|
|
19
|
-
select?: (state: State) => unknown;
|
|
20
|
-
/**
|
|
21
|
-
* Function used to parse the state coming from storage.
|
|
22
|
-
*
|
|
23
|
-
* `JSON.parse()` by default
|
|
24
|
-
*/
|
|
25
|
-
parse?: (stateString: string) => State;
|
|
26
|
-
/**
|
|
27
|
-
* Function used to transform the state into a string representation.
|
|
28
|
-
*
|
|
29
|
-
* `JSON.stringify()` by default
|
|
30
|
-
*/
|
|
31
|
-
stringify?: (state: State) => string;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use {@link withSessionStorage} instead.
|
|
34
|
-
* Factory function used to switch to sessionStorage.
|
|
35
|
-
*
|
|
36
|
-
* `localStorage` by default
|
|
37
|
-
*/
|
|
38
|
-
storage?: () => Storage;
|
|
39
|
-
};
|
|
40
|
-
export declare function withStorageSync<Input extends SignalStoreFeatureResult>(key: string): SignalStoreFeature<Input, SyncFeatureResult>;
|
|
41
|
-
export declare function withStorageSync<Input extends SignalStoreFeatureResult>(key: string, storageStrategy: AsyncStorageStrategy<Input['state']>): SignalStoreFeature<Input, AsyncFeatureResult>;
|
|
42
|
-
export declare function withStorageSync<Input extends SignalStoreFeatureResult>(key: string, storageStrategy: SyncStorageStrategy<Input['state']>): SignalStoreFeature<Input, SyncFeatureResult>;
|
|
43
|
-
export declare function withStorageSync<Input extends SignalStoreFeatureResult>(config: SyncConfig<Input['state']>): SignalStoreFeature<Input, SyncFeatureResult>;
|
|
44
|
-
export declare function withStorageSync<Input extends SignalStoreFeatureResult>(config: SyncConfig<Input['state']>, storageStrategy: AsyncStorageStrategy<Input['state']>): SignalStoreFeature<Input, AsyncFeatureResult>;
|
|
45
|
-
export declare function withStorageSync<Input extends SignalStoreFeatureResult>(config: SyncConfig<Input['state']>, storageStrategy: SyncStorageStrategy<Input['state']>): SignalStoreFeature<Input, SyncFeatureResult>;
|