@tramvai/tinkoff-request-http-client-adapter 0.11.167 → 0.11.172
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.
|
@@ -15,8 +15,9 @@ const defaultAgent = createAgent();
|
|
|
15
15
|
function createTinkoffRequest(options) {
|
|
16
16
|
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
17
|
const log = logger && logger(`${name}:initialization`);
|
|
18
|
-
const createNamedCache = typeof createCache === 'function'
|
|
19
|
-
?
|
|
18
|
+
const createNamedCache = (type) => typeof createCache === 'function'
|
|
19
|
+
? // when memory and etag caches are used simultaneously, the cache name must be different
|
|
20
|
+
(cacheOptions) => createCache({ name: `http-client${type ? `-${type}` : ''}-${name}`, ...cacheOptions })
|
|
20
21
|
: undefined;
|
|
21
22
|
const plugins = [];
|
|
22
23
|
plugins.push({
|
|
@@ -70,7 +71,7 @@ function createTinkoffRequest(options) {
|
|
|
70
71
|
lruOptions,
|
|
71
72
|
allowStale,
|
|
72
73
|
getCacheKey,
|
|
73
|
-
memoryConstructor: createNamedCache,
|
|
74
|
+
memoryConstructor: createNamedCache(),
|
|
74
75
|
}));
|
|
75
76
|
plugins.push(deduplicateCache({
|
|
76
77
|
shouldExecute: !disableCache,
|
|
@@ -109,7 +110,7 @@ function createTinkoffRequest(options) {
|
|
|
109
110
|
plugins.push(etagCache({
|
|
110
111
|
shouldExecute: !disableCache,
|
|
111
112
|
getCacheKey,
|
|
112
|
-
memoryConstructor: createNamedCache,
|
|
113
|
+
memoryConstructor: createNamedCache('etag'),
|
|
113
114
|
lruOptions: (etagCacheOptions === null || etagCacheOptions === void 0 ? void 0 : etagCacheOptions.lruOptions) || { max: 1000, ttl: 10 * 60 * 1000 },
|
|
114
115
|
}));
|
|
115
116
|
}
|
|
@@ -15,8 +15,9 @@ const defaultAgent = createAgent();
|
|
|
15
15
|
function createTinkoffRequest(options) {
|
|
16
16
|
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
17
|
const log = logger && logger(`${name}:initialization`);
|
|
18
|
-
const createNamedCache = typeof createCache === 'function'
|
|
19
|
-
?
|
|
18
|
+
const createNamedCache = (type) => typeof createCache === 'function'
|
|
19
|
+
? // when memory and etag caches are used simultaneously, the cache name must be different
|
|
20
|
+
(cacheOptions) => createCache({ name: `http-client${type ? `-${type}` : ''}-${name}`, ...cacheOptions })
|
|
20
21
|
: undefined;
|
|
21
22
|
const plugins = [];
|
|
22
23
|
plugins.push({
|
|
@@ -70,7 +71,7 @@ function createTinkoffRequest(options) {
|
|
|
70
71
|
lruOptions,
|
|
71
72
|
allowStale,
|
|
72
73
|
getCacheKey,
|
|
73
|
-
memoryConstructor: createNamedCache,
|
|
74
|
+
memoryConstructor: createNamedCache(),
|
|
74
75
|
}));
|
|
75
76
|
plugins.push(deduplicateCache({
|
|
76
77
|
shouldExecute: !disableCache,
|
|
@@ -109,7 +110,7 @@ function createTinkoffRequest(options) {
|
|
|
109
110
|
plugins.push(etagCache({
|
|
110
111
|
shouldExecute: !disableCache,
|
|
111
112
|
getCacheKey,
|
|
112
|
-
memoryConstructor: createNamedCache,
|
|
113
|
+
memoryConstructor: createNamedCache('etag'),
|
|
113
114
|
lruOptions: (etagCacheOptions === null || etagCacheOptions === void 0 ? void 0 : etagCacheOptions.lruOptions) || { max: 1000, ttl: 10 * 60 * 1000 },
|
|
114
115
|
}));
|
|
115
116
|
}
|
|
@@ -33,8 +33,9 @@ const defaultAgent = createAgent.createAgent();
|
|
|
33
33
|
function createTinkoffRequest(options) {
|
|
34
34
|
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
35
|
const log = logger && logger(`${name}:initialization`);
|
|
36
|
-
const createNamedCache = typeof createCache === 'function'
|
|
37
|
-
?
|
|
36
|
+
const createNamedCache = (type) => typeof createCache === 'function'
|
|
37
|
+
? // when memory and etag caches are used simultaneously, the cache name must be different
|
|
38
|
+
(cacheOptions) => createCache({ name: `http-client${type ? `-${type}` : ''}-${name}`, ...cacheOptions })
|
|
38
39
|
: undefined;
|
|
39
40
|
const plugins = [];
|
|
40
41
|
plugins.push({
|
|
@@ -88,7 +89,7 @@ function createTinkoffRequest(options) {
|
|
|
88
89
|
lruOptions,
|
|
89
90
|
allowStale,
|
|
90
91
|
getCacheKey,
|
|
91
|
-
memoryConstructor: createNamedCache,
|
|
92
|
+
memoryConstructor: createNamedCache(),
|
|
92
93
|
}));
|
|
93
94
|
plugins.push(deduplicateCache__default["default"]({
|
|
94
95
|
shouldExecute: !disableCache,
|
|
@@ -127,7 +128,7 @@ function createTinkoffRequest(options) {
|
|
|
127
128
|
plugins.push(etagCache__default["default"]({
|
|
128
129
|
shouldExecute: !disableCache,
|
|
129
130
|
getCacheKey,
|
|
130
|
-
memoryConstructor: createNamedCache,
|
|
131
|
+
memoryConstructor: createNamedCache('etag'),
|
|
131
132
|
lruOptions: (etagCacheOptions === null || etagCacheOptions === void 0 ? void 0 : etagCacheOptions.lruOptions) || { max: 1000, ttl: 10 * 60 * 1000 },
|
|
132
133
|
}));
|
|
133
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tinkoff-request-http-client-adapter",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.172",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@tinkoff/request-plugin-validate": "^0.10.0",
|
|
33
33
|
"@tinkoff/utils": "^2.1.2",
|
|
34
34
|
"@tramvai/http-client": "0.4.3",
|
|
35
|
-
"@tramvai/tokens-common": "4.41.
|
|
35
|
+
"@tramvai/tokens-common": "4.41.37",
|
|
36
36
|
"tslib": "^2.4.0"
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|