@tramvai/tokens-common 2.56.1 → 2.56.5
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/lib/action.d.ts +14 -4
- package/lib/bundle.d.ts +7 -3
- package/lib/cache.d.ts +10 -4
- package/lib/componentRegistry.d.ts +3 -1
- package/lib/context.d.ts +3 -1
- package/lib/env.d.ts +7 -3
- package/lib/execution.d.ts +7 -3
- package/lib/hook.d.ts +3 -1
- package/lib/logger.d.ts +6 -2
- package/lib/pubsub.d.ts +9 -3
- package/lib/requestManager.d.ts +3 -1
- package/lib/responseManager.d.ts +3 -1
- package/lib/state.d.ts +13 -5
- package/package.json +7 -6
package/lib/action.d.ts
CHANGED
|
@@ -5,22 +5,32 @@ import type { ExecutionContext } from './execution';
|
|
|
5
5
|
* @description
|
|
6
6
|
* Registry for storing actions based on their type
|
|
7
7
|
*/
|
|
8
|
-
export declare const ACTION_REGISTRY_TOKEN:
|
|
8
|
+
export declare const ACTION_REGISTRY_TOKEN: ActionsRegistry & {
|
|
9
|
+
__type?: "base token" | undefined;
|
|
10
|
+
};
|
|
9
11
|
/**
|
|
10
12
|
* @description
|
|
11
13
|
* Instance that executes actions
|
|
12
14
|
*/
|
|
13
|
-
export declare const ACTION_EXECUTION_TOKEN:
|
|
15
|
+
export declare const ACTION_EXECUTION_TOKEN: ActionExecution & {
|
|
16
|
+
__type?: "base token" | undefined;
|
|
17
|
+
};
|
|
14
18
|
/**
|
|
15
19
|
* @description
|
|
16
20
|
* Instance that executes actions on navigations
|
|
17
21
|
*/
|
|
18
|
-
export declare const ACTION_PAGE_RUNNER_TOKEN:
|
|
22
|
+
export declare const ACTION_PAGE_RUNNER_TOKEN: ActionPageRunner & {
|
|
23
|
+
__type?: "base token" | undefined;
|
|
24
|
+
};
|
|
19
25
|
/**
|
|
20
26
|
* @description
|
|
21
27
|
* Conditions that specify should action be executing or not
|
|
22
28
|
*/
|
|
23
|
-
export declare const ACTION_CONDITIONALS:
|
|
29
|
+
export declare const ACTION_CONDITIONALS: (ActionCondition & {
|
|
30
|
+
__type?: "multi token" | undefined;
|
|
31
|
+
}) | (ActionCondition[] & {
|
|
32
|
+
__type?: "multi token" | undefined;
|
|
33
|
+
});
|
|
24
34
|
type AnyAction = Action | TramvaiAction<any, any, any>;
|
|
25
35
|
export interface ActionsRegistry {
|
|
26
36
|
add(type: string, actions: AnyAction | TramvaiAction<any[], any, any> | (AnyAction | TramvaiAction<any[], any, any>)[]): void;
|
package/lib/bundle.d.ts
CHANGED
|
@@ -3,15 +3,19 @@ import type { Bundle } from '@tramvai/tokens-core';
|
|
|
3
3
|
* @description
|
|
4
4
|
* Bundle Storage. When getting bundle additionally adds actions and components from bundle to according storages
|
|
5
5
|
*/
|
|
6
|
-
export declare const BUNDLE_MANAGER_TOKEN:
|
|
6
|
+
export declare const BUNDLE_MANAGER_TOKEN: BundleManager & {
|
|
7
|
+
__type?: "base token" | undefined;
|
|
8
|
+
};
|
|
7
9
|
/**
|
|
8
10
|
* @description
|
|
9
11
|
* Provides additional bundles to the app.
|
|
10
12
|
* Important! This token doesn't overrides already existing bundles.
|
|
11
13
|
*/
|
|
12
|
-
export declare const ADDITIONAL_BUNDLE_TOKEN:
|
|
14
|
+
export declare const ADDITIONAL_BUNDLE_TOKEN: {
|
|
13
15
|
[key: string]: Bundle;
|
|
14
|
-
}
|
|
16
|
+
} & {
|
|
17
|
+
__type?: "multi token" | undefined;
|
|
18
|
+
};
|
|
15
19
|
export interface BundleManager {
|
|
16
20
|
bundles: Record<string, any>;
|
|
17
21
|
get(name: string, pageComponent: string): Promise<Bundle | undefined>;
|
package/lib/cache.d.ts
CHANGED
|
@@ -5,17 +5,23 @@ import type { Options } from '@tinkoff/lru-cache-nano';
|
|
|
5
5
|
*
|
|
6
6
|
* *Note*: currently only memory cache with `@tinkoff/lru-cache-nano` is supported
|
|
7
7
|
*/
|
|
8
|
-
export declare const CREATE_CACHE_TOKEN:
|
|
8
|
+
export declare const CREATE_CACHE_TOKEN: CacheFactory & {
|
|
9
|
+
__type?: "base token" | undefined;
|
|
10
|
+
};
|
|
9
11
|
/**
|
|
10
12
|
* @description
|
|
11
13
|
* Function that us called on force cache clean up in the app
|
|
12
14
|
*/
|
|
13
|
-
export declare const REGISTER_CLEAR_CACHE_TOKEN:
|
|
15
|
+
export declare const REGISTER_CLEAR_CACHE_TOKEN: ((type: string) => void | Promise<void>) & {
|
|
16
|
+
__type?: "multi token" | undefined;
|
|
17
|
+
};
|
|
14
18
|
/**
|
|
15
19
|
* @description
|
|
16
20
|
* Force cleaning up all caches in the app
|
|
17
21
|
*/
|
|
18
|
-
export declare const CLEAR_CACHE_TOKEN:
|
|
22
|
+
export declare const CLEAR_CACHE_TOKEN: ((type?: string) => Promise<void>) & {
|
|
23
|
+
__type?: "base token" | undefined;
|
|
24
|
+
};
|
|
19
25
|
export interface Cache<T = any> {
|
|
20
26
|
get(key: string): T | undefined;
|
|
21
27
|
set(key: string, value: T): void;
|
|
@@ -24,6 +30,6 @@ export interface Cache<T = any> {
|
|
|
24
30
|
}
|
|
25
31
|
export type CacheType = 'memory';
|
|
26
32
|
export interface CacheOptionsByType<T> {
|
|
27
|
-
memory: [Options<string, T>] | [];
|
|
33
|
+
memory: [Options<string, T> | undefined] | [];
|
|
28
34
|
}
|
|
29
35
|
export type CacheFactory = <T, Type extends CacheType = 'memory'>(type?: Type, ...args: CacheOptionsByType<T>[Type]) => Cache<T>;
|
|
@@ -5,7 +5,9 @@ import type { TramvaiComponentDecl } from '@tramvai/react';
|
|
|
5
5
|
* Components in the repository are divided into groups, e.g. you can specify a bundle or a page component as a group key.
|
|
6
6
|
* The entity also allows you to get static component parameters through the `getComponentParam` method (will not work with `lazy` components)
|
|
7
7
|
*/
|
|
8
|
-
export declare const COMPONENT_REGISTRY_TOKEN:
|
|
8
|
+
export declare const COMPONENT_REGISTRY_TOKEN: ComponentRegistry & {
|
|
9
|
+
__type?: "base token" | undefined;
|
|
10
|
+
};
|
|
9
11
|
export interface ComponentRegistry {
|
|
10
12
|
components: Record<string, TramvaiComponentDecl>;
|
|
11
13
|
add(name: string, component: TramvaiComponentDecl, group?: string): void;
|
package/lib/context.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export { PlatformAction } from '@tramvai/types-actions-state-context';
|
|
|
6
6
|
* @description
|
|
7
7
|
* Context implementation
|
|
8
8
|
*/
|
|
9
|
-
export declare const CONTEXT_TOKEN:
|
|
9
|
+
export declare const CONTEXT_TOKEN: ConsumerContext & {
|
|
10
|
+
__type?: "base token" | undefined;
|
|
11
|
+
};
|
|
10
12
|
export interface ConsumerContext extends BaseConsumerContext {
|
|
11
13
|
readonly di: Container;
|
|
12
14
|
readonly pubsub: typeof PUBSUB_TOKEN;
|
package/lib/env.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface EnvironmentManager {
|
|
2
|
-
get(name: string): string;
|
|
2
|
+
get(name: string): string | undefined;
|
|
3
3
|
getInt(name: string, def: number): number;
|
|
4
4
|
getAll(): Record<string, string>;
|
|
5
5
|
update(result: Record<string, string>): void;
|
|
@@ -10,7 +10,9 @@ export interface EnvironmentManager {
|
|
|
10
10
|
* @description
|
|
11
11
|
* Instance that used for managing env data on the server and on the client
|
|
12
12
|
*/
|
|
13
|
-
export declare const ENV_MANAGER_TOKEN:
|
|
13
|
+
export declare const ENV_MANAGER_TOKEN: EnvironmentManager & {
|
|
14
|
+
__type?: "base token" | undefined;
|
|
15
|
+
};
|
|
14
16
|
/**
|
|
15
17
|
* @description
|
|
16
18
|
* List of envs that are used by the module or the app.
|
|
@@ -40,4 +42,6 @@ export interface EnvParameter {
|
|
|
40
42
|
validator?: (value: string) => boolean | string;
|
|
41
43
|
dehydrate?: boolean;
|
|
42
44
|
}
|
|
43
|
-
export declare const ENV_USED_TOKEN:
|
|
45
|
+
export declare const ENV_USED_TOKEN: EnvParameter[] & {
|
|
46
|
+
__type?: "multi token" | undefined;
|
|
47
|
+
};
|
package/lib/execution.d.ts
CHANGED
|
@@ -14,8 +14,12 @@ export interface ExecutionContextOptions {
|
|
|
14
14
|
export interface ExecutionContextManager {
|
|
15
15
|
withContext<T>(parentContext: ExecutionContext | null, nameOrOptions: string | ExecutionContextOptions, cb: (context: ExecutionContext, abortController: AbortController) => Promise<T>): Promise<T>;
|
|
16
16
|
}
|
|
17
|
-
export declare const EXECUTION_CONTEXT_MANAGER_TOKEN:
|
|
18
|
-
|
|
17
|
+
export declare const EXECUTION_CONTEXT_MANAGER_TOKEN: ExecutionContextManager & {
|
|
18
|
+
__type?: "base token" | undefined;
|
|
19
|
+
};
|
|
20
|
+
export declare const ROOT_EXECUTION_CONTEXT_TOKEN: (ExecutionContext & {
|
|
21
|
+
__type?: "base token" | undefined;
|
|
22
|
+
}) | null;
|
|
23
|
+
export declare const COMMAND_LINE_EXECUTION_CONTEXT_TOKEN: (() => ExecutionContext | null) & {
|
|
19
24
|
__type?: "base token" | undefined;
|
|
20
25
|
};
|
|
21
|
-
export declare const COMMAND_LINE_EXECUTION_CONTEXT_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<() => ExecutionContext | null>;
|
package/lib/hook.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* @description
|
|
3
3
|
* [Hooks documentation](https://tramvai.dev/docs/references/libs/hooks)
|
|
4
4
|
*/
|
|
5
|
-
export declare const HOOK_TOKEN:
|
|
5
|
+
export declare const HOOK_TOKEN: Hooks & {
|
|
6
|
+
__type?: "base token" | undefined;
|
|
7
|
+
};
|
|
6
8
|
type Hook<TPayload> = (context: any, payload?: TPayload, options?: any) => TPayload;
|
|
7
9
|
export interface Hooks {
|
|
8
10
|
/**
|
package/lib/logger.d.ts
CHANGED
|
@@ -3,12 +3,16 @@ import type { Logger } from '@tinkoff/logger';
|
|
|
3
3
|
* @description
|
|
4
4
|
* Logger implementation
|
|
5
5
|
*/
|
|
6
|
-
export declare const LOGGER_TOKEN:
|
|
6
|
+
export declare const LOGGER_TOKEN: Logger & ((configOrName: string | Config) => Logger) & {
|
|
7
|
+
__type?: "base token" | undefined;
|
|
8
|
+
};
|
|
7
9
|
/**
|
|
8
10
|
* @description
|
|
9
11
|
* Hook to be able to modify logger on initialization
|
|
10
12
|
*/
|
|
11
|
-
export declare const LOGGER_INIT_HOOK:
|
|
13
|
+
export declare const LOGGER_INIT_HOOK: LoggerInitHook & {
|
|
14
|
+
__type?: "base token" | undefined;
|
|
15
|
+
};
|
|
12
16
|
type Config = {
|
|
13
17
|
name: string;
|
|
14
18
|
[key: string]: any;
|
package/lib/pubsub.d.ts
CHANGED
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
* @description
|
|
3
3
|
* Factory for creating pubsub instances
|
|
4
4
|
*/
|
|
5
|
-
export declare const PUBSUB_FACTORY_TOKEN:
|
|
5
|
+
export declare const PUBSUB_FACTORY_TOKEN: (() => PubSub) & {
|
|
6
|
+
__type?: "base token" | undefined;
|
|
7
|
+
};
|
|
6
8
|
/**
|
|
7
9
|
* @description
|
|
8
10
|
* Singleton pubsub instance
|
|
9
11
|
*/
|
|
10
|
-
export declare const PUBSUB_TOKEN:
|
|
12
|
+
export declare const PUBSUB_TOKEN: PubSub & {
|
|
13
|
+
__type?: "base token" | undefined;
|
|
14
|
+
};
|
|
11
15
|
/**
|
|
12
16
|
* @description
|
|
13
17
|
* Request pubsub instance that is created for every client
|
|
14
18
|
*/
|
|
15
|
-
export declare const ROOT_PUBSUB_TOKEN:
|
|
19
|
+
export declare const ROOT_PUBSUB_TOKEN: PubSub & {
|
|
20
|
+
__type?: "base token" | undefined;
|
|
21
|
+
};
|
|
16
22
|
export interface PubSub {
|
|
17
23
|
subscribe(event: string, fn: (payload?: any) => void): () => boolean;
|
|
18
24
|
publish(event: string, ...args: unknown[]): any;
|
package/lib/requestManager.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import type { Url } from '@tinkoff/url';
|
|
|
4
4
|
* Instance for managing client requests (request headers, query-parameters, cookies etc).
|
|
5
5
|
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
6
6
|
*/
|
|
7
|
-
export declare const REQUEST_MANAGER_TOKEN:
|
|
7
|
+
export declare const REQUEST_MANAGER_TOKEN: RequestManager & {
|
|
8
|
+
__type?: "base token" | undefined;
|
|
9
|
+
};
|
|
8
10
|
export interface RequestManager {
|
|
9
11
|
getBody(): unknown;
|
|
10
12
|
getUrl(): string;
|
package/lib/responseManager.d.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Instance for managing client response (response headers, cookies, response body).
|
|
4
4
|
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
5
5
|
*/
|
|
6
|
-
export declare const RESPONSE_MANAGER_TOKEN:
|
|
6
|
+
export declare const RESPONSE_MANAGER_TOKEN: ResponseManager & {
|
|
7
|
+
__type?: "base token" | undefined;
|
|
8
|
+
};
|
|
7
9
|
export interface ResponseManager {
|
|
8
10
|
getBody(): unknown;
|
|
9
11
|
setBody(value: unknown): void;
|
package/lib/state.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ export declare const DISPATCHER_TOKEN: any;
|
|
|
9
9
|
* @description
|
|
10
10
|
* dispatcher context implementation
|
|
11
11
|
*/
|
|
12
|
-
export declare const DISPATCHER_CONTEXT_TOKEN:
|
|
12
|
+
export declare const DISPATCHER_CONTEXT_TOKEN: DispatcherContext<any> & {
|
|
13
|
+
__type?: "base token" | undefined;
|
|
14
|
+
};
|
|
13
15
|
/**
|
|
14
16
|
* @description
|
|
15
17
|
* Token for adding stores that were created with createReducer
|
|
@@ -19,19 +21,25 @@ export declare const COMBINE_REDUCERS: any;
|
|
|
19
21
|
* @description
|
|
20
22
|
* Common app store
|
|
21
23
|
*/
|
|
22
|
-
export declare const STORE_TOKEN:
|
|
24
|
+
export declare const STORE_TOKEN: Store<Record<string, any>> & {
|
|
25
|
+
__type?: "base token" | undefined;
|
|
26
|
+
};
|
|
23
27
|
/**
|
|
24
28
|
* @description
|
|
25
29
|
* Custom middlewares for working with store state
|
|
26
30
|
*/
|
|
27
|
-
export declare const STORE_MIDDLEWARE:
|
|
31
|
+
export declare const STORE_MIDDLEWARE: Middleware & {
|
|
32
|
+
__type?: "multi token" | undefined;
|
|
33
|
+
};
|
|
28
34
|
/**
|
|
29
35
|
* @description
|
|
30
36
|
* Начальное состояние для клиента
|
|
31
37
|
*/
|
|
32
|
-
export declare const INITIAL_APP_STATE_TOKEN:
|
|
38
|
+
export declare const INITIAL_APP_STATE_TOKEN: {
|
|
33
39
|
stores: Record<string, any>;
|
|
34
|
-
}
|
|
40
|
+
} & {
|
|
41
|
+
__type?: "base token" | undefined;
|
|
42
|
+
};
|
|
35
43
|
export interface Store<State = Record<string, any>> {
|
|
36
44
|
dispatch<Payload>(event: Event<Payload>): Payload;
|
|
37
45
|
dispatch<Payload>(actionOrNameEvent: string | Event<Payload>, payload?: Payload): Payload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-common",
|
|
3
|
-
"version": "2.56.
|
|
3
|
+
"version": "2.56.5",
|
|
4
4
|
"description": "Tramvai tokens for @tramvai/module-common",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -21,13 +21,14 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@tinkoff/lru-cache-nano": "^7.8.1",
|
|
23
23
|
"@tinkoff/url": "0.8.4",
|
|
24
|
-
"@tramvai/react": "2.56.
|
|
25
|
-
"@tramvai/tokens-core": "2.56.
|
|
24
|
+
"@tramvai/react": "2.56.5",
|
|
25
|
+
"@tramvai/tokens-core": "2.56.5",
|
|
26
|
+
"node-abort-controller": "^3.0.1"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
28
|
-
"@tinkoff/dippy": "0.8.
|
|
29
|
-
"@tinkoff/logger": "0.10.
|
|
30
|
-
"@tramvai/types-actions-state-context": "2.56.
|
|
29
|
+
"@tinkoff/dippy": "0.8.11",
|
|
30
|
+
"@tinkoff/logger": "0.10.56",
|
|
31
|
+
"@tramvai/types-actions-state-context": "2.56.5",
|
|
31
32
|
"react": ">=16.8",
|
|
32
33
|
"tslib": "^2.4.0"
|
|
33
34
|
},
|