@tramvai/tokens-common 2.0.0 → 2.2.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/lib/action.d.ts CHANGED
@@ -3,22 +3,22 @@ import type { Action } from '@tramvai/tokens-core';
3
3
  * @description
4
4
  * Registry for storing actions based on their type
5
5
  */
6
- export declare const ACTION_REGISTRY_TOKEN: ActionsRegistry;
6
+ export declare const ACTION_REGISTRY_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<ActionsRegistry>;
7
7
  /**
8
8
  * @description
9
9
  * Instance that executes actions
10
10
  */
11
- export declare const ACTION_EXECUTION_TOKEN: ActionExecution;
11
+ export declare const ACTION_EXECUTION_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<ActionExecution>;
12
12
  /**
13
13
  * @description
14
14
  * Instance that executes actions on navigations
15
15
  */
16
- export declare const ACTION_PAGE_RUNNER_TOKEN: ActionPageRunner;
16
+ export declare const ACTION_PAGE_RUNNER_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<ActionPageRunner>;
17
17
  /**
18
18
  * @description
19
19
  * Conditions that specify should action be executing or not
20
20
  */
21
- export declare const ACTION_CONDITIONALS: ActionCondition[];
21
+ export declare const ACTION_CONDITIONALS: import("@tinkoff/dippy/lib/createToken/createToken").MultiTokenInterface<ActionCondition | ActionCondition[]>;
22
22
  export interface ActionsRegistry {
23
23
  add(type: string, actions: Action | Action[]): void;
24
24
  get(type: string, addingActions?: Action[]): Action[];
@@ -26,7 +26,7 @@ export interface ActionsRegistry {
26
26
  remove(type: string, actions?: Action | Action[]): void;
27
27
  }
28
28
  export interface ActionExecution {
29
- execution: Map<string, any[]>;
29
+ execution: Map<string, any>;
30
30
  run(action: Action, payload: any): Promise<any>;
31
31
  }
32
32
  export interface ActionPageRunner {
package/lib/bundle.d.ts CHANGED
@@ -3,15 +3,15 @@ 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: BundleManager;
6
+ export declare const BUNDLE_MANAGER_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<BundleManager>;
7
7
  /**
8
8
  * @description
9
9
  * Provides additional bundles to the app.
10
10
  * Important! This token doesn't overrides already existing bundles.
11
11
  */
12
- export declare const ADDITIONAL_BUNDLE_TOKEN: {
12
+ export declare const ADDITIONAL_BUNDLE_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").MultiTokenInterface<{
13
13
  [key: string]: Bundle;
14
- };
14
+ }>;
15
15
  export interface BundleManager {
16
16
  bundles: Record<string, any>;
17
17
  get(name: string, pageComponent: string): Promise<any>;
package/lib/cache.d.ts CHANGED
@@ -5,17 +5,17 @@ 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: CacheFactory;
8
+ export declare const CREATE_CACHE_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<CacheFactory>;
9
9
  /**
10
10
  * @description
11
11
  * Function that us called on force cache clean up in the app
12
12
  */
13
- export declare const REGISTER_CLEAR_CACHE_TOKEN: (type: string) => void | Promise<void>;
13
+ export declare const REGISTER_CLEAR_CACHE_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").MultiTokenInterface<(type: string) => void | Promise<void>>;
14
14
  /**
15
15
  * @description
16
16
  * Force cleaning up all caches in the app
17
17
  */
18
- export declare const CLEAR_CACHE_TOKEN: (type?: string | undefined) => Promise<void>;
18
+ export declare const CLEAR_CACHE_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<(type?: string | undefined) => Promise<void>>;
19
19
  export interface Cache<T = any> {
20
20
  get(key: string): T;
21
21
  set(key: string, value: T): void;
@@ -11,7 +11,7 @@ export declare type Component = ComponentType & RegistryComponentExtend;
11
11
  * Components in the repository are divided into groups, e.g. you can specify a bundle or a page component as a group key.
12
12
  * The entity also allows you to get static component parameters through the `getComponentParam` method (will not work with `lazy` components)
13
13
  */
14
- export declare const COMPONENT_REGISTRY_TOKEN: ComponentRegistry;
14
+ export declare const COMPONENT_REGISTRY_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<ComponentRegistry>;
15
15
  export interface ComponentRegistry {
16
16
  components: Record<string, Component>;
17
17
  add(name: string, component: Component, group?: string): void;
package/lib/context.d.ts CHANGED
@@ -6,7 +6,7 @@ export { PlatformAction } from '@tramvai/types-actions-state-context';
6
6
  * @description
7
7
  * Context implementation
8
8
  */
9
- export declare const CONTEXT_TOKEN: ConsumerContext;
9
+ export declare const CONTEXT_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<ConsumerContext>;
10
10
  export interface ConsumerContext extends BaseConsumerContext {
11
11
  readonly di: Container;
12
12
  readonly pubsub: typeof PUBSUB_TOKEN;
package/lib/env.d.ts CHANGED
@@ -10,7 +10,7 @@ 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: EnvironmentManager;
13
+ export declare const ENV_MANAGER_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<EnvironmentManager>;
14
14
  /**
15
15
  * @description
16
16
  * List of envs that are used by the module or the app.
@@ -40,4 +40,4 @@ export interface EnvParameter {
40
40
  validator?: (value: string) => boolean | string;
41
41
  dehydrate?: boolean;
42
42
  }
43
- export declare const ENV_USED_TOKEN: EnvParameter[];
43
+ export declare const ENV_USED_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").MultiTokenInterface<EnvParameter[]>;
package/lib/hook.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @description
3
3
  * [Hooks documentation](https://tramvai.dev/docs/references/libs/hooks)
4
4
  */
5
- export declare const HOOK_TOKEN: Hooks;
5
+ export declare const HOOK_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<Hooks>;
6
6
  declare type Hook<TPayload> = (context: any, payload?: TPayload, options?: any) => TPayload;
7
7
  export interface Hooks {
8
8
  /**
package/lib/logger.d.ts CHANGED
@@ -3,12 +3,12 @@ import type { Logger } from '@tinkoff/logger';
3
3
  * @description
4
4
  * Logger implementation
5
5
  */
6
- export declare const LOGGER_TOKEN: LoggerFactory;
6
+ export declare const LOGGER_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<LoggerFactory>;
7
7
  /**
8
8
  * @description
9
9
  * Hook to be able to modify logger on initialization
10
10
  */
11
- export declare const LOGGER_INIT_HOOK: LoggerInitHook;
11
+ export declare const LOGGER_INIT_HOOK: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<LoggerInitHook>;
12
12
  declare type Config = {
13
13
  name: string;
14
14
  [key: string]: any;
package/lib/pubsub.d.ts CHANGED
@@ -2,17 +2,17 @@
2
2
  * @description
3
3
  * Factory for creating pubsub instances
4
4
  */
5
- export declare const PUBSUB_FACTORY_TOKEN: () => PubSub;
5
+ export declare const PUBSUB_FACTORY_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<() => PubSub>;
6
6
  /**
7
7
  * @description
8
8
  * Singleton pubsub instance
9
9
  */
10
- export declare const PUBSUB_TOKEN: PubSub;
10
+ export declare const PUBSUB_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<PubSub>;
11
11
  /**
12
12
  * @description
13
13
  * Request pubsub instance that is created for every client
14
14
  */
15
- export declare const ROOT_PUBSUB_TOKEN: PubSub;
15
+ export declare const ROOT_PUBSUB_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<PubSub>;
16
16
  export interface PubSub {
17
17
  subscribe(event: string, fn: (payload?: any) => void): () => boolean;
18
18
  publish(event: string, ...args: unknown[]): any;
@@ -10,18 +10,18 @@ declare type FastifyRequest = OriginalFastifyRequest & {
10
10
  * @description
11
11
  * Direct reference to request object
12
12
  */
13
- export declare const REQUEST: RequestExt;
13
+ export declare const REQUEST: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<RequestExt>;
14
14
  /**
15
15
  * @description
16
16
  * Direct reference to request object
17
17
  */
18
- export declare const FASTIFY_REQUEST: FastifyRequest;
18
+ export declare const FASTIFY_REQUEST: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<FastifyRequest>;
19
19
  /**
20
20
  * @description
21
21
  * Instance for managing client requests (request headers, query-parameters, cookies etc).
22
22
  * Mostly used on server, but has partial functional for browser for simplification build isomorphic app
23
23
  */
24
- export declare const REQUEST_MANAGER_TOKEN: RequestManager;
24
+ export declare const REQUEST_MANAGER_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<RequestManager>;
25
25
  export interface RequestManager {
26
26
  getBody(): unknown;
27
27
  getUrl(): string;
@@ -6,14 +6,14 @@ import type { FastifyReply } from 'fastify';
6
6
  * @description
7
7
  * Direct reference to Response instance
8
8
  */
9
- export declare const RESPONSE: Response<any, Record<string, any>>;
10
- export declare const FASTIFY_RESPONSE: FastifyReply<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify/types/route").RouteGenericInterface, unknown>;
9
+ export declare const RESPONSE: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<Response<any, Record<string, any>>>;
10
+ export declare const FASTIFY_RESPONSE: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<FastifyReply<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify/types/route").RouteGenericInterface, unknown>>;
11
11
  /**
12
12
  * @description
13
13
  * Instance for managing client response (response headers, cookies, response body).
14
14
  * Mostly used on server, but has partial functional for browser for simplification build isomorphic app
15
15
  */
16
- export declare const RESPONSE_MANAGER_TOKEN: ResponseManager;
16
+ export declare const RESPONSE_MANAGER_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<ResponseManager>;
17
17
  export interface ResponseManager {
18
18
  getBody(): string;
19
19
  setBody(value: string): void;
package/lib/state.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare const DISPATCHER_TOKEN: any;
9
9
  * @description
10
10
  * dispatcher context implementation
11
11
  */
12
- export declare const DISPATCHER_CONTEXT_TOKEN: DispatcherContext<any>;
12
+ export declare const DISPATCHER_CONTEXT_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<DispatcherContext<any>>;
13
13
  /**
14
14
  * @description
15
15
  * Token for adding stores that were created with createReducer
@@ -19,19 +19,19 @@ export declare const COMBINE_REDUCERS: any;
19
19
  * @description
20
20
  * Common app store
21
21
  */
22
- export declare const STORE_TOKEN: Store<Record<string, any>>;
22
+ export declare const STORE_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<Store<Record<string, any>>>;
23
23
  /**
24
24
  * @description
25
25
  * Custom middlewares for working with store state
26
26
  */
27
- export declare const STORE_MIDDLEWARE: Middleware;
27
+ export declare const STORE_MIDDLEWARE: import("@tinkoff/dippy/lib/createToken/createToken").MultiTokenInterface<Middleware>;
28
28
  /**
29
29
  * @description
30
30
  * Начальное состояние для клиента
31
31
  */
32
- export declare const INITIAL_APP_STATE_TOKEN: {
32
+ export declare const INITIAL_APP_STATE_TOKEN: import("@tinkoff/dippy/lib/createToken/createToken").BaseTokenInterface<{
33
33
  stores: Record<string, any>;
34
- };
34
+ }>;
35
35
  export interface Store<State = Record<string, any>> {
36
36
  dispatch: <Payload>(actionOrNameEvent: string | Event<Payload>, payload?: Payload) => Payload;
37
37
  subscribe(callback: (state: Record<string, any>) => void): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-common",
3
- "version": "2.0.0",
3
+ "version": "2.2.2",
4
4
  "description": "Tramvai tokens for @tramvai/module-common",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -20,14 +20,14 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@tinkoff/lru-cache-nano": "^7.8.1",
23
- "@tramvai/tokens-core": "2.0.0",
23
+ "@tramvai/tokens-core": "2.2.2",
24
24
  "@types/express": "^4.17.9"
25
25
  },
26
26
  "peerDependencies": {
27
- "@tinkoff/dippy": "0.7.41",
28
- "@tinkoff/logger": "0.10.17",
29
- "@tramvai/state": "2.0.0",
30
- "@tramvai/types-actions-state-context": "2.0.0",
27
+ "@tinkoff/dippy": "0.7.43",
28
+ "@tinkoff/logger": "0.10.18",
29
+ "@tramvai/state": "2.2.2",
30
+ "@tramvai/types-actions-state-context": "2.2.2",
31
31
  "express": "^4.17.1",
32
32
  "fastify": "^3.29.0",
33
33
  "react": ">=16.8",