@tramvai/module-http-client 1.41.2 → 1.44.4
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.d.ts +3 -2
- package/lib/index.browser.js +7 -2
- package/lib/index.es.js +7 -2
- package/lib/index.js +6 -1
- package/package.json +10 -10
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MakeRequest } from '@tinkoff/request-core';
|
|
2
2
|
import type { APP_INFO_TOKEN } from '@tramvai/core';
|
|
3
|
-
import type { API_CLIENT_PASS_HEADERS, HTTP_CLIENT_FACTORY } from '@tramvai/tokens-http-client';
|
|
3
|
+
import type { API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, HTTP_CLIENT_FACTORY } from '@tramvai/tokens-http-client';
|
|
4
4
|
import type { LOGGER_TOKEN, CREATE_CACHE_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN } from '@tramvai/tokens-common';
|
|
5
|
-
export declare const httpClientFactory: ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, }: {
|
|
5
|
+
export declare const httpClientFactory: ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, agent, }: {
|
|
6
6
|
logger: typeof LOGGER_TOKEN;
|
|
7
7
|
envManager: typeof ENV_MANAGER_TOKEN;
|
|
8
8
|
appInfo: typeof APP_INFO_TOKEN;
|
|
@@ -10,4 +10,5 @@ export declare const httpClientFactory: ({ logger, envManager, appInfo, requestM
|
|
|
10
10
|
headersList?: typeof API_CLIENT_PASS_HEADERS;
|
|
11
11
|
createCache?: typeof CREATE_CACHE_TOKEN;
|
|
12
12
|
tinkoffRequestRegistry: Map<string, MakeRequest>;
|
|
13
|
+
agent?: typeof HTTP_CLIENT_AGENT;
|
|
13
14
|
}) => typeof HTTP_CLIENT_FACTORY;
|
package/lib/index.browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { createToken } from '@tinkoff/dippy';
|
|
3
3
|
import { Module, provide, Scope, APP_INFO_TOKEN } from '@tramvai/core';
|
|
4
|
-
import { PAPI_SERVICE, HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
4
|
+
import { PAPI_SERVICE, HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
5
5
|
import { LOGGER_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, ENV_USED_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
|
|
6
6
|
import isNil from '@tinkoff/utils/is/nil';
|
|
7
7
|
import omit from '@tinkoff/utils/object/omit';
|
|
@@ -55,7 +55,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
55
55
|
: {
|
|
56
56
|
defaultTimeout: 30000,
|
|
57
57
|
};
|
|
58
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, }) => {
|
|
58
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, agent, }) => {
|
|
59
59
|
return (options) => {
|
|
60
60
|
if (!options.name) {
|
|
61
61
|
throw Error(`Необходимо передать уникальное поле "name" для экземпляра HTTP клиента!`);
|
|
@@ -64,6 +64,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
64
64
|
const forceDisabledCircuitBreaker = envManager.get('HTTP_CLIENT_CIRCUIT_BREAKER_DISABLED');
|
|
65
65
|
const adapterOptions = mergeOptions({
|
|
66
66
|
logger,
|
|
67
|
+
agent,
|
|
67
68
|
method: 'GET',
|
|
68
69
|
createCache: createCache
|
|
69
70
|
? (cacheOptions) => createCache('memory', cacheOptions)
|
|
@@ -189,6 +190,10 @@ HttpClientModule = __decorate([
|
|
|
189
190
|
token: API_CLIENT_PASS_HEADERS,
|
|
190
191
|
optional: true,
|
|
191
192
|
},
|
|
193
|
+
agent: {
|
|
194
|
+
token: HTTP_CLIENT_AGENT,
|
|
195
|
+
optional: true,
|
|
196
|
+
},
|
|
192
197
|
},
|
|
193
198
|
}),
|
|
194
199
|
provide({
|
package/lib/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { createChildContainer, createToken } from '@tinkoff/dippy';
|
|
3
3
|
import { Module, provide, Scope, DI_TOKEN, APP_INFO_TOKEN } from '@tramvai/core';
|
|
4
|
-
import { PAPI_SERVICE, HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
4
|
+
import { PAPI_SERVICE, HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, HTTP_CLIENT } from '@tramvai/tokens-http-client';
|
|
5
5
|
import { LOGGER_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, ENV_USED_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
|
|
6
6
|
import isNil from '@tinkoff/utils/is/nil';
|
|
7
7
|
import omit from '@tinkoff/utils/object/omit';
|
|
@@ -84,7 +84,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
84
84
|
: {
|
|
85
85
|
defaultTimeout: 30000,
|
|
86
86
|
};
|
|
87
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, }) => {
|
|
87
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, agent, }) => {
|
|
88
88
|
return (options) => {
|
|
89
89
|
if (!options.name) {
|
|
90
90
|
throw Error(`Необходимо передать уникальное поле "name" для экземпляра HTTP клиента!`);
|
|
@@ -93,6 +93,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
93
93
|
const forceDisabledCircuitBreaker = envManager.get('HTTP_CLIENT_CIRCUIT_BREAKER_DISABLED');
|
|
94
94
|
const adapterOptions = mergeOptions({
|
|
95
95
|
logger,
|
|
96
|
+
agent,
|
|
96
97
|
method: 'GET',
|
|
97
98
|
createCache: createCache
|
|
98
99
|
? (cacheOptions) => createCache('memory', cacheOptions)
|
|
@@ -268,6 +269,10 @@ HttpClientModule = __decorate([
|
|
|
268
269
|
token: API_CLIENT_PASS_HEADERS,
|
|
269
270
|
optional: true,
|
|
270
271
|
},
|
|
272
|
+
agent: {
|
|
273
|
+
token: HTTP_CLIENT_AGENT,
|
|
274
|
+
optional: true,
|
|
275
|
+
},
|
|
271
276
|
},
|
|
272
277
|
}),
|
|
273
278
|
provide({
|
package/lib/index.js
CHANGED
|
@@ -98,7 +98,7 @@ const environmentDependentOptions = typeof window === 'undefined'
|
|
|
98
98
|
: {
|
|
99
99
|
defaultTimeout: 30000,
|
|
100
100
|
};
|
|
101
|
-
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, }) => {
|
|
101
|
+
const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, tinkoffRequestRegistry, agent, }) => {
|
|
102
102
|
return (options) => {
|
|
103
103
|
if (!options.name) {
|
|
104
104
|
throw Error(`Необходимо передать уникальное поле "name" для экземпляра HTTP клиента!`);
|
|
@@ -107,6 +107,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
|
|
|
107
107
|
const forceDisabledCircuitBreaker = envManager.get('HTTP_CLIENT_CIRCUIT_BREAKER_DISABLED');
|
|
108
108
|
const adapterOptions = tinkoffRequestHttpClientAdapter.mergeOptions({
|
|
109
109
|
logger,
|
|
110
|
+
agent,
|
|
110
111
|
method: 'GET',
|
|
111
112
|
createCache: createCache
|
|
112
113
|
? (cacheOptions) => createCache('memory', cacheOptions)
|
|
@@ -282,6 +283,10 @@ exports.HttpClientModule = tslib.__decorate([
|
|
|
282
283
|
token: tokensHttpClient.API_CLIENT_PASS_HEADERS,
|
|
283
284
|
optional: true,
|
|
284
285
|
},
|
|
286
|
+
agent: {
|
|
287
|
+
token: tokensHttpClient.HTTP_CLIENT_AGENT,
|
|
288
|
+
optional: true,
|
|
289
|
+
},
|
|
285
290
|
},
|
|
286
291
|
}),
|
|
287
292
|
core.provide({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-http-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.4",
|
|
4
4
|
"initialVersion": "0.58.99",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@tramvai/http-client": "0.1.23",
|
|
28
|
-
"@tramvai/tinkoff-request-http-client-adapter": "0.8.
|
|
29
|
-
"@tramvai/tokens-http-client": "1.
|
|
30
|
-
"@tramvai/tokens-common": "1.
|
|
31
|
-
"@tramvai/tokens-server": "1.
|
|
28
|
+
"@tramvai/tinkoff-request-http-client-adapter": "0.8.197",
|
|
29
|
+
"@tramvai/tokens-http-client": "1.44.4",
|
|
30
|
+
"@tramvai/tokens-common": "1.44.4",
|
|
31
|
+
"@tramvai/tokens-server": "1.44.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@tinkoff/request-core": "^0.8.9"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@tinkoff/utils": "^2.1.2",
|
|
38
|
-
"@tramvai/core": "1.
|
|
39
|
-
"@tramvai/module-common": "1.
|
|
40
|
-
"@tramvai/papi": "1.
|
|
41
|
-
"@tramvai/test-helpers": "1.
|
|
42
|
-
"@tramvai/test-mocks": "1.
|
|
38
|
+
"@tramvai/core": "1.44.4",
|
|
39
|
+
"@tramvai/module-common": "1.44.4",
|
|
40
|
+
"@tramvai/papi": "1.44.4",
|
|
41
|
+
"@tramvai/test-helpers": "1.44.4",
|
|
42
|
+
"@tramvai/test-mocks": "1.44.4",
|
|
43
43
|
"@tinkoff/dippy": "0.7.35",
|
|
44
44
|
"node-fetch": "^2.6.1",
|
|
45
45
|
"tslib": "^2.0.3"
|