@tramvai/tokens-common 1.35.6 → 1.37.1
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/README.md +12 -12
- package/lib/action.d.ts +4 -4
- package/lib/bundle.d.ts +3 -3
- package/lib/cache.d.ts +3 -3
- package/lib/context.d.ts +1 -1
- package/lib/env.d.ts +9 -9
- package/lib/hook.d.ts +5 -5
- package/lib/index.es.js +29 -28
- package/lib/index.js +29 -28
- package/lib/logger.d.ts +2 -2
- package/lib/pubsub.d.ts +3 -3
- package/lib/requestManager.d.ts +3 -3
- package/lib/responseManager.d.ts +3 -3
- package/lib/state.d.ts +5 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
# Common tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tramvai tokens for integration and extension `@tramvai/module-common`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Action tokens
|
|
6
6
|
|
|
7
7
|
@inline src/action.ts
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Bundle tokens
|
|
10
10
|
|
|
11
11
|
@inline src/bundle.ts
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## ComponentRegistry tokens
|
|
14
14
|
|
|
15
15
|
@inline src/componentRegistry.ts
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Env tokens
|
|
18
18
|
|
|
19
19
|
@inline src/env.ts
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Context tokens
|
|
22
22
|
|
|
23
23
|
@inline src/context.ts
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Hook tokens
|
|
26
26
|
|
|
27
27
|
@inline src/hook.ts
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Logger tokens
|
|
30
30
|
|
|
31
31
|
@inline src/logger.ts
|
|
32
32
|
|
|
33
|
-
##
|
|
33
|
+
## Pubsub tokens
|
|
34
34
|
|
|
35
35
|
@inline src/pubsub.ts
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## RequestManager tokens
|
|
38
38
|
|
|
39
39
|
@inline src/requestManager.ts
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## ResponseManager tokens
|
|
42
42
|
|
|
43
43
|
@inline src/responseManager.ts
|
|
44
44
|
|
|
45
|
-
##
|
|
45
|
+
## State tokens
|
|
46
46
|
|
|
47
47
|
@inline src/state.ts
|
package/lib/action.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { Action } from '@tramvai/core';
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
|
-
*
|
|
4
|
+
* Registry for storing actions based on their type
|
|
5
5
|
*/
|
|
6
6
|
export declare const ACTION_REGISTRY_TOKEN: ActionsRegistry;
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
*
|
|
9
|
+
* Instance that executes actions
|
|
10
10
|
*/
|
|
11
11
|
export declare const ACTION_EXECUTION_TOKEN: ActionExecution;
|
|
12
12
|
/**
|
|
13
13
|
* @description
|
|
14
|
-
*
|
|
14
|
+
* Instance that executes actions on navigations
|
|
15
15
|
*/
|
|
16
16
|
export declare const ACTION_PAGE_RUNNER_TOKEN: ActionPageRunner;
|
|
17
17
|
/**
|
|
18
18
|
* @description
|
|
19
|
-
*
|
|
19
|
+
* Conditions that specify should action be executing or not
|
|
20
20
|
*/
|
|
21
21
|
export declare const ACTION_CONDITIONALS: ActionCondition[];
|
|
22
22
|
export interface ActionsRegistry {
|
package/lib/bundle.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Bundle } from '@tramvai/core';
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
|
-
*
|
|
4
|
+
* Bundle Storage. When getting bundle additionally adds actions and components from bundle to according storages
|
|
5
5
|
*/
|
|
6
6
|
export declare const BUNDLE_MANAGER_TOKEN: BundleManager;
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Provides additional bundles to the app.
|
|
10
|
+
* Important! This token doesn't overrides already existing bundles.
|
|
11
11
|
*/
|
|
12
12
|
export declare const ADDITIONAL_BUNDLE_TOKEN: {
|
|
13
13
|
[key: string]: Bundle;
|
package/lib/cache.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description
|
|
3
|
-
*
|
|
3
|
+
* Function for creating a new cache
|
|
4
4
|
*/
|
|
5
5
|
export declare const CREATE_CACHE_TOKEN: CacheFactory;
|
|
6
6
|
/**
|
|
7
7
|
* @description
|
|
8
|
-
*
|
|
8
|
+
* Function that us called on force cache clean up in the app
|
|
9
9
|
*/
|
|
10
10
|
export declare const REGISTER_CLEAR_CACHE_TOKEN: (type: string) => void | Promise<void>;
|
|
11
11
|
/**
|
|
12
12
|
* @description
|
|
13
|
-
*
|
|
13
|
+
* Force cleaning up all caches in the app
|
|
14
14
|
*/
|
|
15
15
|
export declare const CLEAR_CACHE_TOKEN: (type?: string | undefined) => Promise<void>;
|
|
16
16
|
export interface Cache<T = any> {
|
package/lib/context.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { PUBSUB_TOKEN } from './pubsub';
|
|
|
4
4
|
export { PlatformAction } from '@tramvai/types-actions-state-context';
|
|
5
5
|
/**
|
|
6
6
|
* @description
|
|
7
|
-
*
|
|
7
|
+
* Context implementation
|
|
8
8
|
*/
|
|
9
9
|
export declare const CONTEXT_TOKEN: ConsumerContext;
|
|
10
10
|
export interface ConsumerContext extends BaseConsumerContext {
|
package/lib/env.d.ts
CHANGED
|
@@ -8,19 +8,19 @@ export interface EnvironmentManager {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* @description
|
|
11
|
-
*
|
|
11
|
+
* Instance that used for managing env data on the server and on the client
|
|
12
12
|
*/
|
|
13
13
|
export declare const ENV_MANAGER_TOKEN: EnvironmentManager;
|
|
14
14
|
/**
|
|
15
15
|
* @description
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
- `key` -
|
|
20
|
-
- `value` -
|
|
21
|
-
- `optional` -
|
|
22
|
-
- `validator` -
|
|
23
|
-
- `dehydrate` -
|
|
16
|
+
* List of envs that are used by the module or the app.
|
|
17
|
+
* All of the envs specified by that token will be accessible in the code through `environmentManager`
|
|
18
|
+
* ENV_USED_TOKEN format:
|
|
19
|
+
- `key` - id of the env. At that id the value of the env will be accessible through `environmentManager` and will be loaded from the external sources.
|
|
20
|
+
- `value` - default low-priority value for env `key`
|
|
21
|
+
- `optional` - is current env is optional. If `true` the app can work as usual event if the env value were not provided, if `false` - the app will fail to run without env value
|
|
22
|
+
- `validator` - validation function for passed env value. In case this function returns string it will be used as error message and validation will fail
|
|
23
|
+
- `dehydrate` - if `false` then env value will not be passed to client and this env can be used only on server
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
```tsx
|
package/lib/hook.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description
|
|
3
|
-
*
|
|
3
|
+
* [Hooks documentation](https://tramvai.dev/docs/references/libs/hooks)
|
|
4
4
|
*/
|
|
5
5
|
export declare const HOOK_TOKEN: Hooks;
|
|
6
6
|
declare type Hook<TPayload> = (context: any, payload?: TPayload, options?: any) => TPayload;
|
|
7
7
|
export interface Hooks {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Register hooks
|
|
10
10
|
*/
|
|
11
11
|
registerHooks<TPayload>(name: string, list: Hook<TPayload>[] | Hook<TPayload>): void;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Run sync hook
|
|
14
14
|
*/
|
|
15
15
|
runHooks<TPayload>(name: string, context: any, payload?: TPayload, options?: any): TPayload;
|
|
16
16
|
/**
|
|
17
|
-
* Запуск ассихронных хуков
|
|
17
|
+
* Run async hooksЗапуск ассихронных хуков
|
|
18
18
|
*/
|
|
19
19
|
runAsyncHooks<TPayload>(name: string, context: any, payload: TPayload, options?: any): TPayload;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Run promise hooks
|
|
22
22
|
*/
|
|
23
23
|
runPromiseHooks(name: string, context: any, options?: any): <TPayload>(payload: TPayload) => Promise<TPayload> | Promise<never>;
|
|
24
24
|
}
|
package/lib/index.es.js
CHANGED
|
@@ -2,13 +2,13 @@ import { createToken } from '@tinkoff/dippy';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
5
|
-
*
|
|
5
|
+
* Bundle Storage. When getting bundle additionally adds actions and components from bundle to according storages
|
|
6
6
|
*/
|
|
7
7
|
const BUNDLE_MANAGER_TOKEN = createToken('bundleManager');
|
|
8
8
|
/**
|
|
9
9
|
* @description
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Provides additional bundles to the app.
|
|
11
|
+
* Important! This token doesn't overrides already existing bundles.
|
|
12
12
|
*/
|
|
13
13
|
const ADDITIONAL_BUNDLE_TOKEN = createToken('additional bundle', {
|
|
14
14
|
multi: true,
|
|
@@ -16,28 +16,28 @@ const ADDITIONAL_BUNDLE_TOKEN = createToken('additional bundle', {
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @description
|
|
19
|
-
*
|
|
19
|
+
* Context implementation
|
|
20
20
|
*/
|
|
21
21
|
const CONTEXT_TOKEN = createToken('context');
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @description
|
|
25
|
-
*
|
|
25
|
+
* Registry for storing actions based on their type
|
|
26
26
|
*/
|
|
27
27
|
const ACTION_REGISTRY_TOKEN = createToken('actionRegistry');
|
|
28
28
|
/**
|
|
29
29
|
* @description
|
|
30
|
-
*
|
|
30
|
+
* Instance that executes actions
|
|
31
31
|
*/
|
|
32
32
|
const ACTION_EXECUTION_TOKEN = createToken('actionExecution');
|
|
33
33
|
/**
|
|
34
34
|
* @description
|
|
35
|
-
*
|
|
35
|
+
* Instance that executes actions on navigations
|
|
36
36
|
*/
|
|
37
37
|
const ACTION_PAGE_RUNNER_TOKEN = createToken('actionPageRunner');
|
|
38
38
|
/**
|
|
39
39
|
* @description
|
|
40
|
-
*
|
|
40
|
+
* Conditions that specify should action be executing or not
|
|
41
41
|
*/
|
|
42
42
|
const ACTION_CONDITIONALS = createToken('actionConditionals', {
|
|
43
43
|
multi: true,
|
|
@@ -45,39 +45,39 @@ const ACTION_CONDITIONALS = createToken('actionConditionals', {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* @description
|
|
48
|
-
*
|
|
48
|
+
* [Hooks documentation](https://tramvai.dev/docs/references/libs/hooks)
|
|
49
49
|
*/
|
|
50
50
|
const HOOK_TOKEN = createToken('hooks');
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
54
|
-
*
|
|
54
|
+
* Factory for creating pubsub instances
|
|
55
55
|
*/
|
|
56
56
|
const PUBSUB_FACTORY_TOKEN = createToken('pubsubFactory');
|
|
57
57
|
/**
|
|
58
58
|
* @description
|
|
59
|
-
*
|
|
59
|
+
* Singleton pubsub instance
|
|
60
60
|
*/
|
|
61
61
|
const PUBSUB_TOKEN = createToken('pubsub');
|
|
62
62
|
/**
|
|
63
63
|
* @description
|
|
64
|
-
*
|
|
64
|
+
* Request pubsub instance that is created for every client
|
|
65
65
|
*/
|
|
66
66
|
const ROOT_PUBSUB_TOKEN = createToken('rootPubsub');
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @description
|
|
70
|
-
*
|
|
70
|
+
* Function for creating a new cache
|
|
71
71
|
*/
|
|
72
72
|
const CREATE_CACHE_TOKEN = createToken('createCache');
|
|
73
73
|
/**
|
|
74
74
|
* @description
|
|
75
|
-
*
|
|
75
|
+
* Function that us called on force cache clean up in the app
|
|
76
76
|
*/
|
|
77
77
|
const REGISTER_CLEAR_CACHE_TOKEN = createToken('registerClearCache', { multi: true });
|
|
78
78
|
/**
|
|
79
79
|
* @description
|
|
80
|
-
*
|
|
80
|
+
* Force cleaning up all caches in the app
|
|
81
81
|
*/
|
|
82
82
|
const CLEAR_CACHE_TOKEN = createToken('clearCache');
|
|
83
83
|
|
|
@@ -91,68 +91,69 @@ const COMPONENT_REGISTRY_TOKEN = createToken('componentRegistry');
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* @description
|
|
94
|
+
* dispatcher implementation
|
|
94
95
|
* Реализация dispatcher
|
|
95
96
|
*/
|
|
96
97
|
const DISPATCHER_TOKEN = createToken('dispatcher');
|
|
97
98
|
/**
|
|
98
99
|
* @description
|
|
99
|
-
*
|
|
100
|
+
* dispatcher context implementation
|
|
100
101
|
*/
|
|
101
102
|
const DISPATCHER_CONTEXT_TOKEN = createToken('dispatcherContext');
|
|
102
103
|
/**
|
|
103
104
|
* @description
|
|
104
|
-
*
|
|
105
|
+
* Token for adding stores that were created with createReducer
|
|
105
106
|
*/
|
|
106
107
|
const COMBINE_REDUCERS = createToken('combineReducers', { multi: true });
|
|
107
108
|
/**
|
|
108
109
|
* @description
|
|
109
|
-
*
|
|
110
|
+
* Common app store
|
|
110
111
|
*/
|
|
111
112
|
const STORE_TOKEN = createToken('store');
|
|
112
113
|
/**
|
|
113
114
|
* @description
|
|
114
|
-
*
|
|
115
|
+
* Custom middlewares for working with store state
|
|
115
116
|
*/
|
|
116
117
|
const STORE_MIDDLEWARE = createToken('storeMiddleware', { multi: true });
|
|
117
118
|
|
|
118
119
|
/**
|
|
119
120
|
* @description
|
|
120
|
-
*
|
|
121
|
+
* Logger implementation
|
|
121
122
|
*/
|
|
122
123
|
const LOGGER_TOKEN = createToken('logger');
|
|
123
124
|
/**
|
|
124
125
|
* @description
|
|
125
|
-
*
|
|
126
|
+
* Hook to be able to modify logger on initialization
|
|
126
127
|
*/
|
|
127
128
|
const LOGGER_INIT_HOOK = createToken('loggerHook');
|
|
128
129
|
|
|
129
130
|
/**
|
|
130
131
|
* @description
|
|
131
|
-
*
|
|
132
|
+
* Direct reference to request object
|
|
132
133
|
*/
|
|
133
134
|
const REQUEST = createToken('request');
|
|
134
135
|
/**
|
|
135
136
|
* @description
|
|
136
|
-
*
|
|
137
|
-
*
|
|
137
|
+
* Instance for managing client requests (request headers, query-parameters, cookies etc).
|
|
138
|
+
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
138
139
|
*/
|
|
139
140
|
const REQUEST_MANAGER_TOKEN = createToken('requestManager');
|
|
140
141
|
|
|
141
142
|
/**
|
|
142
143
|
* @description
|
|
143
|
-
*
|
|
144
|
+
* Direct reference to Response instance
|
|
144
145
|
*/
|
|
145
146
|
const RESPONSE = createToken('response');
|
|
146
147
|
/**
|
|
147
148
|
* @description
|
|
148
|
-
*
|
|
149
|
-
*
|
|
149
|
+
* Instance for managing client response (response headers, cookies, response body).
|
|
150
|
+
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
150
151
|
*/
|
|
151
152
|
const RESPONSE_MANAGER_TOKEN = createToken('responseManager');
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
155
|
* @description
|
|
155
|
-
*
|
|
156
|
+
* Instance that used for managing env data on the server and on the client
|
|
156
157
|
*/
|
|
157
158
|
const ENV_MANAGER_TOKEN = createToken('environmentManager');
|
|
158
159
|
const ENV_USED_TOKEN = createToken('envUsed', { multi: true });
|
package/lib/index.js
CHANGED
|
@@ -6,13 +6,13 @@ var dippy = require('@tinkoff/dippy');
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
*
|
|
9
|
+
* Bundle Storage. When getting bundle additionally adds actions and components from bundle to according storages
|
|
10
10
|
*/
|
|
11
11
|
const BUNDLE_MANAGER_TOKEN = dippy.createToken('bundleManager');
|
|
12
12
|
/**
|
|
13
13
|
* @description
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Provides additional bundles to the app.
|
|
15
|
+
* Important! This token doesn't overrides already existing bundles.
|
|
16
16
|
*/
|
|
17
17
|
const ADDITIONAL_BUNDLE_TOKEN = dippy.createToken('additional bundle', {
|
|
18
18
|
multi: true,
|
|
@@ -20,28 +20,28 @@ const ADDITIONAL_BUNDLE_TOKEN = dippy.createToken('additional bundle', {
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @description
|
|
23
|
-
*
|
|
23
|
+
* Context implementation
|
|
24
24
|
*/
|
|
25
25
|
const CONTEXT_TOKEN = dippy.createToken('context');
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* @description
|
|
29
|
-
*
|
|
29
|
+
* Registry for storing actions based on their type
|
|
30
30
|
*/
|
|
31
31
|
const ACTION_REGISTRY_TOKEN = dippy.createToken('actionRegistry');
|
|
32
32
|
/**
|
|
33
33
|
* @description
|
|
34
|
-
*
|
|
34
|
+
* Instance that executes actions
|
|
35
35
|
*/
|
|
36
36
|
const ACTION_EXECUTION_TOKEN = dippy.createToken('actionExecution');
|
|
37
37
|
/**
|
|
38
38
|
* @description
|
|
39
|
-
*
|
|
39
|
+
* Instance that executes actions on navigations
|
|
40
40
|
*/
|
|
41
41
|
const ACTION_PAGE_RUNNER_TOKEN = dippy.createToken('actionPageRunner');
|
|
42
42
|
/**
|
|
43
43
|
* @description
|
|
44
|
-
*
|
|
44
|
+
* Conditions that specify should action be executing or not
|
|
45
45
|
*/
|
|
46
46
|
const ACTION_CONDITIONALS = dippy.createToken('actionConditionals', {
|
|
47
47
|
multi: true,
|
|
@@ -49,39 +49,39 @@ const ACTION_CONDITIONALS = dippy.createToken('actionConditionals', {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @description
|
|
52
|
-
*
|
|
52
|
+
* [Hooks documentation](https://tramvai.dev/docs/references/libs/hooks)
|
|
53
53
|
*/
|
|
54
54
|
const HOOK_TOKEN = dippy.createToken('hooks');
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* @description
|
|
58
|
-
*
|
|
58
|
+
* Factory for creating pubsub instances
|
|
59
59
|
*/
|
|
60
60
|
const PUBSUB_FACTORY_TOKEN = dippy.createToken('pubsubFactory');
|
|
61
61
|
/**
|
|
62
62
|
* @description
|
|
63
|
-
*
|
|
63
|
+
* Singleton pubsub instance
|
|
64
64
|
*/
|
|
65
65
|
const PUBSUB_TOKEN = dippy.createToken('pubsub');
|
|
66
66
|
/**
|
|
67
67
|
* @description
|
|
68
|
-
*
|
|
68
|
+
* Request pubsub instance that is created for every client
|
|
69
69
|
*/
|
|
70
70
|
const ROOT_PUBSUB_TOKEN = dippy.createToken('rootPubsub');
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @description
|
|
74
|
-
*
|
|
74
|
+
* Function for creating a new cache
|
|
75
75
|
*/
|
|
76
76
|
const CREATE_CACHE_TOKEN = dippy.createToken('createCache');
|
|
77
77
|
/**
|
|
78
78
|
* @description
|
|
79
|
-
*
|
|
79
|
+
* Function that us called on force cache clean up in the app
|
|
80
80
|
*/
|
|
81
81
|
const REGISTER_CLEAR_CACHE_TOKEN = dippy.createToken('registerClearCache', { multi: true });
|
|
82
82
|
/**
|
|
83
83
|
* @description
|
|
84
|
-
*
|
|
84
|
+
* Force cleaning up all caches in the app
|
|
85
85
|
*/
|
|
86
86
|
const CLEAR_CACHE_TOKEN = dippy.createToken('clearCache');
|
|
87
87
|
|
|
@@ -95,68 +95,69 @@ const COMPONENT_REGISTRY_TOKEN = dippy.createToken('componentRegistry');
|
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* @description
|
|
98
|
+
* dispatcher implementation
|
|
98
99
|
* Реализация dispatcher
|
|
99
100
|
*/
|
|
100
101
|
const DISPATCHER_TOKEN = dippy.createToken('dispatcher');
|
|
101
102
|
/**
|
|
102
103
|
* @description
|
|
103
|
-
*
|
|
104
|
+
* dispatcher context implementation
|
|
104
105
|
*/
|
|
105
106
|
const DISPATCHER_CONTEXT_TOKEN = dippy.createToken('dispatcherContext');
|
|
106
107
|
/**
|
|
107
108
|
* @description
|
|
108
|
-
*
|
|
109
|
+
* Token for adding stores that were created with createReducer
|
|
109
110
|
*/
|
|
110
111
|
const COMBINE_REDUCERS = dippy.createToken('combineReducers', { multi: true });
|
|
111
112
|
/**
|
|
112
113
|
* @description
|
|
113
|
-
*
|
|
114
|
+
* Common app store
|
|
114
115
|
*/
|
|
115
116
|
const STORE_TOKEN = dippy.createToken('store');
|
|
116
117
|
/**
|
|
117
118
|
* @description
|
|
118
|
-
*
|
|
119
|
+
* Custom middlewares for working with store state
|
|
119
120
|
*/
|
|
120
121
|
const STORE_MIDDLEWARE = dippy.createToken('storeMiddleware', { multi: true });
|
|
121
122
|
|
|
122
123
|
/**
|
|
123
124
|
* @description
|
|
124
|
-
*
|
|
125
|
+
* Logger implementation
|
|
125
126
|
*/
|
|
126
127
|
const LOGGER_TOKEN = dippy.createToken('logger');
|
|
127
128
|
/**
|
|
128
129
|
* @description
|
|
129
|
-
*
|
|
130
|
+
* Hook to be able to modify logger on initialization
|
|
130
131
|
*/
|
|
131
132
|
const LOGGER_INIT_HOOK = dippy.createToken('loggerHook');
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* @description
|
|
135
|
-
*
|
|
136
|
+
* Direct reference to request object
|
|
136
137
|
*/
|
|
137
138
|
const REQUEST = dippy.createToken('request');
|
|
138
139
|
/**
|
|
139
140
|
* @description
|
|
140
|
-
*
|
|
141
|
-
*
|
|
141
|
+
* Instance for managing client requests (request headers, query-parameters, cookies etc).
|
|
142
|
+
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
142
143
|
*/
|
|
143
144
|
const REQUEST_MANAGER_TOKEN = dippy.createToken('requestManager');
|
|
144
145
|
|
|
145
146
|
/**
|
|
146
147
|
* @description
|
|
147
|
-
*
|
|
148
|
+
* Direct reference to Response instance
|
|
148
149
|
*/
|
|
149
150
|
const RESPONSE = dippy.createToken('response');
|
|
150
151
|
/**
|
|
151
152
|
* @description
|
|
152
|
-
*
|
|
153
|
-
*
|
|
153
|
+
* Instance for managing client response (response headers, cookies, response body).
|
|
154
|
+
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
154
155
|
*/
|
|
155
156
|
const RESPONSE_MANAGER_TOKEN = dippy.createToken('responseManager');
|
|
156
157
|
|
|
157
158
|
/**
|
|
158
159
|
* @description
|
|
159
|
-
*
|
|
160
|
+
* Instance that used for managing env data on the server and on the client
|
|
160
161
|
*/
|
|
161
162
|
const ENV_MANAGER_TOKEN = dippy.createToken('environmentManager');
|
|
162
163
|
const ENV_USED_TOKEN = dippy.createToken('envUsed', { multi: true });
|
package/lib/logger.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Logger } from '@tinkoff/logger';
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
|
-
*
|
|
4
|
+
* Logger implementation
|
|
5
5
|
*/
|
|
6
6
|
export declare const LOGGER_TOKEN: LoggerFactory;
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
*
|
|
9
|
+
* Hook to be able to modify logger on initialization
|
|
10
10
|
*/
|
|
11
11
|
export declare const LOGGER_INIT_HOOK: LoggerInitHook;
|
|
12
12
|
declare type Config = {
|
package/lib/pubsub.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description
|
|
3
|
-
*
|
|
3
|
+
* Factory for creating pubsub instances
|
|
4
4
|
*/
|
|
5
5
|
export declare const PUBSUB_FACTORY_TOKEN: () => PubSub;
|
|
6
6
|
/**
|
|
7
7
|
* @description
|
|
8
|
-
*
|
|
8
|
+
* Singleton pubsub instance
|
|
9
9
|
*/
|
|
10
10
|
export declare const PUBSUB_TOKEN: PubSub;
|
|
11
11
|
/**
|
|
12
12
|
* @description
|
|
13
|
-
*
|
|
13
|
+
* Request pubsub instance that is created for every client
|
|
14
14
|
*/
|
|
15
15
|
export declare const ROOT_PUBSUB_TOKEN: PubSub;
|
|
16
16
|
export interface PubSub {
|
package/lib/requestManager.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { Request } from 'express';
|
|
|
2
2
|
declare type RequestExt = Request;
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
5
|
-
*
|
|
5
|
+
* Direct reference to request object
|
|
6
6
|
*/
|
|
7
7
|
export declare const REQUEST: RequestExt;
|
|
8
8
|
/**
|
|
9
9
|
* @description
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Instance for managing client requests (request headers, query-parameters, cookies etc).
|
|
11
|
+
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
12
12
|
*/
|
|
13
13
|
export declare const REQUEST_MANAGER_TOKEN: RequestManager;
|
|
14
14
|
export interface RequestManager {
|
package/lib/responseManager.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Response } from 'express';
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
|
-
*
|
|
4
|
+
* Direct reference to Response instance
|
|
5
5
|
*/
|
|
6
6
|
export declare const RESPONSE: Response<any, Record<string, any>>;
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Instance for managing client response (response headers, cookies, response body).
|
|
10
|
+
* Mostly used on server, but has partial functional for browser for simplification build isomorphic app
|
|
11
11
|
*/
|
|
12
12
|
export declare const RESPONSE_MANAGER_TOKEN: ResponseManager;
|
|
13
13
|
export interface ResponseManager {
|
package/lib/state.d.ts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import type { DispatcherContext, Event, Middleware, Reducer } from '@tramvai/state';
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
|
+
* dispatcher implementation
|
|
4
5
|
* Реализация dispatcher
|
|
5
6
|
*/
|
|
6
7
|
export declare const DISPATCHER_TOKEN: any;
|
|
7
8
|
/**
|
|
8
9
|
* @description
|
|
9
|
-
*
|
|
10
|
+
* dispatcher context implementation
|
|
10
11
|
*/
|
|
11
12
|
export declare const DISPATCHER_CONTEXT_TOKEN: DispatcherContext<any>;
|
|
12
13
|
/**
|
|
13
14
|
* @description
|
|
14
|
-
*
|
|
15
|
+
* Token for adding stores that were created with createReducer
|
|
15
16
|
*/
|
|
16
17
|
export declare const COMBINE_REDUCERS: any;
|
|
17
18
|
/**
|
|
18
19
|
* @description
|
|
19
|
-
*
|
|
20
|
+
* Common app store
|
|
20
21
|
*/
|
|
21
22
|
export declare const STORE_TOKEN: Store<Record<string, any>>;
|
|
22
23
|
/**
|
|
23
24
|
* @description
|
|
24
|
-
*
|
|
25
|
+
* Custom middlewares for working with store state
|
|
25
26
|
*/
|
|
26
27
|
export declare const STORE_MIDDLEWARE: Middleware;
|
|
27
28
|
export interface Store<State = Record<string, any>> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.1",
|
|
4
4
|
"description": "Tramvai tokens for @tramvai/module-common",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"@types/express": "^4.17.9"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@tramvai/core": "1.
|
|
26
|
-
"@tramvai/state": "1.
|
|
27
|
-
"@tramvai/types-actions-state-context": "1.
|
|
28
|
-
"@tinkoff/logger": "0.10.
|
|
25
|
+
"@tramvai/core": "1.37.1",
|
|
26
|
+
"@tramvai/state": "1.37.1",
|
|
27
|
+
"@tramvai/types-actions-state-context": "1.37.1",
|
|
28
|
+
"@tinkoff/logger": "0.10.10",
|
|
29
29
|
"@tinkoff/dippy": "0.7.35",
|
|
30
30
|
"express": "^4.17.1",
|
|
31
31
|
"tslib": "^2.0.3"
|