@tramvai/tinkoff-request-http-client-adapter 0.8.328 → 0.8.331
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/httpClientAdapter.d.ts +3 -3
- package/lib/index.browser.js +6 -6
- package/lib/index.es.js +6 -6
- package/lib/index.js +6 -6
- package/package.json +2 -2
|
@@ -3,10 +3,10 @@ import { BaseHttpClient } from '@tramvai/http-client';
|
|
|
3
3
|
import type { HttpClient, HttpClientBaseOptions, HttpClientRequest, HttpClientResponse } from '@tramvai/http-client';
|
|
4
4
|
export declare class HttpClientAdapter extends BaseHttpClient implements HttpClient {
|
|
5
5
|
private options;
|
|
6
|
-
private
|
|
7
|
-
constructor({ options,
|
|
6
|
+
private makeRequest;
|
|
7
|
+
constructor({ options, makeRequest, }: {
|
|
8
8
|
options: HttpClientBaseOptions;
|
|
9
|
-
|
|
9
|
+
makeRequest: MakeRequest;
|
|
10
10
|
});
|
|
11
11
|
request<R = any>(req: HttpClientRequest): Promise<HttpClientResponse<R>>;
|
|
12
12
|
fork(forkOptions?: HttpClientRequest, mergeOptionsConfig?: {
|
package/lib/index.browser.js
CHANGED
|
@@ -138,10 +138,10 @@ function mergeOptions(options, nextOptions, config) {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
class HttpClientAdapter extends BaseHttpClient {
|
|
141
|
-
constructor({ options,
|
|
141
|
+
constructor({ options, makeRequest, }) {
|
|
142
142
|
super();
|
|
143
143
|
this.options = options;
|
|
144
|
-
this.
|
|
144
|
+
this.makeRequest = makeRequest;
|
|
145
145
|
}
|
|
146
146
|
async request(req) {
|
|
147
147
|
// применяем дефолтные опции до вызова modifyRequest на объекте запроса
|
|
@@ -159,7 +159,7 @@ class HttpClientAdapter extends BaseHttpClient {
|
|
|
159
159
|
if (requestType) {
|
|
160
160
|
adaptedReq.type = requestType;
|
|
161
161
|
}
|
|
162
|
-
const res = this.
|
|
162
|
+
const res = this.makeRequest(adaptedReq);
|
|
163
163
|
try {
|
|
164
164
|
const payload = await res;
|
|
165
165
|
const status = getStatus(res);
|
|
@@ -181,14 +181,14 @@ class HttpClientAdapter extends BaseHttpClient {
|
|
|
181
181
|
fork(forkOptions = {}, mergeOptionsConfig = {}) {
|
|
182
182
|
return new HttpClientAdapter({
|
|
183
183
|
options: mergeOptions(this.options, forkOptions, mergeOptionsConfig),
|
|
184
|
-
|
|
184
|
+
makeRequest: this.makeRequest,
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
function createAdapter(options) {
|
|
190
|
-
const
|
|
191
|
-
const httpClientAdapter = new HttpClientAdapter({ options,
|
|
190
|
+
const makeRequest = createTinkoffRequest(options);
|
|
191
|
+
const httpClientAdapter = new HttpClientAdapter({ options, makeRequest });
|
|
192
192
|
return httpClientAdapter;
|
|
193
193
|
}
|
|
194
194
|
|
package/lib/index.es.js
CHANGED
|
@@ -148,10 +148,10 @@ function mergeOptions(options, nextOptions, config) {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
class HttpClientAdapter extends BaseHttpClient {
|
|
151
|
-
constructor({ options,
|
|
151
|
+
constructor({ options, makeRequest, }) {
|
|
152
152
|
super();
|
|
153
153
|
this.options = options;
|
|
154
|
-
this.
|
|
154
|
+
this.makeRequest = makeRequest;
|
|
155
155
|
}
|
|
156
156
|
async request(req) {
|
|
157
157
|
// применяем дефолтные опции до вызова modifyRequest на объекте запроса
|
|
@@ -169,7 +169,7 @@ class HttpClientAdapter extends BaseHttpClient {
|
|
|
169
169
|
if (requestType) {
|
|
170
170
|
adaptedReq.type = requestType;
|
|
171
171
|
}
|
|
172
|
-
const res = this.
|
|
172
|
+
const res = this.makeRequest(adaptedReq);
|
|
173
173
|
try {
|
|
174
174
|
const payload = await res;
|
|
175
175
|
const status = getStatus(res);
|
|
@@ -191,14 +191,14 @@ class HttpClientAdapter extends BaseHttpClient {
|
|
|
191
191
|
fork(forkOptions = {}, mergeOptionsConfig = {}) {
|
|
192
192
|
return new HttpClientAdapter({
|
|
193
193
|
options: mergeOptions(this.options, forkOptions, mergeOptionsConfig),
|
|
194
|
-
|
|
194
|
+
makeRequest: this.makeRequest,
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
function createAdapter(options) {
|
|
200
|
-
const
|
|
201
|
-
const httpClientAdapter = new HttpClientAdapter({ options,
|
|
200
|
+
const makeRequest = createTinkoffRequest(options);
|
|
201
|
+
const httpClientAdapter = new HttpClientAdapter({ options, makeRequest });
|
|
202
202
|
return httpClientAdapter;
|
|
203
203
|
}
|
|
204
204
|
|
package/lib/index.js
CHANGED
|
@@ -167,10 +167,10 @@ function mergeOptions(options, nextOptions, config) {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
class HttpClientAdapter extends httpClient.BaseHttpClient {
|
|
170
|
-
constructor({ options,
|
|
170
|
+
constructor({ options, makeRequest, }) {
|
|
171
171
|
super();
|
|
172
172
|
this.options = options;
|
|
173
|
-
this.
|
|
173
|
+
this.makeRequest = makeRequest;
|
|
174
174
|
}
|
|
175
175
|
async request(req) {
|
|
176
176
|
// применяем дефолтные опции до вызова modifyRequest на объекте запроса
|
|
@@ -188,7 +188,7 @@ class HttpClientAdapter extends httpClient.BaseHttpClient {
|
|
|
188
188
|
if (requestType) {
|
|
189
189
|
adaptedReq.type = requestType;
|
|
190
190
|
}
|
|
191
|
-
const res = this.
|
|
191
|
+
const res = this.makeRequest(adaptedReq);
|
|
192
192
|
try {
|
|
193
193
|
const payload = await res;
|
|
194
194
|
const status = http$1.getStatus(res);
|
|
@@ -210,14 +210,14 @@ class HttpClientAdapter extends httpClient.BaseHttpClient {
|
|
|
210
210
|
fork(forkOptions = {}, mergeOptionsConfig = {}) {
|
|
211
211
|
return new HttpClientAdapter({
|
|
212
212
|
options: mergeOptions(this.options, forkOptions, mergeOptionsConfig),
|
|
213
|
-
|
|
213
|
+
makeRequest: this.makeRequest,
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
function createAdapter(options) {
|
|
219
|
-
const
|
|
220
|
-
const httpClientAdapter = new HttpClientAdapter({ options,
|
|
219
|
+
const makeRequest = createTinkoffRequest(options);
|
|
220
|
+
const httpClientAdapter = new HttpClientAdapter({ options, makeRequest });
|
|
221
221
|
return httpClientAdapter;
|
|
222
222
|
}
|
|
223
223
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tinkoff-request-http-client-adapter",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.331",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@tinkoff/request-plugin-validate": "^0.8.8",
|
|
32
32
|
"@tinkoff/utils": "^2.1.2",
|
|
33
33
|
"@tramvai/http-client": "0.1.25",
|
|
34
|
-
"@tramvai/tokens-common": "1.94.
|
|
34
|
+
"@tramvai/tokens-common": "1.94.5",
|
|
35
35
|
"tslib": "^2.0.3"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|