@tramvai/tokens-http-client 6.63.1 → 6.65.0

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.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import type { Agent, Dispatcher } from 'undici';
1
2
  import type { BaseHttpClient, HttpClient, HttpClientInterceptor } from '@tramvai/http-client';
2
- import type { TinkoffRequestOptions, Agent } from '@tramvai/tinkoff-request-http-client-adapter';
3
+ import type { TinkoffRequestOptions } from '@tramvai/tinkoff-request-http-client-adapter';
3
4
  export type HttpClientFactoryOptions = TinkoffRequestOptions & {
4
5
  name: string;
5
6
  };
@@ -33,8 +34,9 @@ export declare const HTTP_CLIENT: HttpClient & {
33
34
  };
34
35
  /**
35
36
  * @description
36
- * Global HTTP and HTTPS agents for all clients
37
- * https://nodejs.org/dist/latest-v16.x/docs/api/http.html#class-httpagent
37
+ * Global HTTP and HTTPS agents for all fetch requests
38
+ * @see https://undici.nodejs.org/#/docs/api/Dispatcher.md
39
+ * @see https://undici.nodejs.org/#/docs/api/Agent.md
38
40
  */
39
41
  export declare const HTTP_CLIENT_AGENT: {
40
42
  http: Agent;
@@ -42,6 +44,22 @@ export declare const HTTP_CLIENT_AGENT: {
42
44
  } & {
43
45
  __type?: "base token" | undefined;
44
46
  };
47
+ /**
48
+ * @description
49
+ * Global agent options
50
+ * @see https://undici.nodejs.org/#/docs/api/Agent?id=parameter-agentoptions
51
+ */
52
+ export declare const HTTP_CLIENT_AGENT_OPTIONS: Agent.Options & {
53
+ __type?: "base token" | undefined;
54
+ };
55
+ /**
56
+ * @description
57
+ * Interceptors for global agent
58
+ * @see https://undici.nodejs.org/#/docs/api/Dispatcher?id=dispatchercomposeinterceptors-interceptor
59
+ */
60
+ export declare const HTTP_CLIENT_AGENT_INTERCEPTORS: Dispatcher.DispatcherComposeInterceptor & {
61
+ __type?: "multi token" | undefined;
62
+ };
45
63
  /**
46
64
  * @description
47
65
  * List of HTTP headers that are proxied from app request to all of the backend API
package/lib/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createToken } from '@tinkoff/dippy';
1
+ import { createToken, Scope } from '@tinkoff/dippy';
2
2
 
3
3
  /**
4
4
  * @description
@@ -22,10 +22,28 @@ const DEFAULT_HTTP_CLIENT_INTERCEPTORS = createToken('DEFAULT_HTTP_CLIENT_INTERC
22
22
  const HTTP_CLIENT = createToken('HTTP_CLIENT');
23
23
  /**
24
24
  * @description
25
- * Global HTTP and HTTPS agents for all clients
26
- * https://nodejs.org/dist/latest-v16.x/docs/api/http.html#class-httpagent
25
+ * Global HTTP and HTTPS agents for all fetch requests
26
+ * @see https://undici.nodejs.org/#/docs/api/Dispatcher.md
27
+ * @see https://undici.nodejs.org/#/docs/api/Agent.md
27
28
  */
28
- const HTTP_CLIENT_AGENT = createToken('HTTP_CLIENT_AGENT');
29
+ const HTTP_CLIENT_AGENT = createToken('HTTP_CLIENT_AGENT', { scope: Scope.SINGLETON });
30
+ /**
31
+ * @description
32
+ * Global agent options
33
+ * @see https://undici.nodejs.org/#/docs/api/Agent?id=parameter-agentoptions
34
+ */
35
+ const HTTP_CLIENT_AGENT_OPTIONS = createToken('HTTP_CLIENT_AGENT_OPTIONS', {
36
+ scope: Scope.SINGLETON,
37
+ });
38
+ /**
39
+ * @description
40
+ * Interceptors for global agent
41
+ * @see https://undici.nodejs.org/#/docs/api/Dispatcher?id=dispatchercomposeinterceptors-interceptor
42
+ */
43
+ const HTTP_CLIENT_AGENT_INTERCEPTORS = createToken('HTTP_CLIENT_AGENT_INTERCEPTORS', {
44
+ multi: true,
45
+ scope: Scope.SINGLETON,
46
+ });
29
47
  /**
30
48
  * @description
31
49
  * List of HTTP headers that are proxied from app request to all of the backend API
@@ -45,4 +63,4 @@ const PAPI_SERVICE = createToken('papi service');
45
63
  */
46
64
  const DISABLE_CIRCUIT_BREAKER = createToken('disable circuit breaker');
47
65
 
48
- export { API_CLIENT_PASS_HEADERS, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, DISABLE_CIRCUIT_BREAKER, HTTP_CLIENT, HTTP_CLIENT_AGENT, HTTP_CLIENT_FACTORY, PAPI_SERVICE };
66
+ export { API_CLIENT_PASS_HEADERS, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, DISABLE_CIRCUIT_BREAKER, HTTP_CLIENT, HTTP_CLIENT_AGENT, HTTP_CLIENT_AGENT_INTERCEPTORS, HTTP_CLIENT_AGENT_OPTIONS, HTTP_CLIENT_FACTORY, PAPI_SERVICE };
package/lib/index.js CHANGED
@@ -26,10 +26,28 @@ const DEFAULT_HTTP_CLIENT_INTERCEPTORS = dippy.createToken('DEFAULT_HTTP_CLIENT_
26
26
  const HTTP_CLIENT = dippy.createToken('HTTP_CLIENT');
27
27
  /**
28
28
  * @description
29
- * Global HTTP and HTTPS agents for all clients
30
- * https://nodejs.org/dist/latest-v16.x/docs/api/http.html#class-httpagent
29
+ * Global HTTP and HTTPS agents for all fetch requests
30
+ * @see https://undici.nodejs.org/#/docs/api/Dispatcher.md
31
+ * @see https://undici.nodejs.org/#/docs/api/Agent.md
31
32
  */
32
- const HTTP_CLIENT_AGENT = dippy.createToken('HTTP_CLIENT_AGENT');
33
+ const HTTP_CLIENT_AGENT = dippy.createToken('HTTP_CLIENT_AGENT', { scope: dippy.Scope.SINGLETON });
34
+ /**
35
+ * @description
36
+ * Global agent options
37
+ * @see https://undici.nodejs.org/#/docs/api/Agent?id=parameter-agentoptions
38
+ */
39
+ const HTTP_CLIENT_AGENT_OPTIONS = dippy.createToken('HTTP_CLIENT_AGENT_OPTIONS', {
40
+ scope: dippy.Scope.SINGLETON,
41
+ });
42
+ /**
43
+ * @description
44
+ * Interceptors for global agent
45
+ * @see https://undici.nodejs.org/#/docs/api/Dispatcher?id=dispatchercomposeinterceptors-interceptor
46
+ */
47
+ const HTTP_CLIENT_AGENT_INTERCEPTORS = dippy.createToken('HTTP_CLIENT_AGENT_INTERCEPTORS', {
48
+ multi: true,
49
+ scope: dippy.Scope.SINGLETON,
50
+ });
33
51
  /**
34
52
  * @description
35
53
  * List of HTTP headers that are proxied from app request to all of the backend API
@@ -55,5 +73,7 @@ exports.DEFAULT_HTTP_CLIENT_INTERCEPTORS = DEFAULT_HTTP_CLIENT_INTERCEPTORS;
55
73
  exports.DISABLE_CIRCUIT_BREAKER = DISABLE_CIRCUIT_BREAKER;
56
74
  exports.HTTP_CLIENT = HTTP_CLIENT;
57
75
  exports.HTTP_CLIENT_AGENT = HTTP_CLIENT_AGENT;
76
+ exports.HTTP_CLIENT_AGENT_INTERCEPTORS = HTTP_CLIENT_AGENT_INTERCEPTORS;
77
+ exports.HTTP_CLIENT_AGENT_OPTIONS = HTTP_CLIENT_AGENT_OPTIONS;
58
78
  exports.HTTP_CLIENT_FACTORY = HTTP_CLIENT_FACTORY;
59
79
  exports.PAPI_SERVICE = PAPI_SERVICE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-http-client",
3
- "version": "6.63.1",
3
+ "version": "6.65.0",
4
4
  "initialVersion": "0.58.99",
5
5
  "description": "Tramvai tokens for @tramvai/module-http-client",
6
6
  "main": "lib/index.js",
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@tramvai/http-client": "0.6.0",
23
- "@tramvai/tinkoff-request-http-client-adapter": "0.13.107"
23
+ "@tramvai/tinkoff-request-http-client-adapter": "0.13.110",
24
+ "undici": "^7.16.0"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "@tinkoff/dippy": "0.12.3",