@tramvai/module-http-client 5.53.156 → 5.53.163

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.
@@ -1,6 +1,9 @@
1
+ import noop from '@tinkoff/utils/function/noop';
1
2
  import { createToken } from '@tinkoff/dippy';
2
- import { Module, provide, APP_INFO_TOKEN, Scope } from '@tramvai/core';
3
+ import { Module, provide, APP_INFO_TOKEN, Scope, optional } from '@tramvai/core';
3
4
  import { HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, DISABLE_CIRCUIT_BREAKER, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, HTTP_CLIENT } from '@tramvai/tokens-http-client';
5
+ import { commandLineListTokens } from '@tramvai/child-app-core';
6
+ import { IS_CHILD_APP_DI_TOKEN } from '@tramvai/tokens-child-app';
4
7
  import { LOGGER_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, ENV_USED_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
5
8
  import { httpClientFactory } from './httpClient/httpClientFactory.browser.js';
6
9
  import { PapiClientModule } from './papiClientModule.browser.browser.js';
@@ -106,6 +109,22 @@ const HttpClientModule = /* @__PURE__ */ Module({
106
109
  provide: API_CLIENT_PASS_HEADERS,
107
110
  useValue: ['x-request-id'],
108
111
  }),
112
+ ...(typeof window === 'undefined'
113
+ ? [
114
+ provide({
115
+ provide: commandLineListTokens.customerStart,
116
+ useFactory: ({ isChildAppRunner }) => {
117
+ if (isChildAppRunner && process.env.NODE_ENV === 'development') {
118
+ process.emitWarning('HttpClientModule cannot be imported in a child app. This module must be used in host application.', 'http-client-module-error');
119
+ }
120
+ return noop;
121
+ },
122
+ deps: {
123
+ isChildAppRunner: optional(IS_CHILD_APP_DI_TOKEN),
124
+ },
125
+ }),
126
+ ]
127
+ : []),
109
128
  ],
110
129
  })(class HttpClientModule {
111
130
  });
@@ -1,6 +1,9 @@
1
+ import noop from '@tinkoff/utils/function/noop';
1
2
  import { createToken } from '@tinkoff/dippy';
2
- import { Module, provide, APP_INFO_TOKEN, Scope } from '@tramvai/core';
3
+ import { Module, provide, APP_INFO_TOKEN, Scope, optional } from '@tramvai/core';
3
4
  import { HTTP_CLIENT_FACTORY, API_CLIENT_PASS_HEADERS, HTTP_CLIENT_AGENT, DISABLE_CIRCUIT_BREAKER, DEFAULT_HTTP_CLIENT_FACTORY_OPTIONS, DEFAULT_HTTP_CLIENT_INTERCEPTORS, HTTP_CLIENT } from '@tramvai/tokens-http-client';
5
+ import { commandLineListTokens } from '@tramvai/child-app-core';
6
+ import { IS_CHILD_APP_DI_TOKEN } from '@tramvai/tokens-child-app';
4
7
  import { LOGGER_TOKEN, ENV_MANAGER_TOKEN, REQUEST_MANAGER_TOKEN, COMMAND_LINE_EXECUTION_CONTEXT_TOKEN, ENV_USED_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
5
8
  import { httpClientFactory } from './httpClient/httpClientFactory.es.js';
6
9
  import { PapiClientModule } from './papiClientModule.es.js';
@@ -106,6 +109,22 @@ const HttpClientModule = /* @__PURE__ */ Module({
106
109
  provide: API_CLIENT_PASS_HEADERS,
107
110
  useValue: ['x-request-id'],
108
111
  }),
112
+ ...(typeof window === 'undefined'
113
+ ? [
114
+ provide({
115
+ provide: commandLineListTokens.customerStart,
116
+ useFactory: ({ isChildAppRunner }) => {
117
+ if (isChildAppRunner && process.env.NODE_ENV === 'development') {
118
+ process.emitWarning('HttpClientModule cannot be imported in a child app. This module must be used in host application.', 'http-client-module-error');
119
+ }
120
+ return noop;
121
+ },
122
+ deps: {
123
+ isChildAppRunner: optional(IS_CHILD_APP_DI_TOKEN),
124
+ },
125
+ }),
126
+ ]
127
+ : []),
109
128
  ],
110
129
  })(class HttpClientModule {
111
130
  });
@@ -2,13 +2,20 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var noop = require('@tinkoff/utils/function/noop');
5
6
  var dippy = require('@tinkoff/dippy');
6
7
  var core = require('@tramvai/core');
7
8
  var tokensHttpClient = require('@tramvai/tokens-http-client');
9
+ var childAppCore = require('@tramvai/child-app-core');
10
+ var tokensChildApp = require('@tramvai/tokens-child-app');
8
11
  var tokensCommon = require('@tramvai/tokens-common');
9
12
  var httpClientFactory = require('./httpClient/httpClientFactory.js');
10
13
  var papiClientModule = require('./papiClientModule.js');
11
14
 
15
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
+
17
+ var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
18
+
12
19
  const createCacheToken = dippy.createToken('httpClient createCache');
13
20
  const HttpClientModule = /* @__PURE__ */ core.Module({
14
21
  imports: [papiClientModule.PapiClientModule],
@@ -110,6 +117,22 @@ const HttpClientModule = /* @__PURE__ */ core.Module({
110
117
  provide: tokensHttpClient.API_CLIENT_PASS_HEADERS,
111
118
  useValue: ['x-request-id'],
112
119
  }),
120
+ ...(typeof window === 'undefined'
121
+ ? [
122
+ core.provide({
123
+ provide: childAppCore.commandLineListTokens.customerStart,
124
+ useFactory: ({ isChildAppRunner }) => {
125
+ if (isChildAppRunner && process.env.NODE_ENV === 'development') {
126
+ process.emitWarning('HttpClientModule cannot be imported in a child app. This module must be used in host application.', 'http-client-module-error');
127
+ }
128
+ return noop__default["default"];
129
+ },
130
+ deps: {
131
+ isChildAppRunner: core.optional(tokensChildApp.IS_CHILD_APP_DI_TOKEN),
132
+ },
133
+ }),
134
+ ]
135
+ : []),
113
136
  ],
114
137
  })(class HttpClientModule {
115
138
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-http-client",
3
- "version": "5.53.156",
3
+ "version": "5.53.163",
4
4
  "initialVersion": "0.58.99",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -25,12 +25,14 @@
25
25
  "watch": "tsc -w"
26
26
  },
27
27
  "dependencies": {
28
+ "@tramvai/child-app-core": "5.53.163",
28
29
  "@tramvai/http-client": "0.5.8",
29
- "@tramvai/tinkoff-request-http-client-adapter": "0.12.280",
30
- "@tramvai/tokens-common": "5.53.156",
31
- "@tramvai/tokens-http-client": "5.53.156",
32
- "@tramvai/tokens-server": "5.53.156",
33
- "@tramvai/tokens-server-private": "5.53.156"
30
+ "@tramvai/tinkoff-request-http-client-adapter": "0.12.287",
31
+ "@tramvai/tokens-child-app": "5.53.163",
32
+ "@tramvai/tokens-common": "5.53.163",
33
+ "@tramvai/tokens-http-client": "5.53.163",
34
+ "@tramvai/tokens-server": "5.53.163",
35
+ "@tramvai/tokens-server-private": "5.53.163"
34
36
  },
35
37
  "devDependencies": {
36
38
  "@tinkoff/request-core": "^0.10.0",
@@ -40,12 +42,12 @@
40
42
  "peerDependencies": {
41
43
  "@tinkoff/dippy": "^1.0.0",
42
44
  "@tinkoff/utils": "^2.1.2",
43
- "@tramvai/core": "5.53.156",
44
- "@tramvai/module-common": "5.53.156",
45
- "@tramvai/papi": "5.53.156",
46
- "@tramvai/test-helpers": "5.53.156",
47
- "@tramvai/test-mocks": "5.53.156",
48
- "@tramvai/test-unit": "5.53.156",
45
+ "@tramvai/core": "5.53.163",
46
+ "@tramvai/module-common": "5.53.163",
47
+ "@tramvai/papi": "5.53.163",
48
+ "@tramvai/test-helpers": "5.53.163",
49
+ "@tramvai/test-mocks": "5.53.163",
50
+ "@tramvai/test-unit": "5.53.163",
49
51
  "node-fetch": "^2.6.1",
50
52
  "tslib": "^2.4.0"
51
53
  },
package/tests.js CHANGED
@@ -5,9 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var fetch = require('node-fetch');
6
6
  var testHelpers = require('@tramvai/test-helpers');
7
7
  var testMocks = require('@tramvai/test-mocks');
8
+ var noop = require('@tinkoff/utils/function/noop');
8
9
  var dippy = require('@tinkoff/dippy');
9
10
  var core = require('@tramvai/core');
10
11
  var tokensHttpClient = require('@tramvai/tokens-http-client');
12
+ var childAppCore = require('@tramvai/child-app-core');
13
+ var tokensChildApp = require('@tramvai/tokens-child-app');
11
14
  var tokensCommon = require('@tramvai/tokens-common');
12
15
  var isNil = require('@tinkoff/utils/is/nil');
13
16
  var compose = require('@tinkoff/utils/function/compose');
@@ -24,6 +27,7 @@ var tokensServerPrivate = require('@tramvai/tokens-server-private');
24
27
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
28
 
26
29
  var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
30
+ var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
27
31
  var isNil__default = /*#__PURE__*/_interopDefaultLegacy(isNil);
28
32
  var compose__default = /*#__PURE__*/_interopDefaultLegacy(compose);
29
33
  var identity__default = /*#__PURE__*/_interopDefaultLegacy(identity);
@@ -314,6 +318,22 @@ const HttpClientModule = /* @__PURE__ */ core.Module({
314
318
  provide: tokensHttpClient.API_CLIENT_PASS_HEADERS,
315
319
  useValue: ['x-request-id'],
316
320
  }),
321
+ ...(typeof window === 'undefined'
322
+ ? [
323
+ core.provide({
324
+ provide: childAppCore.commandLineListTokens.customerStart,
325
+ useFactory: ({ isChildAppRunner }) => {
326
+ if (isChildAppRunner && process.env.NODE_ENV === 'development') {
327
+ process.emitWarning('HttpClientModule cannot be imported in a child app. This module must be used in host application.', 'http-client-module-error');
328
+ }
329
+ return noop__default["default"];
330
+ },
331
+ deps: {
332
+ isChildAppRunner: core.optional(tokensChildApp.IS_CHILD_APP_DI_TOKEN),
333
+ },
334
+ }),
335
+ ]
336
+ : []),
317
337
  ],
318
338
  })(class HttpClientModule {
319
339
  });