@tramvai/tinkoff-request-http-client-adapter 0.9.175 → 0.9.178

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.
@@ -0,0 +1,39 @@
1
+ import compose from '@tinkoff/utils/function/compose';
2
+
3
+ /**
4
+ * Опции `modifyRequest`, `modifyResponse` и `modifyError`, при наличии в обоих аргументах,
5
+ * объединяются через метод `compose`, сначала выполняется метод из первого аргумента, затем из второго.
6
+ */
7
+ // eslint-disable-next-line complexity
8
+ function mergeOptions(options, nextOptions, config) {
9
+ if (config === null || config === void 0 ? void 0 : config.replace) {
10
+ return {
11
+ ...options,
12
+ ...nextOptions,
13
+ };
14
+ }
15
+ const result = {
16
+ ...options,
17
+ ...nextOptions,
18
+ query: {
19
+ ...options.query,
20
+ ...nextOptions.query,
21
+ },
22
+ headers: {
23
+ ...options.headers,
24
+ ...nextOptions.headers,
25
+ },
26
+ };
27
+ const composeModifier = (modifier) => {
28
+ if (options[modifier] && nextOptions[modifier]) {
29
+ // eslint-disable-next-line no-param-reassign
30
+ result[modifier] = compose(nextOptions[modifier], options[modifier]);
31
+ }
32
+ };
33
+ composeModifier('modifyRequest');
34
+ composeModifier('modifyResponse');
35
+ composeModifier('modifyError');
36
+ return result;
37
+ }
38
+
39
+ export { mergeOptions };
@@ -0,0 +1,39 @@
1
+ import compose from '@tinkoff/utils/function/compose';
2
+
3
+ /**
4
+ * Опции `modifyRequest`, `modifyResponse` и `modifyError`, при наличии в обоих аргументах,
5
+ * объединяются через метод `compose`, сначала выполняется метод из первого аргумента, затем из второго.
6
+ */
7
+ // eslint-disable-next-line complexity
8
+ function mergeOptions(options, nextOptions, config) {
9
+ if (config === null || config === void 0 ? void 0 : config.replace) {
10
+ return {
11
+ ...options,
12
+ ...nextOptions,
13
+ };
14
+ }
15
+ const result = {
16
+ ...options,
17
+ ...nextOptions,
18
+ query: {
19
+ ...options.query,
20
+ ...nextOptions.query,
21
+ },
22
+ headers: {
23
+ ...options.headers,
24
+ ...nextOptions.headers,
25
+ },
26
+ };
27
+ const composeModifier = (modifier) => {
28
+ if (options[modifier] && nextOptions[modifier]) {
29
+ // eslint-disable-next-line no-param-reassign
30
+ result[modifier] = compose(nextOptions[modifier], options[modifier]);
31
+ }
32
+ };
33
+ composeModifier('modifyRequest');
34
+ composeModifier('modifyResponse');
35
+ composeModifier('modifyError');
36
+ return result;
37
+ }
38
+
39
+ export { mergeOptions };
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var compose = require('@tinkoff/utils/function/compose');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var compose__default = /*#__PURE__*/_interopDefaultLegacy(compose);
10
+
11
+ /**
12
+ * Опции `modifyRequest`, `modifyResponse` и `modifyError`, при наличии в обоих аргументах,
13
+ * объединяются через метод `compose`, сначала выполняется метод из первого аргумента, затем из второго.
14
+ */
15
+ // eslint-disable-next-line complexity
16
+ function mergeOptions(options, nextOptions, config) {
17
+ if (config === null || config === void 0 ? void 0 : config.replace) {
18
+ return {
19
+ ...options,
20
+ ...nextOptions,
21
+ };
22
+ }
23
+ const result = {
24
+ ...options,
25
+ ...nextOptions,
26
+ query: {
27
+ ...options.query,
28
+ ...nextOptions.query,
29
+ },
30
+ headers: {
31
+ ...options.headers,
32
+ ...nextOptions.headers,
33
+ },
34
+ };
35
+ const composeModifier = (modifier) => {
36
+ if (options[modifier] && nextOptions[modifier]) {
37
+ // eslint-disable-next-line no-param-reassign
38
+ result[modifier] = compose__default["default"](nextOptions[modifier], options[modifier]);
39
+ }
40
+ };
41
+ composeModifier('modifyRequest');
42
+ composeModifier('modifyResponse');
43
+ composeModifier('modifyError');
44
+ return result;
45
+ }
46
+
47
+ exports.mergeOptions = mergeOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tinkoff-request-http-client-adapter",
3
- "version": "0.9.175",
3
+ "version": "0.9.178",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "browser": {
@@ -16,9 +16,8 @@
16
16
  "url": "git@github.com:Tinkoff/tramvai.git"
17
17
  },
18
18
  "scripts": {
19
- "build": "tramvai-build --for-publish",
20
- "watch": "tsc -w",
21
- "build-for-publish": "true"
19
+ "build": "tramvai-build --forPublish --preserveModules",
20
+ "watch": "tsc -w"
22
21
  },
23
22
  "dependencies": {
24
23
  "@tinkoff/request-core": "^0.9.2",
@@ -31,8 +30,8 @@
31
30
  "@tinkoff/request-plugin-validate": "^0.9.2",
32
31
  "@tinkoff/request-plugin-retry": "^0.2.3",
33
32
  "@tinkoff/utils": "^2.1.2",
34
- "@tramvai/http-client": "0.2.5",
35
- "@tramvai/tokens-common": "2.70.0",
33
+ "@tramvai/http-client": "0.2.6",
34
+ "@tramvai/tokens-common": "2.72.0",
36
35
  "tslib": "^2.4.0"
37
36
  },
38
37
  "sideEffects": false,