@tramvai/module-http-client 2.56.1 → 2.56.5
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/httpClient/httpClientFactory.d.ts +8 -8
- package/lib/index.es.js +3 -2
- package/lib/index.js +3 -2
- package/lib/papi/papiService.d.ts +3 -2
- package/lib/test/unit/testApi.d.ts +1 -1
- package/lib/utils/fillHeaders.browser.d.ts +3 -2
- package/lib/utils/fillHeaders.d.ts +3 -3
- package/package.json +15 -14
- package/tests.d.ts +4 -1
- package/tests.js +3 -2
|
@@ -8,13 +8,13 @@ export declare const httpClientFactory: ({ logger, envManager, appInfo, requestM
|
|
|
8
8
|
logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
|
|
9
9
|
envManager: ExtractDependencyType<typeof ENV_MANAGER_TOKEN>;
|
|
10
10
|
appInfo: ExtractDependencyType<typeof APP_INFO_TOKEN>;
|
|
11
|
-
requestManager
|
|
12
|
-
headersList
|
|
13
|
-
createCache
|
|
11
|
+
requestManager: ExtractDependencyType<typeof REQUEST_MANAGER_TOKEN> | null;
|
|
12
|
+
headersList: ExtractDependencyType<typeof API_CLIENT_PASS_HEADERS> | null;
|
|
13
|
+
createCache: ExtractDependencyType<typeof CREATE_CACHE_TOKEN> | null;
|
|
14
14
|
makeRequestRegistry: Map<string, MakeRequest>;
|
|
15
|
-
agent
|
|
16
|
-
querySerializer?: QuerySerializer;
|
|
17
|
-
disableCircuitBreaker: ExtractDependencyType<typeof DISABLE_CIRCUIT_BREAKER
|
|
18
|
-
defaultOptions
|
|
19
|
-
commandLineExecutionContext
|
|
15
|
+
agent: ExtractDependencyType<typeof HTTP_CLIENT_AGENT> | null;
|
|
16
|
+
querySerializer?: QuerySerializer | undefined;
|
|
17
|
+
disableCircuitBreaker: ExtractDependencyType<typeof DISABLE_CIRCUIT_BREAKER> | null;
|
|
18
|
+
defaultOptions: Partial<HttpClientFactoryOptions> | null;
|
|
19
|
+
commandLineExecutionContext: ExtractDependencyType<typeof COMMAND_LINE_EXECUTION_CONTEXT_TOKEN> | null;
|
|
20
20
|
}) => ExtractTokenType<typeof HTTP_CLIENT_FACTORY>;
|
package/lib/index.es.js
CHANGED
|
@@ -133,7 +133,8 @@ class PapiService extends BaseHttpClient {
|
|
|
133
133
|
this.di = di;
|
|
134
134
|
}
|
|
135
135
|
async request({ path, query, body }) {
|
|
136
|
-
|
|
136
|
+
var _a;
|
|
137
|
+
const papiRoute = find((papi) => getPapiParameters(papi).path === `/${path}`, (_a = this.papi) !== null && _a !== void 0 ? _a : []);
|
|
137
138
|
if (!papiRoute) {
|
|
138
139
|
throw new Error(`papi handler '${path}' not found`);
|
|
139
140
|
}
|
|
@@ -163,7 +164,7 @@ const PapiClientModule = /* @__PURE__ */ Module({
|
|
|
163
164
|
useClass: PapiService,
|
|
164
165
|
deps: {
|
|
165
166
|
di: DI_TOKEN,
|
|
166
|
-
papi: { token: SERVER_MODULE_PAPI_PUBLIC_ROUTE, optional: true
|
|
167
|
+
papi: { token: SERVER_MODULE_PAPI_PUBLIC_ROUTE, optional: true },
|
|
167
168
|
},
|
|
168
169
|
}),
|
|
169
170
|
],
|
package/lib/index.js
CHANGED
|
@@ -144,7 +144,8 @@ class PapiService extends httpClient.BaseHttpClient {
|
|
|
144
144
|
this.di = di;
|
|
145
145
|
}
|
|
146
146
|
async request({ path, query, body }) {
|
|
147
|
-
|
|
147
|
+
var _a;
|
|
148
|
+
const papiRoute = find__default["default"]((papi$1) => papi.getPapiParameters(papi$1).path === `/${path}`, (_a = this.papi) !== null && _a !== void 0 ? _a : []);
|
|
148
149
|
if (!papiRoute) {
|
|
149
150
|
throw new Error(`papi handler '${path}' not found`);
|
|
150
151
|
}
|
|
@@ -174,7 +175,7 @@ const PapiClientModule = /* @__PURE__ */ core.Module({
|
|
|
174
175
|
useClass: PapiService,
|
|
175
176
|
deps: {
|
|
176
177
|
di: core.DI_TOKEN,
|
|
177
|
-
papi: { token: tokensServer.SERVER_MODULE_PAPI_PUBLIC_ROUTE, optional: true
|
|
178
|
+
papi: { token: tokensServer.SERVER_MODULE_PAPI_PUBLIC_ROUTE, optional: true },
|
|
178
179
|
},
|
|
179
180
|
}),
|
|
180
181
|
],
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { DI_TOKEN } from '@tramvai/core';
|
|
2
2
|
import type { HttpClientRequest, HttpClientResponse } from '@tramvai/http-client';
|
|
3
3
|
import { BaseHttpClient } from '@tramvai/http-client';
|
|
4
|
+
import type { ExtractDependencyType } from '@tinkoff/dippy';
|
|
4
5
|
import type { SERVER_MODULE_PAPI_PUBLIC_ROUTE } from '@tramvai/tokens-server';
|
|
5
6
|
export interface Deps {
|
|
6
|
-
di: typeof DI_TOKEN
|
|
7
|
-
papi
|
|
7
|
+
di: ExtractDependencyType<typeof DI_TOKEN>;
|
|
8
|
+
papi: ExtractDependencyType<typeof SERVER_MODULE_PAPI_PUBLIC_ROUTE> | null;
|
|
8
9
|
}
|
|
9
10
|
export declare class PapiService extends BaseHttpClient {
|
|
10
11
|
papi: Deps['papi'];
|
|
@@ -5,7 +5,7 @@ type Options = Parameters<typeof getDiWrapper>[0] & {
|
|
|
5
5
|
};
|
|
6
6
|
export declare const testApi: (options: Options) => {
|
|
7
7
|
di: import("@tinkoff/dippy").Container;
|
|
8
|
-
fetchMock: jest.Mock<
|
|
8
|
+
fetchMock: jest.Mock<Promise<import("node-fetch").Response>, [url: import("node-fetch").RequestInfo, init?: import("node-fetch").RequestInit | undefined]>;
|
|
9
9
|
mockJsonResponse: (body: Record<string, any>, init?: ResponseInit) => Promise<void>;
|
|
10
10
|
clearCaches: () => void;
|
|
11
11
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
1
|
+
import type { HttpClientRequest } from '@tramvai/http-client';
|
|
2
|
+
export declare const fillHeaders: (deps: any) => (params: HttpClientRequest) => HttpClientRequest;
|
|
3
|
+
export declare const fillHeaderIp: (deps: any) => (params: HttpClientRequest) => HttpClientRequest;
|
|
@@ -3,9 +3,9 @@ import type { API_CLIENT_PASS_HEADERS } from '@tramvai/tokens-http-client';
|
|
|
3
3
|
import type { HttpClientRequest } from '@tramvai/http-client';
|
|
4
4
|
import type { ExtractDependencyType } from '@tinkoff/dippy';
|
|
5
5
|
export declare const fillHeaderIp: ({ requestManager, }: {
|
|
6
|
-
requestManager
|
|
6
|
+
requestManager: ExtractDependencyType<typeof REQUEST_MANAGER_TOKEN> | null;
|
|
7
7
|
}) => (params: HttpClientRequest) => HttpClientRequest;
|
|
8
8
|
export declare const fillHeaders: ({ requestManager, headersList, }: {
|
|
9
|
-
requestManager
|
|
10
|
-
headersList: ExtractDependencyType<typeof API_CLIENT_PASS_HEADERS
|
|
9
|
+
requestManager: ExtractDependencyType<typeof REQUEST_MANAGER_TOKEN> | null;
|
|
10
|
+
headersList: ExtractDependencyType<typeof API_CLIENT_PASS_HEADERS> | null;
|
|
11
11
|
}) => (params: HttpClientRequest) => HttpClientRequest;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-http-client",
|
|
3
|
-
"version": "2.56.
|
|
3
|
+
"version": "2.56.5",
|
|
4
4
|
"initialVersion": "0.58.99",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -27,25 +27,26 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@tramvai/http-client": "0.2.5",
|
|
30
|
-
"@tramvai/tinkoff-request-http-client-adapter": "0.9.
|
|
31
|
-
"@tramvai/tokens-http-client": "2.56.
|
|
32
|
-
"@tramvai/tokens-common": "2.56.
|
|
33
|
-
"@tramvai/tokens-server": "2.56.
|
|
34
|
-
"@tramvai/tokens-server-private": "2.56.
|
|
30
|
+
"@tramvai/tinkoff-request-http-client-adapter": "0.9.137",
|
|
31
|
+
"@tramvai/tokens-http-client": "2.56.5",
|
|
32
|
+
"@tramvai/tokens-common": "2.56.5",
|
|
33
|
+
"@tramvai/tokens-server": "2.56.5",
|
|
34
|
+
"@tramvai/tokens-server-private": "2.56.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@tinkoff/request-core": "^0.9.2",
|
|
38
|
-
"@tinkoff/request-plugin-protocol-http": "^0.11.6"
|
|
38
|
+
"@tinkoff/request-plugin-protocol-http": "^0.11.6",
|
|
39
|
+
"@types/node-fetch": "^2.6.2"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"@tinkoff/utils": "^2.1.2",
|
|
42
|
-
"@tramvai/core": "2.56.
|
|
43
|
-
"@tramvai/module-common": "2.56.
|
|
44
|
-
"@tramvai/papi": "2.56.
|
|
45
|
-
"@tramvai/test-helpers": "2.56.
|
|
46
|
-
"@tramvai/test-unit": "2.56.
|
|
47
|
-
"@tramvai/test-mocks": "2.56.
|
|
48
|
-
"@tinkoff/dippy": "0.8.
|
|
43
|
+
"@tramvai/core": "2.56.5",
|
|
44
|
+
"@tramvai/module-common": "2.56.5",
|
|
45
|
+
"@tramvai/papi": "2.56.5",
|
|
46
|
+
"@tramvai/test-helpers": "2.56.5",
|
|
47
|
+
"@tramvai/test-unit": "2.56.5",
|
|
48
|
+
"@tramvai/test-mocks": "2.56.5",
|
|
49
|
+
"@tinkoff/dippy": "0.8.11",
|
|
49
50
|
"node-fetch": "^2.6.1",
|
|
50
51
|
"tslib": "^2.4.0"
|
|
51
52
|
},
|
package/tests.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ type Options = Parameters<typeof getDiWrapper>[0] & {
|
|
|
6
6
|
};
|
|
7
7
|
declare const testApi: (options: Options) => {
|
|
8
8
|
di: import("@tinkoff/dippy").Container;
|
|
9
|
-
fetchMock: jest.Mock<
|
|
9
|
+
fetchMock: jest.Mock<Promise<import("node-fetch").Response>, [
|
|
10
|
+
url: import("node-fetch").RequestInfo,
|
|
11
|
+
init?: import("node-fetch").RequestInit | undefined
|
|
12
|
+
]>;
|
|
10
13
|
mockJsonResponse: (body: Record<string, any>, init?: ResponseInit) => Promise<void>;
|
|
11
14
|
clearCaches: () => void;
|
|
12
15
|
};
|
package/tests.js
CHANGED
|
@@ -148,7 +148,8 @@ class PapiService extends httpClient.BaseHttpClient {
|
|
|
148
148
|
this.di = di;
|
|
149
149
|
}
|
|
150
150
|
async request({ path, query, body }) {
|
|
151
|
-
|
|
151
|
+
var _a;
|
|
152
|
+
const papiRoute = find__default["default"]((papi$1) => papi.getPapiParameters(papi$1).path === `/${path}`, (_a = this.papi) !== null && _a !== void 0 ? _a : []);
|
|
152
153
|
if (!papiRoute) {
|
|
153
154
|
throw new Error(`papi handler '${path}' not found`);
|
|
154
155
|
}
|
|
@@ -178,7 +179,7 @@ const PapiClientModule = /* @__PURE__ */ core.Module({
|
|
|
178
179
|
useClass: PapiService,
|
|
179
180
|
deps: {
|
|
180
181
|
di: core.DI_TOKEN,
|
|
181
|
-
papi: { token: tokensServer.SERVER_MODULE_PAPI_PUBLIC_ROUTE, optional: true
|
|
182
|
+
papi: { token: tokensServer.SERVER_MODULE_PAPI_PUBLIC_ROUTE, optional: true },
|
|
182
183
|
},
|
|
183
184
|
}),
|
|
184
185
|
],
|