@tramvai/state 2.7.1 → 2.20.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.
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type { AnyAction as Action } from '@tramvai/types-actions-state-context';
|
|
1
|
+
import type { AnyAction as Action, TramvaiAction } from '@tramvai/types-actions-state-context';
|
|
2
|
+
export declare function useActions<P extends any[], R, Deps = any>(action: TramvaiAction<P, R, Deps>): (...args: P) => Promise<R extends Promise<infer U> ? U : R>;
|
|
3
|
+
export declare function useActions<A extends TramvaiAction<any, any, any>[]>(actions: A): {
|
|
4
|
+
[key in keyof A]: (...args: any[]) => Promise<any>;
|
|
5
|
+
};
|
|
6
|
+
export declare function useActions<A extends Readonly<TramvaiAction<any, any, any>[]>>(actions: A): {
|
|
7
|
+
[Key in keyof A]: A[Key] extends TramvaiAction<infer P, infer R, any> ? (...args: P) => Promise<R extends Promise<infer U> ? U : R> : never;
|
|
8
|
+
};
|
|
2
9
|
export declare function useActions<P, R>(action: Action<P, R>): (payload?: P) => Promise<R extends PromiseLike<infer U> ? U : R>;
|
|
3
10
|
export declare function useActions<A extends Action<any, any>[]>(actions: A): {
|
|
4
11
|
[key in keyof A]: (payload?: any) => Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatcherContext as DispatcherContextInterface } from '@tramvai/types-actions-state-context';
|
|
1
2
|
import type { Dispatcher } from './dispatcher';
|
|
2
3
|
import type { StoreClass } from '../typings';
|
|
3
4
|
import type { Middleware } from './dispatcher.h';
|
|
@@ -16,7 +17,7 @@ export declare class ChildDispatcherContext<TContext> extends DispatcherContext<
|
|
|
16
17
|
context: TContext;
|
|
17
18
|
initialState: InitialState;
|
|
18
19
|
middlewares?: Middleware[];
|
|
19
|
-
parentDispatcherContext:
|
|
20
|
+
parentDispatcherContext: DispatcherContextInterface<TContext>;
|
|
20
21
|
parentAllowedStores?: Array<StoreClass | string | {
|
|
21
22
|
store: StoreClass | string;
|
|
22
23
|
optional: true;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare type Dispatch = <Payload>(event: Event<Payload>) => Payload;
|
|
3
|
-
export interface MiddlewareApi {
|
|
4
|
-
dispatch: Dispatch;
|
|
5
|
-
subscribe(handler: () => void): () => void;
|
|
6
|
-
getState(): Record<string, any>;
|
|
7
|
-
}
|
|
8
|
-
export declare type Middleware = (api: MiddlewareApi) => (next: Dispatch) => (event: Event) => any;
|
|
1
|
+
export { Dispatch, MiddlewareApi, Middleware } from '@tramvai/types-actions-state-context';
|
package/lib/typings.d.ts
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface StoreClass {
|
|
3
|
-
handlers: Record<string, Function | string>;
|
|
4
|
-
storeName: string;
|
|
5
|
-
dependencies?: Array<StoreClass | string | {
|
|
6
|
-
store: StoreClass | string;
|
|
7
|
-
optional: true;
|
|
8
|
-
}>;
|
|
9
|
-
new (dispatcher: DispatcherContext<any>['dispatcherInterface']): any;
|
|
10
|
-
}
|
|
11
|
-
export declare type StoreInstance = InstanceType<StoreClass>;
|
|
1
|
+
export { StoreClass, StoreInstance } from '@tramvai/types-actions-state-context';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/state",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"build-for-publish": "true"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tinkoff/react-hooks": "0.
|
|
21
|
+
"@tinkoff/react-hooks": "0.1.2",
|
|
22
22
|
"@tinkoff/utils": "^2.1.2",
|
|
23
|
-
"@tramvai/types-actions-state-context": "2.
|
|
23
|
+
"@tramvai/types-actions-state-context": "2.20.0",
|
|
24
24
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
25
25
|
"invariant": "^2.2.4",
|
|
26
26
|
"react-is": ">=17",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@reatom/core": "^1.1.5",
|
|
38
|
+
"@tramvai/core": "2.20.0",
|
|
38
39
|
"@types/invariant": "^2.2.31",
|
|
39
40
|
"@types/react-is": "^17.0.0",
|
|
40
41
|
"@types/use-sync-external-store": "^0.0.3",
|