@tramvai/module-http-client 7.27.9 → 7.28.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.
- package/lib/httpClient/httpClientFactory.browser.js +2 -1
- package/lib/httpClient/httpClientFactory.d.ts +3 -2
- package/lib/httpClient/httpClientFactory.es.js +2 -1
- package/lib/httpClient/httpClientFactory.js +2 -1
- package/lib/shared.browser.js +5 -1
- package/lib/shared.d.ts +12 -0
- package/lib/shared.es.js +5 -1
- package/lib/shared.js +4 -0
- package/package.json +14 -14
- package/tests.js +6 -1
|
@@ -11,7 +11,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
11
11
|
: {
|
|
12
12
|
defaultTimeout: 30000,
|
|
13
13
|
};
|
|
14
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
|
|
14
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, logPluginExtensions, commandLineExecutionContext, }) => {
|
|
15
15
|
return (options) => {
|
|
16
16
|
if (!options.name) {
|
|
17
17
|
throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
|
|
@@ -33,6 +33,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
33
33
|
failureThreshold: 75,
|
|
34
34
|
minimumFailureCount: 10,
|
|
35
35
|
},
|
|
36
|
+
logPluginExtensions,
|
|
36
37
|
signal: commandLineExecutionContext?.()?.abortSignal,
|
|
37
38
|
...environmentDependentOptions,
|
|
38
39
|
}, defaultOptions ? mergeOptions(defaultOptions, interceptors) : interceptors), options);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { MakeRequest } from '@tinkoff/request-core';
|
|
2
2
|
import type { HttpClientInterceptor } from '@tramvai/http-client';
|
|
3
3
|
import type { APP_INFO_TOKEN } from '@tramvai/core';
|
|
4
|
-
import type { API_CLIENT_PASS_HEADERS, HttpClientFactoryOptions, HTTP_CLIENT_AGENT, HTTP_CLIENT_FACTORY, DISABLE_CIRCUIT_BREAKER } from '@tramvai/tokens-http-client';
|
|
4
|
+
import type { API_CLIENT_PASS_HEADERS, HttpClientFactoryOptions, HTTP_CLIENT_AGENT, HTTP_CLIENT_FACTORY, DISABLE_CIRCUIT_BREAKER, HTTP_CLIENT_LOGGER_EXTENSION } from '@tramvai/tokens-http-client';
|
|
5
5
|
import type { LOGGER_TOKEN, CREATE_CACHE_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN } from '@tramvai/tokens-common';
|
|
6
6
|
import type { QuerySerializer } from '@tinkoff/request-plugin-protocol-http';
|
|
7
7
|
import type { ExtractDependencyType, ExtractTokenType } from '@tinkoff/dippy';
|
|
8
|
-
export declare const httpClientFactory: ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker, defaultOptions, defaultInterceptors, commandLineExecutionContext, }: {
|
|
8
|
+
export declare const httpClientFactory: ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker, defaultOptions, defaultInterceptors, logPluginExtensions, commandLineExecutionContext, }: {
|
|
9
9
|
logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
|
|
10
10
|
envManager: ExtractDependencyType<typeof ENV_MANAGER_TOKEN>;
|
|
11
11
|
appInfo: ExtractDependencyType<typeof APP_INFO_TOKEN>;
|
|
@@ -18,6 +18,7 @@ export declare const httpClientFactory: ({ logger, envManager, appInfo, requestM
|
|
|
18
18
|
disableCircuitBreaker: ExtractDependencyType<typeof DISABLE_CIRCUIT_BREAKER> | null;
|
|
19
19
|
defaultOptions: Partial<HttpClientFactoryOptions> | null;
|
|
20
20
|
defaultInterceptors: HttpClientInterceptor[] | null;
|
|
21
|
+
logPluginExtensions: ExtractDependencyType<typeof HTTP_CLIENT_LOGGER_EXTENSION> | null;
|
|
21
22
|
commandLineExecutionContext: ExtractDependencyType<typeof COMMAND_LINE_EXECUTION_CONTEXT_TOKEN> | null;
|
|
22
23
|
}) => ExtractTokenType<typeof HTTP_CLIENT_FACTORY>;
|
|
23
24
|
//# sourceMappingURL=httpClientFactory.d.ts.map
|
|
@@ -11,7 +11,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
11
11
|
: {
|
|
12
12
|
defaultTimeout: 30000,
|
|
13
13
|
};
|
|
14
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
|
|
14
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, logPluginExtensions, commandLineExecutionContext, }) => {
|
|
15
15
|
return (options) => {
|
|
16
16
|
if (!options.name) {
|
|
17
17
|
throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
|
|
@@ -33,6 +33,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
33
33
|
failureThreshold: 75,
|
|
34
34
|
minimumFailureCount: 10,
|
|
35
35
|
},
|
|
36
|
+
logPluginExtensions,
|
|
36
37
|
signal: commandLineExecutionContext?.()?.abortSignal,
|
|
37
38
|
...environmentDependentOptions,
|
|
38
39
|
}, defaultOptions ? mergeOptions(defaultOptions, interceptors) : interceptors), options);
|
|
@@ -20,7 +20,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
20
20
|
: {
|
|
21
21
|
defaultTimeout: 30000,
|
|
22
22
|
};
|
|
23
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
|
|
23
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, logPluginExtensions, commandLineExecutionContext, }) => {
|
|
24
24
|
return (options) => {
|
|
25
25
|
if (!options.name) {
|
|
26
26
|
throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
|
|
@@ -42,6 +42,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
42
42
|
failureThreshold: 75,
|
|
43
43
|
minimumFailureCount: 10,
|
|
44
44
|
},
|
|
45
|
+
logPluginExtensions,
|
|
45
46
|
signal: commandLineExecutionContext?.()?.abortSignal,
|
|
46
47
|
...environmentDependentOptions,
|
|
47
48
|
}, defaultOptions ? tinkoffRequestHttpClientAdapter.mergeOptions(defaultOptions, interceptors) : interceptors), options);
|
package/lib/shared.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createToken } from '@tinkoff/dippy';
|
|
2
2
|
import { provide, APP_INFO_TOKEN, Scope } from '@tramvai/core';
|
|
3
|
-
import { HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, DISABLE_CIRCUIT_BREAKER, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
3
|
+
import { HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, DISABLE_CIRCUIT_BREAKER, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, HTTP_CLIENT_LOGGER_EXTENSION, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
4
4
|
import { LOGGER_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, ENV_USED_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
|
|
5
5
|
import { httpClientFactory } from './httpClient/httpClientFactory.browser.js';
|
|
6
6
|
|
|
@@ -39,6 +39,10 @@ const providers = [
|
|
|
39
39
|
token: DEFAULT_HTTP_CLIENT_INTERCEPTORS,
|
|
40
40
|
optional: true,
|
|
41
41
|
},
|
|
42
|
+
logPluginExtensions: {
|
|
43
|
+
token: HTTP_CLIENT_LOGGER_EXTENSION,
|
|
44
|
+
optional: true,
|
|
45
|
+
},
|
|
42
46
|
commandLineExecutionContext: {
|
|
43
47
|
token: COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
|
|
44
48
|
optional: true,
|
package/lib/shared.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ export declare const providers: (import("@tinkoff/dippy/lib/Provider").ValueProv
|
|
|
65
65
|
};
|
|
66
66
|
optional: boolean;
|
|
67
67
|
};
|
|
68
|
+
logPluginExtensions: {
|
|
69
|
+
token: import("@tinkoff/request-plugin-log").LogExtension & {
|
|
70
|
+
__type?: "multi token" | undefined;
|
|
71
|
+
};
|
|
72
|
+
optional: boolean;
|
|
73
|
+
};
|
|
68
74
|
commandLineExecutionContext: {
|
|
69
75
|
token: (() => import("@tramvai/tokens-common").ExecutionContext | null) & {
|
|
70
76
|
__type?: "base token" | undefined;
|
|
@@ -140,6 +146,12 @@ export declare const providers: (import("@tinkoff/dippy/lib/Provider").ValueProv
|
|
|
140
146
|
};
|
|
141
147
|
optional: boolean;
|
|
142
148
|
};
|
|
149
|
+
logPluginExtensions: {
|
|
150
|
+
token: import("@tinkoff/request-plugin-log").LogExtension & {
|
|
151
|
+
__type?: "multi token" | undefined;
|
|
152
|
+
};
|
|
153
|
+
optional: boolean;
|
|
154
|
+
};
|
|
143
155
|
commandLineExecutionContext: {
|
|
144
156
|
token: (() => import("@tramvai/tokens-common").ExecutionContext | null) & {
|
|
145
157
|
__type?: "base token" | undefined;
|
package/lib/shared.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createToken } from '@tinkoff/dippy';
|
|
2
2
|
import { provide, APP_INFO_TOKEN, Scope } from '@tramvai/core';
|
|
3
|
-
import { HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, DISABLE_CIRCUIT_BREAKER, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
3
|
+
import { HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, DISABLE_CIRCUIT_BREAKER, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, HTTP_CLIENT_LOGGER_EXTENSION, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
4
4
|
import { LOGGER_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, ENV_USED_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
|
|
5
5
|
import { httpClientFactory } from './httpClient/httpClientFactory.es.js';
|
|
6
6
|
|
|
@@ -39,6 +39,10 @@ const providers = [
|
|
|
39
39
|
token: DEFAULT_HTTP_CLIENT_INTERCEPTORS,
|
|
40
40
|
optional: true,
|
|
41
41
|
},
|
|
42
|
+
logPluginExtensions: {
|
|
43
|
+
token: HTTP_CLIENT_LOGGER_EXTENSION,
|
|
44
|
+
optional: true,
|
|
45
|
+
},
|
|
42
46
|
commandLineExecutionContext: {
|
|
43
47
|
token: COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
|
|
44
48
|
optional: true,
|
package/lib/shared.js
CHANGED
|
@@ -43,6 +43,10 @@ const providers = [
|
|
|
43
43
|
token: tokensHttpClient.DEFAULT_HTTP_CLIENT_INTERCEPTORS,
|
|
44
44
|
optional: true,
|
|
45
45
|
},
|
|
46
|
+
logPluginExtensions: {
|
|
47
|
+
token: tokensHttpClient.HTTP_CLIENT_LOGGER_EXTENSION,
|
|
48
|
+
optional: true,
|
|
49
|
+
},
|
|
46
50
|
commandLineExecutionContext: {
|
|
47
51
|
token: tokensCommon.COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
|
|
48
52
|
optional: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-http-client",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0",
|
|
4
4
|
"initialVersion": "0.58.99",
|
|
5
5
|
"description": "",
|
|
6
6
|
"engines": {
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@jest/globals": "^29.7.0",
|
|
32
|
-
"@tramvai/child-app-core": "7.
|
|
32
|
+
"@tramvai/child-app-core": "7.28.0",
|
|
33
33
|
"@tramvai/http-client": "0.7.1",
|
|
34
|
-
"@tramvai/tinkoff-request-http-client-adapter": "0.14.
|
|
35
|
-
"@tramvai/tokens-child-app": "7.
|
|
36
|
-
"@tramvai/tokens-common": "7.
|
|
37
|
-
"@tramvai/tokens-http-client": "7.
|
|
38
|
-
"@tramvai/tokens-server": "7.
|
|
39
|
-
"@tramvai/tokens-server-private": "7.
|
|
34
|
+
"@tramvai/tinkoff-request-http-client-adapter": "0.14.119",
|
|
35
|
+
"@tramvai/tokens-child-app": "7.28.0",
|
|
36
|
+
"@tramvai/tokens-common": "7.28.0",
|
|
37
|
+
"@tramvai/tokens-http-client": "7.28.0",
|
|
38
|
+
"@tramvai/tokens-server": "7.28.0",
|
|
39
|
+
"@tramvai/tokens-server-private": "7.28.0",
|
|
40
40
|
"jest": "^29.7.0",
|
|
41
41
|
"undici": "^7.24.4"
|
|
42
42
|
},
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@tinkoff/dippy": "^1.0.0",
|
|
50
50
|
"@tinkoff/utils": "^2.1.2",
|
|
51
|
-
"@tramvai/core": "7.
|
|
52
|
-
"@tramvai/module-common": "7.
|
|
53
|
-
"@tramvai/papi": "7.
|
|
54
|
-
"@tramvai/test-helpers": "7.
|
|
55
|
-
"@tramvai/test-mocks": "7.
|
|
56
|
-
"@tramvai/test-unit": "7.
|
|
51
|
+
"@tramvai/core": "7.28.0",
|
|
52
|
+
"@tramvai/module-common": "7.28.0",
|
|
53
|
+
"@tramvai/papi": "7.28.0",
|
|
54
|
+
"@tramvai/test-helpers": "7.28.0",
|
|
55
|
+
"@tramvai/test-mocks": "7.28.0",
|
|
56
|
+
"@tramvai/test-unit": "7.28.0",
|
|
57
57
|
"tslib": "^2.4.0"
|
|
58
58
|
},
|
|
59
59
|
"license": "Apache-2.0",
|
package/tests.js
CHANGED
|
@@ -166,7 +166,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
166
166
|
: {
|
|
167
167
|
defaultTimeout: 30000,
|
|
168
168
|
};
|
|
169
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
|
|
169
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, logPluginExtensions, commandLineExecutionContext, }) => {
|
|
170
170
|
return (options) => {
|
|
171
171
|
if (!options.name) {
|
|
172
172
|
throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
|
|
@@ -188,6 +188,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
188
188
|
failureThreshold: 75,
|
|
189
189
|
minimumFailureCount: 10,
|
|
190
190
|
},
|
|
191
|
+
logPluginExtensions,
|
|
191
192
|
signal: commandLineExecutionContext?.()?.abortSignal,
|
|
192
193
|
...environmentDependentOptions,
|
|
193
194
|
}, defaultOptions ? tinkoffRequestHttpClientAdapter.mergeOptions(defaultOptions, interceptors) : interceptors), options);
|
|
@@ -263,6 +264,10 @@ const providers = [
|
|
|
263
264
|
token: tokensHttpClient.DEFAULT_HTTP_CLIENT_INTERCEPTORS,
|
|
264
265
|
optional: true,
|
|
265
266
|
},
|
|
267
|
+
logPluginExtensions: {
|
|
268
|
+
token: tokensHttpClient.HTTP_CLIENT_LOGGER_EXTENSION,
|
|
269
|
+
optional: true,
|
|
270
|
+
},
|
|
266
271
|
commandLineExecutionContext: {
|
|
267
272
|
token: tokensCommon.COMMAND_LINE_EXECUTION_CONTEXT_TOKEN,
|
|
268
273
|
optional: true,
|