@tramvai/module-http-client 5.10.0 → 5.14.9

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.
@@ -13,7 +13,6 @@ const environmentDependentOptions = typeof window === 'undefined'
13
13
  };
14
14
  const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
15
15
  return (options) => {
16
- var _a;
17
16
  if (!options.name) {
18
17
  throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
19
18
  }
@@ -35,7 +34,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
35
34
  minimumFailureCount: 10,
36
35
  },
37
36
  // TODO: remove any after [resolving](https://github.com/southpolesteve/node-abort-controller/issues/31)
38
- signal: (_a = commandLineExecutionContext === null || commandLineExecutionContext === void 0 ? void 0 : commandLineExecutionContext()) === null || _a === void 0 ? void 0 : _a.abortSignal,
37
+ signal: commandLineExecutionContext?.()?.abortSignal,
39
38
  ...environmentDependentOptions,
40
39
  }, defaultOptions ? mergeOptions(defaultOptions, interceptors) : interceptors), options);
41
40
  // по умолчанию, на сервере, библиотека https://github.com/node-fetch/node-fetch
@@ -13,7 +13,6 @@ const environmentDependentOptions = typeof window === 'undefined'
13
13
  };
14
14
  const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
15
15
  return (options) => {
16
- var _a;
17
16
  if (!options.name) {
18
17
  throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
19
18
  }
@@ -35,7 +34,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
35
34
  minimumFailureCount: 10,
36
35
  },
37
36
  // TODO: remove any after [resolving](https://github.com/southpolesteve/node-abort-controller/issues/31)
38
- signal: (_a = commandLineExecutionContext === null || commandLineExecutionContext === void 0 ? void 0 : commandLineExecutionContext()) === null || _a === void 0 ? void 0 : _a.abortSignal,
37
+ signal: commandLineExecutionContext?.()?.abortSignal,
39
38
  ...environmentDependentOptions,
40
39
  }, defaultOptions ? mergeOptions(defaultOptions, interceptors) : interceptors), options);
41
40
  // по умолчанию, на сервере, библиотека https://github.com/node-fetch/node-fetch
@@ -22,7 +22,6 @@ const environmentDependentOptions = typeof window === 'undefined'
22
22
  };
23
23
  const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
24
24
  return (options) => {
25
- var _a;
26
25
  if (!options.name) {
27
26
  throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
28
27
  }
@@ -44,7 +43,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
44
43
  minimumFailureCount: 10,
45
44
  },
46
45
  // TODO: remove any after [resolving](https://github.com/southpolesteve/node-abort-controller/issues/31)
47
- signal: (_a = commandLineExecutionContext === null || commandLineExecutionContext === void 0 ? void 0 : commandLineExecutionContext()) === null || _a === void 0 ? void 0 : _a.abortSignal,
46
+ signal: commandLineExecutionContext?.()?.abortSignal,
48
47
  ...environmentDependentOptions,
49
48
  }, defaultOptions ? tinkoffRequestHttpClientAdapter.mergeOptions(defaultOptions, interceptors) : interceptors), options);
50
49
  // по умолчанию, на сервере, библиотека https://github.com/node-fetch/node-fetch
@@ -12,8 +12,7 @@ class PapiService extends BaseHttpClient {
12
12
  this.di = di;
13
13
  }
14
14
  async request({ path, query, body }) {
15
- var _a;
16
- const papiRoute = find((papi) => getPapiParameters(papi).path === `/${path}`, (_a = this.papi) !== null && _a !== void 0 ? _a : []);
15
+ const papiRoute = find((papi) => getPapiParameters(papi).path === `/${path}`, this.papi ?? []);
17
16
  if (!papiRoute) {
18
17
  throw new Error(`papi handler '${path}' not found`);
19
18
  }
@@ -21,8 +21,7 @@ class PapiService extends httpClient.BaseHttpClient {
21
21
  this.di = di;
22
22
  }
23
23
  async request({ path, query, body }) {
24
- var _a;
25
- const papiRoute = find__default["default"]((papi$1) => papi.getPapiParameters(papi$1).path === `/${path}`, (_a = this.papi) !== null && _a !== void 0 ? _a : []);
24
+ const papiRoute = find__default["default"]((papi$1) => papi.getPapiParameters(papi$1).path === `/${path}`, this.papi ?? []);
26
25
  if (!papiRoute) {
27
26
  throw new Error(`papi handler '${path}' not found`);
28
27
  }
@@ -20,7 +20,7 @@ const fillHeaders = ({ requestManager, headersList, }) => {
20
20
  if (!requestManager) {
21
21
  return identity;
22
22
  }
23
- const headerNames = flatten(headersList !== null && headersList !== void 0 ? headersList : []);
23
+ const headerNames = flatten(headersList ?? []);
24
24
  return (params) => {
25
25
  return {
26
26
  ...params,
@@ -30,7 +30,7 @@ const fillHeaders = ({ requestManager, headersList, }) => {
30
30
  if (!requestManager) {
31
31
  return identity__default["default"];
32
32
  }
33
- const headerNames = flatten__default["default"](headersList !== null && headersList !== void 0 ? headersList : []);
33
+ const headerNames = flatten__default["default"](headersList ?? []);
34
34
  return (params) => {
35
35
  return {
36
36
  ...params,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-http-client",
3
- "version": "5.10.0",
3
+ "version": "5.14.9",
4
4
  "initialVersion": "0.58.99",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -26,11 +26,11 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@tramvai/http-client": "0.5.2",
29
- "@tramvai/tinkoff-request-http-client-adapter": "0.12.27",
30
- "@tramvai/tokens-http-client": "5.10.0",
31
- "@tramvai/tokens-common": "5.10.0",
32
- "@tramvai/tokens-server": "5.10.0",
33
- "@tramvai/tokens-server-private": "5.10.0"
29
+ "@tramvai/tinkoff-request-http-client-adapter": "0.12.46",
30
+ "@tramvai/tokens-http-client": "5.14.9",
31
+ "@tramvai/tokens-common": "5.14.9",
32
+ "@tramvai/tokens-server": "5.14.9",
33
+ "@tramvai/tokens-server-private": "5.14.9"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@tinkoff/request-core": "^0.10.0",
@@ -39,12 +39,12 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@tinkoff/utils": "^2.1.2",
42
- "@tramvai/core": "5.10.0",
43
- "@tramvai/module-common": "5.10.0",
44
- "@tramvai/papi": "5.10.0",
45
- "@tramvai/test-helpers": "5.10.0",
46
- "@tramvai/test-unit": "5.10.0",
47
- "@tramvai/test-mocks": "5.10.0",
42
+ "@tramvai/core": "5.14.9",
43
+ "@tramvai/module-common": "5.14.9",
44
+ "@tramvai/papi": "5.14.9",
45
+ "@tramvai/test-helpers": "5.14.9",
46
+ "@tramvai/test-unit": "5.14.9",
47
+ "@tramvai/test-mocks": "5.14.9",
48
48
  "@tinkoff/dippy": "0.11.3",
49
49
  "node-fetch": "^2.6.1",
50
50
  "tslib": "^2.4.0"
package/tests.js CHANGED
@@ -49,7 +49,7 @@ const fillHeaders = ({ requestManager, headersList, }) => {
49
49
  if (!requestManager) {
50
50
  return identity__default["default"];
51
51
  }
52
- const headerNames = flatten__default["default"](headersList !== null && headersList !== void 0 ? headersList : []);
52
+ const headerNames = flatten__default["default"](headersList ?? []);
53
53
  return (params) => {
54
54
  return {
55
55
  ...params,
@@ -85,7 +85,6 @@ const environmentDependentOptions = typeof window === 'undefined'
85
85
  };
86
86
  const httpClientFactory = ({ logger, envManager, appInfo, requestManager, headersList, createCache, makeRequestRegistry, agent, querySerializer, disableCircuitBreaker = false, defaultOptions, defaultInterceptors, commandLineExecutionContext, }) => {
87
87
  return (options) => {
88
- var _a;
89
88
  if (!options.name) {
90
89
  throw Error(`You need to pass a unique field "name" for the HTTP client instance`);
91
90
  }
@@ -107,7 +106,7 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
107
106
  minimumFailureCount: 10,
108
107
  },
109
108
  // TODO: remove any after [resolving](https://github.com/southpolesteve/node-abort-controller/issues/31)
110
- signal: (_a = commandLineExecutionContext === null || commandLineExecutionContext === void 0 ? void 0 : commandLineExecutionContext()) === null || _a === void 0 ? void 0 : _a.abortSignal,
109
+ signal: commandLineExecutionContext?.()?.abortSignal,
111
110
  ...environmentDependentOptions,
112
111
  }, defaultOptions ? tinkoffRequestHttpClientAdapter.mergeOptions(defaultOptions, interceptors) : interceptors), options);
113
112
  // по умолчанию, на сервере, библиотека https://github.com/node-fetch/node-fetch
@@ -153,8 +152,7 @@ class PapiService extends httpClient.BaseHttpClient {
153
152
  this.di = di;
154
153
  }
155
154
  async request({ path, query, body }) {
156
- var _a;
157
- const papiRoute = find__default["default"]((papi$1) => papi.getPapiParameters(papi$1).path === `/${path}`, (_a = this.papi) !== null && _a !== void 0 ? _a : []);
155
+ const papiRoute = find__default["default"]((papi$1) => papi.getPapiParameters(papi$1).path === `/${path}`, this.papi ?? []);
158
156
  if (!papiRoute) {
159
157
  throw new Error(`papi handler '${path}' not found`);
160
158
  }