@vtex/api 6.45.23 → 6.45.24
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/CHANGELOG.md
CHANGED
|
@@ -97,14 +97,15 @@ class HttpClient {
|
|
|
97
97
|
};
|
|
98
98
|
this.getConfig = (url, config = {}) => ({
|
|
99
99
|
cacheable: this.cacheableType,
|
|
100
|
-
memoizable:
|
|
100
|
+
memoizable: this.memoizable,
|
|
101
101
|
...config,
|
|
102
102
|
url,
|
|
103
103
|
});
|
|
104
|
-
const { baseURL, authToken, authType, memoryCache, diskCache, locale, name, metrics, product, serverTiming, recorder, userAgent, timeout = DEFAULT_TIMEOUT_MS, segmentToken, sessionToken, retries, concurrency, headers: defaultHeaders, host, params, operationId, tenant, binding, verbose, cancellation, exponentialTimeoutCoefficient, initialBackoffDelay, exponentialBackoffCoefficient, httpsAgent, tracer, logger, cacheableType = cache_1.CacheType.Memory, } = opts;
|
|
104
|
+
const { baseURL, authToken, authType, memoryCache, diskCache, memoizable = true, locale, name, metrics, product, serverTiming, recorder, userAgent, timeout = DEFAULT_TIMEOUT_MS, segmentToken, sessionToken, retries, concurrency, headers: defaultHeaders, host, params, operationId, tenant, binding, verbose, cancellation, exponentialTimeoutCoefficient, initialBackoffDelay, exponentialBackoffCoefficient, httpsAgent, tracer, logger, cacheableType = cache_1.CacheType.Memory, } = opts;
|
|
105
105
|
this.name = name || baseURL || 'unknown';
|
|
106
106
|
this.logger = logger;
|
|
107
107
|
this.cacheableType = cacheableType;
|
|
108
|
+
this.memoizable = memoizable;
|
|
108
109
|
const limit = concurrency && concurrency > 0 && p_limit_1.default(concurrency) || undefined;
|
|
109
110
|
const headers = {
|
|
110
111
|
...defaultHeaders,
|
|
@@ -74,6 +74,16 @@ export interface InstanceOptions {
|
|
|
74
74
|
timeout?: number;
|
|
75
75
|
memoryCache?: CacheLayer<string, Cached>;
|
|
76
76
|
diskCache?: CacheLayer<string, Cached>;
|
|
77
|
+
/**
|
|
78
|
+
* Enables memoization, ephemeral within each request, for all requests of this client.
|
|
79
|
+
* Useful for services that makes recursive requests, like graphql resolvers, which
|
|
80
|
+
* might fetch the same endpoint more than once.
|
|
81
|
+
* If that's not the case for your service, disabling it might improve the CPU and
|
|
82
|
+
* memory usage.
|
|
83
|
+
*
|
|
84
|
+
* Default value: true
|
|
85
|
+
*/
|
|
86
|
+
memoizable?: boolean;
|
|
77
87
|
baseURL?: string;
|
|
78
88
|
retries?: number;
|
|
79
89
|
exponentialTimeoutCoefficient?: number;
|