@tramvai/module-http-client 2.29.0 → 2.32.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 +3 -15
- package/lib/index.js +2 -14
- package/package.json +12 -12
- package/tests.js +2 -14
package/lib/index.es.js
CHANGED
|
@@ -14,8 +14,7 @@ import find from '@tinkoff/utils/array/find';
|
|
|
14
14
|
import { BaseHttpClient } from '@tramvai/http-client';
|
|
15
15
|
export * from '@tramvai/http-client';
|
|
16
16
|
import { getPapiParameters } from '@tramvai/papi';
|
|
17
|
-
import {
|
|
18
|
-
import { PAPI_EXECUTOR } from '@tramvai/tokens-server-private';
|
|
17
|
+
import { FASTIFY_REQUEST, FASTIFY_RESPONSE, PAPI_EXECUTOR } from '@tramvai/tokens-server-private';
|
|
19
18
|
|
|
20
19
|
const fillHeaderIp = ({ requestManager, }) => {
|
|
21
20
|
if (!requestManager) {
|
|
@@ -138,27 +137,16 @@ class PapiService extends BaseHttpClient {
|
|
|
138
137
|
if (!papiRoute) {
|
|
139
138
|
throw new Error(`papi handler '${path}' not found`);
|
|
140
139
|
}
|
|
141
|
-
getPapiParameters(papiRoute);
|
|
142
140
|
const req = { headers: { host: 'localhost' }, cookies: {}, query, body };
|
|
143
141
|
const res = {};
|
|
144
|
-
const fastifyReq = { raw: req };
|
|
145
|
-
const fastifyRes = { raw: res };
|
|
146
142
|
const childDi = createChildContainer(this.di, [
|
|
147
|
-
{
|
|
148
|
-
provide: REQUEST,
|
|
149
|
-
useValue: req,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
provide: RESPONSE,
|
|
153
|
-
useValue: res,
|
|
154
|
-
},
|
|
155
143
|
{
|
|
156
144
|
provide: FASTIFY_REQUEST,
|
|
157
|
-
useValue:
|
|
145
|
+
useValue: req,
|
|
158
146
|
},
|
|
159
147
|
{
|
|
160
148
|
provide: FASTIFY_RESPONSE,
|
|
161
|
-
useValue:
|
|
149
|
+
useValue: res,
|
|
162
150
|
},
|
|
163
151
|
]);
|
|
164
152
|
const papiExecutor = childDi.get(PAPI_EXECUTOR);
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var tokensServer = require('@tramvai/tokens-server');
|
|
|
16
16
|
var find = require('@tinkoff/utils/array/find');
|
|
17
17
|
var httpClient = require('@tramvai/http-client');
|
|
18
18
|
var papi = require('@tramvai/papi');
|
|
19
|
-
var moduleCommon = require('@tramvai/module-common');
|
|
20
19
|
var tokensServerPrivate = require('@tramvai/tokens-server-private');
|
|
21
20
|
|
|
22
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -149,28 +148,17 @@ class PapiService extends httpClient.BaseHttpClient {
|
|
|
149
148
|
if (!papiRoute) {
|
|
150
149
|
throw new Error(`papi handler '${path}' not found`);
|
|
151
150
|
}
|
|
152
|
-
papi.getPapiParameters(papiRoute);
|
|
153
151
|
const req = { headers: { host: 'localhost' }, cookies: {}, query, body };
|
|
154
152
|
const res = {};
|
|
155
|
-
const fastifyReq = { raw: req };
|
|
156
|
-
const fastifyRes = { raw: res };
|
|
157
153
|
const childDi = dippy.createChildContainer(this.di, [
|
|
158
154
|
{
|
|
159
|
-
provide:
|
|
155
|
+
provide: tokensServerPrivate.FASTIFY_REQUEST,
|
|
160
156
|
useValue: req,
|
|
161
157
|
},
|
|
162
158
|
{
|
|
163
|
-
provide:
|
|
159
|
+
provide: tokensServerPrivate.FASTIFY_RESPONSE,
|
|
164
160
|
useValue: res,
|
|
165
161
|
},
|
|
166
|
-
{
|
|
167
|
-
provide: moduleCommon.FASTIFY_REQUEST,
|
|
168
|
-
useValue: fastifyReq,
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
provide: moduleCommon.FASTIFY_RESPONSE,
|
|
172
|
-
useValue: fastifyRes,
|
|
173
|
-
},
|
|
174
162
|
]);
|
|
175
163
|
const papiExecutor = childDi.get(tokensServerPrivate.PAPI_EXECUTOR);
|
|
176
164
|
const payload = await papiExecutor(papiRoute);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-http-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"initialVersion": "0.58.99",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@tramvai/http-client": "0.2.3",
|
|
30
|
-
"@tramvai/tinkoff-request-http-client-adapter": "0.9.
|
|
31
|
-
"@tramvai/tokens-http-client": "2.
|
|
32
|
-
"@tramvai/tokens-common": "2.
|
|
33
|
-
"@tramvai/tokens-server": "2.
|
|
34
|
-
"@tramvai/tokens-server-private": "2.
|
|
30
|
+
"@tramvai/tinkoff-request-http-client-adapter": "0.9.72",
|
|
31
|
+
"@tramvai/tokens-http-client": "2.32.0",
|
|
32
|
+
"@tramvai/tokens-common": "2.32.0",
|
|
33
|
+
"@tramvai/tokens-server": "2.32.0",
|
|
34
|
+
"@tramvai/tokens-server-private": "2.32.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@tinkoff/request-core": "^0.9.2",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@tinkoff/utils": "^2.1.2",
|
|
42
|
-
"@tramvai/core": "2.
|
|
43
|
-
"@tramvai/module-common": "2.
|
|
44
|
-
"@tramvai/papi": "2.
|
|
45
|
-
"@tramvai/test-helpers": "2.
|
|
46
|
-
"@tramvai/test-unit": "2.
|
|
47
|
-
"@tramvai/test-mocks": "2.
|
|
42
|
+
"@tramvai/core": "2.32.0",
|
|
43
|
+
"@tramvai/module-common": "2.32.0",
|
|
44
|
+
"@tramvai/papi": "2.32.0",
|
|
45
|
+
"@tramvai/test-helpers": "2.32.0",
|
|
46
|
+
"@tramvai/test-unit": "2.32.0",
|
|
47
|
+
"@tramvai/test-mocks": "2.32.0",
|
|
48
48
|
"@tinkoff/dippy": "0.8.6",
|
|
49
49
|
"node-fetch": "^2.6.1",
|
|
50
50
|
"tslib": "^2.4.0"
|
package/tests.js
CHANGED
|
@@ -19,7 +19,6 @@ var tokensServer = require('@tramvai/tokens-server');
|
|
|
19
19
|
var find = require('@tinkoff/utils/array/find');
|
|
20
20
|
var httpClient = require('@tramvai/http-client');
|
|
21
21
|
var papi = require('@tramvai/papi');
|
|
22
|
-
var moduleCommon = require('@tramvai/module-common');
|
|
23
22
|
var tokensServerPrivate = require('@tramvai/tokens-server-private');
|
|
24
23
|
|
|
25
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -153,28 +152,17 @@ class PapiService extends httpClient.BaseHttpClient {
|
|
|
153
152
|
if (!papiRoute) {
|
|
154
153
|
throw new Error(`papi handler '${path}' not found`);
|
|
155
154
|
}
|
|
156
|
-
papi.getPapiParameters(papiRoute);
|
|
157
155
|
const req = { headers: { host: 'localhost' }, cookies: {}, query, body };
|
|
158
156
|
const res = {};
|
|
159
|
-
const fastifyReq = { raw: req };
|
|
160
|
-
const fastifyRes = { raw: res };
|
|
161
157
|
const childDi = dippy.createChildContainer(this.di, [
|
|
162
158
|
{
|
|
163
|
-
provide:
|
|
159
|
+
provide: tokensServerPrivate.FASTIFY_REQUEST,
|
|
164
160
|
useValue: req,
|
|
165
161
|
},
|
|
166
162
|
{
|
|
167
|
-
provide:
|
|
163
|
+
provide: tokensServerPrivate.FASTIFY_RESPONSE,
|
|
168
164
|
useValue: res,
|
|
169
165
|
},
|
|
170
|
-
{
|
|
171
|
-
provide: moduleCommon.FASTIFY_REQUEST,
|
|
172
|
-
useValue: fastifyReq,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
provide: moduleCommon.FASTIFY_RESPONSE,
|
|
176
|
-
useValue: fastifyRes,
|
|
177
|
-
},
|
|
178
166
|
]);
|
|
179
167
|
const papiExecutor = childDi.get(tokensServerPrivate.PAPI_EXECUTOR);
|
|
180
168
|
const payload = await papiExecutor(papiRoute);
|