@tramvai/tinkoff-request-http-client-adapter 0.8.93 → 0.8.97
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/index.js +14 -14
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -37,8 +37,8 @@ const createAgent = (options = {
|
|
|
37
37
|
maxFreeSockets: 10,
|
|
38
38
|
}) => {
|
|
39
39
|
return {
|
|
40
|
-
http: new http__default[
|
|
41
|
-
https: new https__default[
|
|
40
|
+
http: new http__default["default"].Agent(options),
|
|
41
|
+
https: new https__default["default"].Agent(options),
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -57,7 +57,7 @@ function createTinkoffRequest(options) {
|
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
|
-
plugins.push(transformUrl__default[
|
|
60
|
+
plugins.push(transformUrl__default["default"]({
|
|
61
61
|
baseUrl: defaults.baseUrl,
|
|
62
62
|
transform: ({ baseUrl, path, url }) => {
|
|
63
63
|
// если пользователь передал `url`, не модифицируем его, ожидается что это абсолютный URI
|
|
@@ -87,22 +87,22 @@ function createTinkoffRequest(options) {
|
|
|
87
87
|
return baseUrl || path || '';
|
|
88
88
|
},
|
|
89
89
|
}));
|
|
90
|
-
plugins.push(logPlugin__default[
|
|
90
|
+
plugins.push(logPlugin__default["default"]({
|
|
91
91
|
logger,
|
|
92
92
|
name,
|
|
93
93
|
showQueryFields: true,
|
|
94
94
|
showPayloadFields: true,
|
|
95
95
|
}));
|
|
96
|
-
plugins.push(memoryCache__default[
|
|
96
|
+
plugins.push(memoryCache__default["default"]({
|
|
97
97
|
shouldExecute: !disableCache,
|
|
98
98
|
lruOptions: { max: 1000, maxAge: cacheTime },
|
|
99
99
|
allowStale: true,
|
|
100
100
|
memoryConstructor: createCache,
|
|
101
101
|
}));
|
|
102
|
-
plugins.push(deduplicateCache__default[
|
|
102
|
+
plugins.push(deduplicateCache__default["default"]());
|
|
103
103
|
if (enableCircuitBreaker) {
|
|
104
|
-
plugins.push(circuitBreaker__default[
|
|
105
|
-
isSystemError: either__default[
|
|
104
|
+
plugins.push(circuitBreaker__default["default"]({
|
|
105
|
+
isSystemError: either__default["default"](http$1.isServerError, http$1.isNetworkFail),
|
|
106
106
|
...circuitBreakerOptions,
|
|
107
107
|
}));
|
|
108
108
|
}
|
|
@@ -119,14 +119,14 @@ function createTinkoffRequest(options) {
|
|
|
119
119
|
},
|
|
120
120
|
});
|
|
121
121
|
if (validator || errorValidator) {
|
|
122
|
-
plugins.push(validate__default[
|
|
122
|
+
plugins.push(validate__default["default"]({
|
|
123
123
|
validator,
|
|
124
124
|
errorValidator,
|
|
125
125
|
allowFallback: true,
|
|
126
126
|
}));
|
|
127
127
|
}
|
|
128
|
-
plugins.push(http__default$1[
|
|
129
|
-
const makeRequest = request__default[
|
|
128
|
+
plugins.push(http__default$1["default"]({ agent }));
|
|
129
|
+
const makeRequest = request__default["default"](plugins);
|
|
130
130
|
return makeRequest;
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -157,19 +157,19 @@ function mergeOptions(options, nextOptions, config) {
|
|
|
157
157
|
if (nextOptions.modifyRequest || options.modifyRequest) {
|
|
158
158
|
result.modifyRequest =
|
|
159
159
|
options.modifyRequest && nextOptions.modifyRequest
|
|
160
|
-
? compose__default[
|
|
160
|
+
? compose__default["default"](nextOptions.modifyRequest, options.modifyRequest)
|
|
161
161
|
: nextOptions.modifyRequest || options.modifyRequest;
|
|
162
162
|
}
|
|
163
163
|
if (nextOptions.modifyResponse || options.modifyResponse) {
|
|
164
164
|
result.modifyResponse =
|
|
165
165
|
options.modifyResponse && nextOptions.modifyResponse
|
|
166
|
-
? compose__default[
|
|
166
|
+
? compose__default["default"](nextOptions.modifyResponse, options.modifyResponse)
|
|
167
167
|
: nextOptions.modifyResponse || options.modifyResponse;
|
|
168
168
|
}
|
|
169
169
|
if (nextOptions.modifyError || options.modifyError) {
|
|
170
170
|
result.modifyError =
|
|
171
171
|
options.modifyError && nextOptions.modifyError
|
|
172
|
-
? compose__default[
|
|
172
|
+
? compose__default["default"](nextOptions.modifyError, options.modifyError)
|
|
173
173
|
: nextOptions.modifyError || options.modifyError;
|
|
174
174
|
}
|
|
175
175
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tinkoff-request-http-client-adapter",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.97",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@tinkoff/request-plugin-validate": "^0.8.8",
|
|
32
32
|
"@tinkoff/utils": "^2.1.2",
|
|
33
33
|
"@tramvai/http-client": "0.1.21",
|
|
34
|
-
"@tramvai/tokens-common": "1.
|
|
34
|
+
"@tramvai/tokens-common": "1.9.2",
|
|
35
35
|
"tslib": "^2.0.3"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|