@tramvai/module-http-client 1.64.0 → 1.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.es.js CHANGED
@@ -12,9 +12,10 @@ import flatten from '@tinkoff/utils/array/flatten';
12
12
  import pick from '@tinkoff/utils/object/pick';
13
13
  import { SERVER_MODULE_PAPI_PUBLIC_ROUTE } from '@tramvai/tokens-server';
14
14
  import find from '@tinkoff/utils/array/find';
15
+ import { BaseHttpClient } from '@tramvai/http-client';
16
+ export * from '@tramvai/http-client';
15
17
  import { getPapiParameters } from '@tramvai/papi';
16
18
  import { REQUEST, RESPONSE } from '@tramvai/module-common';
17
- export * from '@tramvai/http-client';
18
19
 
19
20
  const fillHeaderIp = ({ requestManager, }) => {
20
21
  if (!requestManager) {
@@ -136,8 +137,9 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
136
137
  };
137
138
  };
138
139
 
139
- class PapiService {
140
+ class PapiService extends BaseHttpClient {
140
141
  constructor({ papi, di }) {
142
+ super();
141
143
  this.papi = flatten(papi || []);
142
144
  this.di = di;
143
145
  }
@@ -172,40 +174,6 @@ class PapiService {
172
174
  });
173
175
  return { payload, status: 200, headers: {} };
174
176
  }
175
- get(path, payload, config) {
176
- return this.request({
177
- path,
178
- ...payload,
179
- ...config,
180
- method: 'GET',
181
- });
182
- }
183
- post(path, payload, config) {
184
- return this.request({
185
- path,
186
- requestType: 'json',
187
- ...payload,
188
- ...config,
189
- method: 'POST',
190
- });
191
- }
192
- put(path, payload, config) {
193
- return this.request({
194
- path,
195
- requestType: 'json',
196
- ...payload,
197
- ...config,
198
- method: 'PUT',
199
- });
200
- }
201
- delete(path, payload, config) {
202
- return this.request({
203
- path,
204
- ...payload,
205
- ...config,
206
- method: 'DELETE',
207
- });
208
- }
209
177
  }
210
178
 
211
179
  let PapiClientModule = class PapiClientModule {
package/lib/index.js CHANGED
@@ -15,9 +15,9 @@ var flatten = require('@tinkoff/utils/array/flatten');
15
15
  var pick = require('@tinkoff/utils/object/pick');
16
16
  var tokensServer = require('@tramvai/tokens-server');
17
17
  var find = require('@tinkoff/utils/array/find');
18
+ var httpClient = require('@tramvai/http-client');
18
19
  var papi = require('@tramvai/papi');
19
20
  var moduleCommon = require('@tramvai/module-common');
20
- var httpClient = require('@tramvai/http-client');
21
21
 
22
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
23
 
@@ -148,8 +148,9 @@ const httpClientFactory = ({ logger, envManager, appInfo, requestManager, header
148
148
  };
149
149
  };
150
150
 
151
- class PapiService {
151
+ class PapiService extends httpClient.BaseHttpClient {
152
152
  constructor({ papi, di }) {
153
+ super();
153
154
  this.papi = flatten__default["default"](papi || []);
154
155
  this.di = di;
155
156
  }
@@ -184,40 +185,6 @@ class PapiService {
184
185
  });
185
186
  return { payload, status: 200, headers: {} };
186
187
  }
187
- get(path, payload, config) {
188
- return this.request({
189
- path,
190
- ...payload,
191
- ...config,
192
- method: 'GET',
193
- });
194
- }
195
- post(path, payload, config) {
196
- return this.request({
197
- path,
198
- requestType: 'json',
199
- ...payload,
200
- ...config,
201
- method: 'POST',
202
- });
203
- }
204
- put(path, payload, config) {
205
- return this.request({
206
- path,
207
- requestType: 'json',
208
- ...payload,
209
- ...config,
210
- method: 'PUT',
211
- });
212
- }
213
- delete(path, payload, config) {
214
- return this.request({
215
- path,
216
- ...payload,
217
- ...config,
218
- method: 'DELETE',
219
- });
220
- }
221
188
  }
222
189
 
223
190
  let PapiClientModule = class PapiClientModule {
@@ -1,17 +1,14 @@
1
1
  import type { DI_TOKEN } from '@tramvai/core';
2
2
  import type { HttpClientRequest, HttpClientResponse } from '@tramvai/http-client';
3
+ import { BaseHttpClient } from '@tramvai/http-client';
3
4
  import type { SERVER_MODULE_PAPI_PUBLIC_ROUTE } from '@tramvai/tokens-server';
4
5
  export interface Deps {
5
6
  di: typeof DI_TOKEN;
6
7
  papi?: typeof SERVER_MODULE_PAPI_PUBLIC_ROUTE[];
7
8
  }
8
- export declare class PapiService {
9
+ export declare class PapiService extends BaseHttpClient {
9
10
  papi: Deps['papi'];
10
11
  di: Deps['di'];
11
12
  constructor({ papi, di }: Deps);
12
13
  request<R = any>({ path, query, body }: HttpClientRequest): Promise<HttpClientResponse<R>>;
13
- get<R = any>(path: string, payload?: Pick<HttpClientRequest, 'query' | 'headers'>, config?: Omit<HttpClientRequest, 'url' | 'query' | 'body' | 'headers'>): Promise<HttpClientResponse<R>>;
14
- post<R = any>(path: string, payload?: Pick<HttpClientRequest, 'query' | 'body' | 'headers'>, config?: Omit<HttpClientRequest, 'url' | 'query' | 'body' | 'headers'>): Promise<HttpClientResponse<R>>;
15
- put<R = any>(path: string, payload?: Pick<HttpClientRequest, 'query' | 'body' | 'headers'>, config?: Omit<HttpClientRequest, 'url' | 'query' | 'body' | 'headers'>): Promise<HttpClientResponse<R>>;
16
- delete<R = any>(path: string, payload?: Pick<HttpClientRequest, 'query' | 'headers'>, config?: Omit<HttpClientRequest, 'url' | 'query' | 'body' | 'headers'>): Promise<HttpClientResponse<R>>;
17
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-http-client",
3
- "version": "1.64.0",
3
+ "version": "1.65.0",
4
4
  "initialVersion": "0.58.99",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -25,21 +25,21 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@tramvai/http-client": "0.1.25",
28
- "@tramvai/tinkoff-request-http-client-adapter": "0.8.258",
29
- "@tramvai/tokens-http-client": "1.64.0",
30
- "@tramvai/tokens-common": "1.64.0",
31
- "@tramvai/tokens-server": "1.64.0"
28
+ "@tramvai/tinkoff-request-http-client-adapter": "0.8.259",
29
+ "@tramvai/tokens-http-client": "1.65.0",
30
+ "@tramvai/tokens-common": "1.65.0",
31
+ "@tramvai/tokens-server": "1.65.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@tinkoff/request-core": "^0.8.9"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@tinkoff/utils": "^2.1.2",
38
- "@tramvai/core": "1.64.0",
39
- "@tramvai/module-common": "1.64.0",
40
- "@tramvai/papi": "1.64.0",
41
- "@tramvai/test-helpers": "1.64.0",
42
- "@tramvai/test-mocks": "1.64.0",
38
+ "@tramvai/core": "1.65.0",
39
+ "@tramvai/module-common": "1.65.0",
40
+ "@tramvai/papi": "1.65.0",
41
+ "@tramvai/test-helpers": "1.65.0",
42
+ "@tramvai/test-mocks": "1.65.0",
43
43
  "@tinkoff/dippy": "0.7.38",
44
44
  "node-fetch": "^2.6.1",
45
45
  "tslib": "^2.0.3"