@tramvai/tinkoff-request-http-client-adapter 0.11.143 → 0.11.146

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,6 +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
+ ? (cacheOptions) => createCache({ name: `http-client-${name}`, ...cacheOptions })
20
+ : undefined;
18
21
  const plugins = [];
19
22
  plugins.push({
20
23
  init: (context, next) => {
@@ -67,7 +70,7 @@ function createTinkoffRequest(options) {
67
70
  lruOptions,
68
71
  allowStale,
69
72
  getCacheKey,
70
- memoryConstructor: createCache,
73
+ memoryConstructor: createNamedCache,
71
74
  }));
72
75
  plugins.push(deduplicateCache({
73
76
  shouldExecute: !disableCache,
@@ -106,7 +109,7 @@ function createTinkoffRequest(options) {
106
109
  plugins.push(etagCache({
107
110
  shouldExecute: !disableCache,
108
111
  getCacheKey,
109
- memoryConstructor: createCache,
112
+ memoryConstructor: createNamedCache,
110
113
  lruOptions: (etagCacheOptions === null || etagCacheOptions === void 0 ? void 0 : etagCacheOptions.lruOptions) || { max: 1000, ttl: 10 * 60 * 1000 },
111
114
  }));
112
115
  }
@@ -15,6 +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
+ ? (cacheOptions) => createCache({ name: `http-client-${name}`, ...cacheOptions })
20
+ : undefined;
18
21
  const plugins = [];
19
22
  plugins.push({
20
23
  init: (context, next) => {
@@ -67,7 +70,7 @@ function createTinkoffRequest(options) {
67
70
  lruOptions,
68
71
  allowStale,
69
72
  getCacheKey,
70
- memoryConstructor: createCache,
73
+ memoryConstructor: createNamedCache,
71
74
  }));
72
75
  plugins.push(deduplicateCache({
73
76
  shouldExecute: !disableCache,
@@ -106,7 +109,7 @@ function createTinkoffRequest(options) {
106
109
  plugins.push(etagCache({
107
110
  shouldExecute: !disableCache,
108
111
  getCacheKey,
109
- memoryConstructor: createCache,
112
+ memoryConstructor: createNamedCache,
110
113
  lruOptions: (etagCacheOptions === null || etagCacheOptions === void 0 ? void 0 : etagCacheOptions.lruOptions) || { max: 1000, ttl: 10 * 60 * 1000 },
111
114
  }));
112
115
  }
@@ -33,6 +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
+ ? (cacheOptions) => createCache({ name: `http-client-${name}`, ...cacheOptions })
38
+ : undefined;
36
39
  const plugins = [];
37
40
  plugins.push({
38
41
  init: (context, next) => {
@@ -85,7 +88,7 @@ function createTinkoffRequest(options) {
85
88
  lruOptions,
86
89
  allowStale,
87
90
  getCacheKey,
88
- memoryConstructor: createCache,
91
+ memoryConstructor: createNamedCache,
89
92
  }));
90
93
  plugins.push(deduplicateCache__default["default"]({
91
94
  shouldExecute: !disableCache,
@@ -124,7 +127,7 @@ function createTinkoffRequest(options) {
124
127
  plugins.push(etagCache__default["default"]({
125
128
  shouldExecute: !disableCache,
126
129
  getCacheKey,
127
- memoryConstructor: createCache,
130
+ memoryConstructor: createNamedCache,
128
131
  lruOptions: (etagCacheOptions === null || etagCacheOptions === void 0 ? void 0 : etagCacheOptions.lruOptions) || { max: 1000, ttl: 10 * 60 * 1000 },
129
132
  }));
130
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tinkoff-request-http-client-adapter",
3
- "version": "0.11.143",
3
+ "version": "0.11.146",
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.1",
35
- "@tramvai/tokens-common": "4.41.8",
35
+ "@tramvai/tokens-common": "4.41.11",
36
36
  "tslib": "^2.4.0"
37
37
  },
38
38
  "sideEffects": false,