@tramvai/tokens-common 4.8.6 → 4.9.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/lib/env.d.ts +21 -1
- package/lib/env.es.js +14 -4
- package/lib/env.js +13 -2
- package/lib/index.es.js +1 -1
- package/lib/index.js +1 -0
- package/package.json +4 -4
package/lib/env.d.ts
CHANGED
|
@@ -3,16 +3,36 @@ export interface EnvironmentManager {
|
|
|
3
3
|
getInt(name: string, def: number): number;
|
|
4
4
|
getAll(): Record<string, string>;
|
|
5
5
|
update(result: Record<string, string>): void;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use CLIENT_ENV_MANAGER_TOKEN
|
|
8
|
+
*/
|
|
6
9
|
clientUsed(): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use CLIENT_ENV_MANAGER_TOKEN
|
|
12
|
+
*/
|
|
7
13
|
updateClientUsed(result: Record<string, string>): void;
|
|
8
14
|
}
|
|
15
|
+
export interface ClientEnvironmentRepository {
|
|
16
|
+
get(name: string): string | undefined;
|
|
17
|
+
set(name: string, value: string): void;
|
|
18
|
+
getAll(): Record<string, string>;
|
|
19
|
+
update(result: Record<string, string>): void;
|
|
20
|
+
}
|
|
9
21
|
/**
|
|
10
22
|
* @description
|
|
11
|
-
* Instance that used for managing
|
|
23
|
+
* Instance that used for managing environment variables
|
|
12
24
|
*/
|
|
13
25
|
export declare const ENV_MANAGER_TOKEN: EnvironmentManager & {
|
|
14
26
|
__type?: "base token" | undefined;
|
|
15
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* Instance that used for store and manage environment variables map, which are passed to the client.
|
|
31
|
+
* Use only server-side for client env values modification depending on the specific request conditions.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CLIENT_ENV_REPOSITORY_TOKEN: ClientEnvironmentRepository & {
|
|
34
|
+
__type?: "base token" | undefined;
|
|
35
|
+
};
|
|
16
36
|
/**
|
|
17
37
|
* @description
|
|
18
38
|
* List of envs that are used by the module or the app.
|
package/lib/env.es.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { createToken } from '@tinkoff/dippy';
|
|
1
|
+
import { createToken, Scope } from '@tinkoff/dippy';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
5
|
-
* Instance that used for managing
|
|
5
|
+
* Instance that used for managing environment variables
|
|
6
6
|
*/
|
|
7
|
-
const ENV_MANAGER_TOKEN = createToken('environmentManager'
|
|
7
|
+
const ENV_MANAGER_TOKEN = createToken('environmentManager', {
|
|
8
|
+
scope: Scope.SINGLETON,
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* Instance that used for store and manage environment variables map, which are passed to the client.
|
|
13
|
+
* Use only server-side for client env values modification depending on the specific request conditions.
|
|
14
|
+
*/
|
|
15
|
+
const CLIENT_ENV_REPOSITORY_TOKEN = createToken('clientEnvironmentManager', {
|
|
16
|
+
scope: Scope.REQUEST,
|
|
17
|
+
});
|
|
8
18
|
const ENV_USED_TOKEN = createToken('envUsed', { multi: true });
|
|
9
19
|
|
|
10
|
-
export { ENV_MANAGER_TOKEN, ENV_USED_TOKEN };
|
|
20
|
+
export { CLIENT_ENV_REPOSITORY_TOKEN, ENV_MANAGER_TOKEN, ENV_USED_TOKEN };
|
package/lib/env.js
CHANGED
|
@@ -6,10 +6,21 @@ var dippy = require('@tinkoff/dippy');
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
* Instance that used for managing
|
|
9
|
+
* Instance that used for managing environment variables
|
|
10
10
|
*/
|
|
11
|
-
const ENV_MANAGER_TOKEN = dippy.createToken('environmentManager'
|
|
11
|
+
const ENV_MANAGER_TOKEN = dippy.createToken('environmentManager', {
|
|
12
|
+
scope: dippy.Scope.SINGLETON,
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* Instance that used for store and manage environment variables map, which are passed to the client.
|
|
17
|
+
* Use only server-side for client env values modification depending on the specific request conditions.
|
|
18
|
+
*/
|
|
19
|
+
const CLIENT_ENV_REPOSITORY_TOKEN = dippy.createToken('clientEnvironmentManager', {
|
|
20
|
+
scope: dippy.Scope.REQUEST,
|
|
21
|
+
});
|
|
12
22
|
const ENV_USED_TOKEN = dippy.createToken('envUsed', { multi: true });
|
|
13
23
|
|
|
24
|
+
exports.CLIENT_ENV_REPOSITORY_TOKEN = CLIENT_ENV_REPOSITORY_TOKEN;
|
|
14
25
|
exports.ENV_MANAGER_TOKEN = ENV_MANAGER_TOKEN;
|
|
15
26
|
exports.ENV_USED_TOKEN = ENV_USED_TOKEN;
|
package/lib/index.es.js
CHANGED
|
@@ -9,6 +9,6 @@ export { COMBINE_REDUCERS, DISPATCHER_CONTEXT_TOKEN, DISPATCHER_TOKEN, INITIAL_A
|
|
|
9
9
|
export { LOGGER_INIT_HOOK, LOGGER_REMOTE_REPORTER, LOGGER_SHARED_CONTEXT, LOGGER_TOKEN } from './logger.es.js';
|
|
10
10
|
export { REQUEST_MANAGER_TOKEN } from './requestManager.es.js';
|
|
11
11
|
export { RESPONSE_MANAGER_TOKEN } from './responseManager.es.js';
|
|
12
|
-
export { ENV_MANAGER_TOKEN, ENV_USED_TOKEN } from './env.es.js';
|
|
12
|
+
export { CLIENT_ENV_REPOSITORY_TOKEN, ENV_MANAGER_TOKEN, ENV_USED_TOKEN } from './env.es.js';
|
|
13
13
|
export { COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, EXECUTION_CONTEXT_MANAGER_TOKEN, ROOT_EXECUTION_CONTEXT_TOKEN } from './execution.es.js';
|
|
14
14
|
export { ASYNC_LOCAL_STORAGE_TOKEN } from './async-local-storage.es.js';
|
package/lib/index.js
CHANGED
|
@@ -47,6 +47,7 @@ exports.LOGGER_SHARED_CONTEXT = logger.LOGGER_SHARED_CONTEXT;
|
|
|
47
47
|
exports.LOGGER_TOKEN = logger.LOGGER_TOKEN;
|
|
48
48
|
exports.REQUEST_MANAGER_TOKEN = requestManager.REQUEST_MANAGER_TOKEN;
|
|
49
49
|
exports.RESPONSE_MANAGER_TOKEN = responseManager.RESPONSE_MANAGER_TOKEN;
|
|
50
|
+
exports.CLIENT_ENV_REPOSITORY_TOKEN = env.CLIENT_ENV_REPOSITORY_TOKEN;
|
|
50
51
|
exports.ENV_MANAGER_TOKEN = env.ENV_MANAGER_TOKEN;
|
|
51
52
|
exports.ENV_USED_TOKEN = env.ENV_USED_TOKEN;
|
|
52
53
|
exports.COMMAND_LINE_EXECUTION_CONTEXT_TOKEN = execution.COMMAND_LINE_EXECUTION_CONTEXT_TOKEN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-common",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.1",
|
|
4
4
|
"description": "Tramvai tokens for @tramvai/module-common",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@tinkoff/lru-cache-nano": "^7.9.0",
|
|
22
22
|
"@tinkoff/url": "0.10.1",
|
|
23
|
-
"@tramvai/react": "4.
|
|
24
|
-
"@tramvai/tokens-core": "4.
|
|
23
|
+
"@tramvai/react": "4.9.1",
|
|
24
|
+
"@tramvai/tokens-core": "4.9.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@tinkoff/dippy": "0.10.2",
|
|
28
28
|
"@tinkoff/logger": "0.10.273",
|
|
29
|
-
"@tramvai/types-actions-state-context": "4.
|
|
29
|
+
"@tramvai/types-actions-state-context": "4.9.1",
|
|
30
30
|
"react": ">=16.8",
|
|
31
31
|
"tslib": "^2.4.0"
|
|
32
32
|
},
|