@angular-architects/ngrx-toolkit 20.0.1 → 20.0.2
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/eslint.config.cjs +43 -0
- package/jest.config.ts +22 -0
- package/ng-package.json +7 -0
- package/package.json +4 -21
- package/project.json +37 -0
- package/redux-connector/docs/README.md +131 -0
- package/redux-connector/index.ts +6 -0
- package/redux-connector/ng-package.json +5 -0
- package/redux-connector/src/lib/create-redux.ts +102 -0
- package/redux-connector/src/lib/model.ts +89 -0
- package/redux-connector/src/lib/rxjs-interop/redux-method.ts +66 -0
- package/redux-connector/src/lib/signal-redux-store.ts +59 -0
- package/redux-connector/src/lib/util.ts +22 -0
- package/src/index.ts +43 -0
- package/src/lib/assertions/assertions.ts +9 -0
- package/src/lib/devtools/features/with-disabled-name-indicies.ts +31 -0
- package/src/lib/devtools/features/with-glitch-tracking.ts +35 -0
- package/src/lib/devtools/features/with-mapper.ts +34 -0
- package/src/lib/devtools/internal/current-action-names.ts +1 -0
- package/src/lib/devtools/internal/default-tracker.ts +60 -0
- package/src/lib/devtools/internal/devtools-feature.ts +37 -0
- package/src/lib/devtools/internal/devtools-syncer.service.ts +202 -0
- package/src/lib/devtools/internal/glitch-tracker.service.ts +61 -0
- package/src/lib/devtools/internal/models.ts +29 -0
- package/src/lib/devtools/provide-devtools-config.ts +32 -0
- package/src/lib/devtools/rename-devtools-name.ts +21 -0
- package/src/lib/devtools/tests/action-name.spec.ts +48 -0
- package/src/lib/devtools/tests/basic.spec.ts +111 -0
- package/src/lib/devtools/tests/connecting.spec.ts +37 -0
- package/src/lib/devtools/tests/helpers.spec.ts +43 -0
- package/src/lib/devtools/tests/naming.spec.ts +216 -0
- package/src/lib/devtools/tests/provide-devtools-config.spec.ts +25 -0
- package/src/lib/devtools/tests/types.spec.ts +19 -0
- package/src/lib/devtools/tests/update-state.spec.ts +29 -0
- package/src/lib/devtools/tests/with-devtools.spec.ts +5 -0
- package/src/lib/devtools/tests/with-glitch-tracking.spec.ts +272 -0
- package/src/lib/devtools/tests/with-mapper.spec.ts +69 -0
- package/src/lib/devtools/update-state.ts +38 -0
- package/src/lib/devtools/with-dev-tools-stub.ts +6 -0
- package/src/lib/devtools/with-devtools.ts +81 -0
- package/src/lib/immutable-state/deep-freeze.ts +43 -0
- package/src/lib/immutable-state/is-dev-mode.ts +6 -0
- package/src/lib/immutable-state/tests/with-immutable-state.spec.ts +278 -0
- package/src/lib/immutable-state/with-immutable-state.ts +150 -0
- package/src/lib/shared/prettify.ts +3 -0
- package/src/lib/shared/signal-store-models.ts +30 -0
- package/src/lib/shared/throw-if-null.ts +7 -0
- package/src/lib/storage-sync/features/with-indexed-db.ts +81 -0
- package/src/lib/storage-sync/features/with-local-storage.ts +58 -0
- package/src/lib/storage-sync/internal/indexeddb.service.ts +124 -0
- package/src/lib/storage-sync/internal/local-storage.service.ts +19 -0
- package/src/lib/storage-sync/internal/models.ts +62 -0
- package/src/lib/storage-sync/internal/session-storage.service.ts +18 -0
- package/src/lib/storage-sync/tests/indexeddb.service.spec.ts +99 -0
- package/src/lib/storage-sync/tests/with-storage-async.spec.ts +305 -0
- package/src/lib/storage-sync/tests/with-storage-sync.spec.ts +273 -0
- package/src/lib/storage-sync/with-storage-sync.ts +236 -0
- package/src/lib/with-call-state.spec.ts +42 -0
- package/src/lib/with-call-state.ts +195 -0
- package/src/lib/with-conditional.spec.ts +125 -0
- package/src/lib/with-conditional.ts +74 -0
- package/src/lib/with-data-service.spec.ts +564 -0
- package/src/lib/with-data-service.ts +433 -0
- package/src/lib/with-feature-factory.spec.ts +69 -0
- package/src/lib/with-feature-factory.ts +56 -0
- package/src/lib/with-pagination.spec.ts +135 -0
- package/src/lib/with-pagination.ts +373 -0
- package/src/lib/with-redux.spec.ts +258 -0
- package/src/lib/with-redux.ts +387 -0
- package/src/lib/with-reset.spec.ts +112 -0
- package/src/lib/with-reset.ts +62 -0
- package/src/lib/with-undo-redo.spec.ts +274 -0
- package/src/lib/with-undo-redo.ts +200 -0
- package/src/test-setup.ts +6 -0
- package/tsconfig.json +29 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +17 -0
- package/fesm2022/angular-architects-ngrx-toolkit-redux-connector.mjs +0 -119
- package/fesm2022/angular-architects-ngrx-toolkit-redux-connector.mjs.map +0 -1
- package/fesm2022/angular-architects-ngrx-toolkit.mjs +0 -1789
- package/fesm2022/angular-architects-ngrx-toolkit.mjs.map +0 -1
- package/index.d.ts +0 -949
- package/redux-connector/index.d.ts +0 -59
|
@@ -1,59 +0,0 @@
|
|
|
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 };
|