@tramvai/tinkoff-request-http-client-adapter 0.13.109 → 0.13.112
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/createTinkoffRequest.browser.js +1 -3
- package/lib/createTinkoffRequest.d.ts +1 -3
- package/lib/createTinkoffRequest.es.js +1 -3
- package/lib/createTinkoffRequest.js +1 -3
- package/package.json +10 -7
- package/lib/agent/createAgent.browser.browser.js +0 -3
- package/lib/agent/createAgent.browser.d.ts +0 -2
- package/lib/agent/createAgent.d.ts +0 -7
- package/lib/agent/createAgent.es.js +0 -14
- package/lib/agent/createAgent.js +0 -23
|
@@ -9,9 +9,7 @@ import http, { isServerError, isNetworkFail } from '@tinkoff/request-plugin-prot
|
|
|
9
9
|
import transformUrl from '@tinkoff/request-plugin-transform-url';
|
|
10
10
|
import circuitBreaker from '@tinkoff/request-plugin-circuit-breaker';
|
|
11
11
|
import retry from '@tinkoff/request-plugin-retry';
|
|
12
|
-
import { createAgent } from './agent/createAgent.browser.browser.js';
|
|
13
12
|
|
|
14
|
-
const defaultAgent = createAgent();
|
|
15
13
|
function createTinkoffRequest(options) {
|
|
16
14
|
const { logger, name, disableCache, enableCircuitBreaker, createCache, cacheTime = 30000, defaultTimeout, validator, errorValidator, errorModificator, circuitBreakerOptions = {}, getCacheKey, lruOptions = { max: 1000, maxAge: cacheTime }, allowStale = true, agent, querySerializer, retryOptions, etagCacheOptions, interceptors, ...defaults } = options;
|
|
17
15
|
const log = logger && logger(`${name}:initialization`);
|
|
@@ -115,7 +113,7 @@ function createTinkoffRequest(options) {
|
|
|
115
113
|
}));
|
|
116
114
|
}
|
|
117
115
|
plugins.push(http({
|
|
118
|
-
agent
|
|
116
|
+
agent,
|
|
119
117
|
querySerializer: querySerializer || undefined,
|
|
120
118
|
}));
|
|
121
119
|
const makeRequest = request(plugins);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Agent } from 'undici/types';
|
|
2
2
|
import type { ContextState, MakeRequest, Request } from '@tinkoff/request-core';
|
|
3
3
|
import type { QuerySerializer } from '@tinkoff/request-plugin-protocol-http';
|
|
4
4
|
import type { Options as CircuitBreakerOptions } from '@tinkoff/request-plugin-circuit-breaker';
|
|
5
5
|
import type { HttpClientBaseOptions } from '@tramvai/http-client';
|
|
6
6
|
import type { LOGGER_TOKEN } from '@tramvai/tokens-common';
|
|
7
|
-
import type { Agent } from './agent/createAgent';
|
|
8
|
-
export type { Agent };
|
|
9
7
|
export type RequestValidator = {
|
|
10
8
|
(state: ContextState): any;
|
|
11
9
|
};
|
|
@@ -9,9 +9,7 @@ import http, { isServerError, isNetworkFail } from '@tinkoff/request-plugin-prot
|
|
|
9
9
|
import transformUrl from '@tinkoff/request-plugin-transform-url';
|
|
10
10
|
import circuitBreaker from '@tinkoff/request-plugin-circuit-breaker';
|
|
11
11
|
import retry from '@tinkoff/request-plugin-retry';
|
|
12
|
-
import { createAgent } from './agent/createAgent.es.js';
|
|
13
12
|
|
|
14
|
-
const defaultAgent = createAgent();
|
|
15
13
|
function createTinkoffRequest(options) {
|
|
16
14
|
const { logger, name, disableCache, enableCircuitBreaker, createCache, cacheTime = 30000, defaultTimeout, validator, errorValidator, errorModificator, circuitBreakerOptions = {}, getCacheKey, lruOptions = { max: 1000, maxAge: cacheTime }, allowStale = true, agent, querySerializer, retryOptions, etagCacheOptions, interceptors, ...defaults } = options;
|
|
17
15
|
const log = logger && logger(`${name}:initialization`);
|
|
@@ -115,7 +113,7 @@ function createTinkoffRequest(options) {
|
|
|
115
113
|
}));
|
|
116
114
|
}
|
|
117
115
|
plugins.push(http({
|
|
118
|
-
agent
|
|
116
|
+
agent,
|
|
119
117
|
querySerializer: querySerializer || undefined,
|
|
120
118
|
}));
|
|
121
119
|
const makeRequest = request(plugins);
|
|
@@ -13,7 +13,6 @@ var http = require('@tinkoff/request-plugin-protocol-http');
|
|
|
13
13
|
var transformUrl = require('@tinkoff/request-plugin-transform-url');
|
|
14
14
|
var circuitBreaker = require('@tinkoff/request-plugin-circuit-breaker');
|
|
15
15
|
var retry = require('@tinkoff/request-plugin-retry');
|
|
16
|
-
var createAgent = require('./agent/createAgent.js');
|
|
17
16
|
|
|
18
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
18
|
|
|
@@ -29,7 +28,6 @@ var transformUrl__default = /*#__PURE__*/_interopDefaultLegacy(transformUrl);
|
|
|
29
28
|
var circuitBreaker__default = /*#__PURE__*/_interopDefaultLegacy(circuitBreaker);
|
|
30
29
|
var retry__default = /*#__PURE__*/_interopDefaultLegacy(retry);
|
|
31
30
|
|
|
32
|
-
const defaultAgent = createAgent.createAgent();
|
|
33
31
|
function createTinkoffRequest(options) {
|
|
34
32
|
const { logger, name, disableCache, enableCircuitBreaker, createCache, cacheTime = 30000, defaultTimeout, validator, errorValidator, errorModificator, circuitBreakerOptions = {}, getCacheKey, lruOptions = { max: 1000, maxAge: cacheTime }, allowStale = true, agent, querySerializer, retryOptions, etagCacheOptions, interceptors, ...defaults } = options;
|
|
35
33
|
const log = logger && logger(`${name}:initialization`);
|
|
@@ -133,7 +131,7 @@ function createTinkoffRequest(options) {
|
|
|
133
131
|
}));
|
|
134
132
|
}
|
|
135
133
|
plugins.push(http__default["default"]({
|
|
136
|
-
agent
|
|
134
|
+
agent,
|
|
137
135
|
querySerializer: querySerializer || undefined,
|
|
138
136
|
}));
|
|
139
137
|
const makeRequest = request__default["default"](plugins);
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tinkoff-request-http-client-adapter",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.112",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20.18.1"
|
|
8
|
+
},
|
|
6
9
|
"browser": {
|
|
7
|
-
"./lib/agent/createAgent.js": "./lib/agent/createAgent.browser.js",
|
|
8
10
|
"./lib/index.es.js": "./lib/index.browser.js"
|
|
9
11
|
},
|
|
10
12
|
"typings": "lib/index.d.ts",
|
|
@@ -22,18 +24,19 @@
|
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"@tinkoff/request-core": "^0.10.0",
|
|
24
26
|
"@tinkoff/request-plugin-cache-deduplicate": "^0.10.3",
|
|
25
|
-
"@tinkoff/request-plugin-cache-etag": "^0.
|
|
27
|
+
"@tinkoff/request-plugin-cache-etag": "^0.5.0",
|
|
26
28
|
"@tinkoff/request-plugin-cache-memory": "^0.10.2",
|
|
27
|
-
"@tinkoff/request-plugin-circuit-breaker": "^0.
|
|
29
|
+
"@tinkoff/request-plugin-circuit-breaker": "^0.5.0",
|
|
28
30
|
"@tinkoff/request-plugin-log": "^0.10.0",
|
|
29
|
-
"@tinkoff/request-plugin-protocol-http": "
|
|
31
|
+
"@tinkoff/request-plugin-protocol-http": "0.15.0",
|
|
30
32
|
"@tinkoff/request-plugin-retry": "^0.3.0",
|
|
31
33
|
"@tinkoff/request-plugin-transform-url": "^0.10.0",
|
|
32
34
|
"@tinkoff/request-plugin-validate": "^0.10.0",
|
|
33
35
|
"@tinkoff/utils": "^2.1.2",
|
|
34
36
|
"@tramvai/http-client": "0.6.0",
|
|
35
|
-
"@tramvai/tokens-common": "6.
|
|
36
|
-
"tslib": "^2.4.0"
|
|
37
|
+
"@tramvai/tokens-common": "6.66.1",
|
|
38
|
+
"tslib": "^2.4.0",
|
|
39
|
+
"undici": "^7.16.0"
|
|
37
40
|
},
|
|
38
41
|
"sideEffects": false,
|
|
39
42
|
"license": "Apache-2.0",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import http from 'http';
|
|
2
|
-
import https from 'https';
|
|
3
|
-
|
|
4
|
-
const createAgent = (options = {
|
|
5
|
-
keepAlive: true,
|
|
6
|
-
scheduling: 'lifo',
|
|
7
|
-
}) => {
|
|
8
|
-
return {
|
|
9
|
-
http: new http.Agent(options),
|
|
10
|
-
https: new https.Agent(options),
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { createAgent };
|
package/lib/agent/createAgent.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var http = require('http');
|
|
6
|
-
var https = require('https');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
11
|
-
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
12
|
-
|
|
13
|
-
const createAgent = (options = {
|
|
14
|
-
keepAlive: true,
|
|
15
|
-
scheduling: 'lifo',
|
|
16
|
-
}) => {
|
|
17
|
-
return {
|
|
18
|
-
http: new http__default["default"].Agent(options),
|
|
19
|
-
https: new https__default["default"].Agent(options),
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
exports.createAgent = createAgent;
|