hyperttp 0.4.9 → 0.4.10
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/Hyperttp/Client/HyperClient.d.ts +8 -0
- package/Hyperttp/Client/HyperClient.d.ts.map +1 -1
- package/Hyperttp/Client/HyperClient.js +2 -361
- package/Hyperttp/Client/HyperClient.js.map +7 -1
- package/Hyperttp/Request.d.ts +2 -2
- package/Hyperttp/Request.d.ts.map +1 -1
- package/Hyperttp/Request.js +2 -406
- package/Hyperttp/Request.js.map +7 -1
- package/Hyperttp/UrlExtractor.js +2 -123
- package/Hyperttp/UrlExtractor.js.map +7 -1
- package/Hyperttp/Utils/RequestBuilder.d.ts.map +1 -1
- package/Hyperttp/Utils/RequestBuilder.js +2 -298
- package/Hyperttp/Utils/RequestBuilder.js.map +7 -1
- package/Hyperttp/Utils/index.d.ts +1 -0
- package/Hyperttp/Utils/index.d.ts.map +1 -1
- package/Hyperttp/Utils/index.js +2 -2
- package/Hyperttp/Utils/index.js.map +7 -1
- package/Hyperttp/Utils/query.d.ts +3 -0
- package/Hyperttp/Utils/query.d.ts.map +1 -0
- package/Hyperttp/Utils/query.js +2 -0
- package/Hyperttp/Utils/query.js.map +7 -0
- package/Hyperttp/defaultConfig.js +2 -38
- package/Hyperttp/defaultConfig.js.map +7 -1
- package/Hyperttp/index.js +2 -6
- package/Hyperttp/index.js.map +7 -1
- package/README.md +1 -2
- package/Types/index.js +2 -2
- package/Types/index.js.map +7 -1
- package/Types/url-extractor.js +2 -2
- package/Types/url-extractor.js.map +7 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -11
- package/index.js.map +7 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResponseType, HttpClientOptions, RequestBodyData, RequestInterface, HyperPlugin, RequestMetrics, HyperTransport } from "@hyperttp/types";
|
|
2
|
+
import { RequestBuilder } from "../Utils/RequestBuilder.js";
|
|
2
3
|
/**
|
|
3
4
|
* @ru Высокоуровневый HTTP-клиент с автоматической регистрацией плагинов
|
|
4
5
|
* (сериализация, парсинг, очередь, rate limit, inflight, кэш, перехватчики, метрики).
|
|
@@ -136,6 +137,13 @@ export declare class HyperClient {
|
|
|
136
137
|
* @returns Promise resolving to the stream response.
|
|
137
138
|
*/
|
|
138
139
|
stream(req: RequestInterface | string, signal?: AbortSignal): Promise<import("@hyperttp/types").StreamResponse<unknown>>;
|
|
140
|
+
/**
|
|
141
|
+
* @ru Возвращает построитель запросов для цепочечного формирования HTTP-запроса.
|
|
142
|
+
* @en Returns a request builder for chainable HTTP request composition.
|
|
143
|
+
* @param url - Target URL for the request.
|
|
144
|
+
* @returns A RequestBuilder instance bound to this client.
|
|
145
|
+
*/
|
|
146
|
+
request(url: string): RequestBuilder;
|
|
139
147
|
/**
|
|
140
148
|
* @ru Создаёт новый экземпляр клиента, объединяя текущую конфигурацию с переданными опциями.
|
|
141
149
|
* @en Creates a new client instance by merging the current configuration with provided options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperClient.d.ts","sourceRoot":"","sources":["../../../src/Hyperttp/Client/HyperClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAEhB,WAAW,
|
|
1
|
+
{"version":3,"file":"HyperClient.d.ts","sourceRoot":"","sources":["../../../src/Hyperttp/Client/HyperClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAEhB,WAAW,EAEX,cAAc,EACd,cAAc,EACf,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA0B5D;;;;;;;GAOG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC,OAAO,CAAC,QAAQ,CAAC,OA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;;;OAKG;IACI,YAAY,IAAI,IAAI;CAG5B"}
|
|
@@ -1,361 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { withParser } from "@hyperttp/parser";
|
|
4
|
-
import { withSerializer } from "@hyperttp/serializer";
|
|
5
|
-
import { withQueue } from "@hyperttp/queue";
|
|
6
|
-
import { withCache } from "@hyperttp/cache";
|
|
7
|
-
import { withRateLimit } from "@hyperttp/ratelimit";
|
|
8
|
-
import { withInflight } from "@hyperttp/inflight";
|
|
9
|
-
import { withInterceptors } from "@hyperttp/interceptors";
|
|
10
|
-
import { withMetrics } from "@hyperttp/metrics";
|
|
11
|
-
const EMPTY_HEADERS = Object.freeze({});
|
|
12
|
-
/**
|
|
13
|
-
* @ru Высокоуровневый HTTP-клиент с автоматической регистрацией плагинов
|
|
14
|
-
* (сериализация, парсинг, очередь, rate limit, inflight, кэш, перехватчики, метрики).
|
|
15
|
-
* Делегирует выполнение запросов ядру HyperCore и извлекает тело ответа.
|
|
16
|
-
* @en High-level HTTP client with automatic plugin registration
|
|
17
|
-
* (serialization, parsing, queue, rate limit, inflight, cache, interceptors, metrics).
|
|
18
|
-
* Delegates request execution to the HyperCore core and extracts the response body.
|
|
19
|
-
*/
|
|
20
|
-
export class HyperClient {
|
|
21
|
-
_engine;
|
|
22
|
-
_config;
|
|
23
|
-
/**
|
|
24
|
-
* @ru Создаёт экземпляр HyperClient и регистрирует все стандартные плагины.
|
|
25
|
-
* @en Creates a HyperClient instance and registers all standard plugins.
|
|
26
|
-
* @param config - Client configuration options.
|
|
27
|
-
*/
|
|
28
|
-
constructor(config = defaultConfig, transport) {
|
|
29
|
-
this._config = {
|
|
30
|
-
...defaultConfig,
|
|
31
|
-
...config,
|
|
32
|
-
network: { ...defaultConfig.network, ...config.network },
|
|
33
|
-
};
|
|
34
|
-
this._engine = new HyperCore(this._config, transport);
|
|
35
|
-
this._engine.use(withSerializer());
|
|
36
|
-
this._engine.use(withParser(this._config.responseConverter));
|
|
37
|
-
this._engine.use(withQueue());
|
|
38
|
-
this._engine.use(withRateLimit(this._config.rateLimit));
|
|
39
|
-
this._engine.use(withInflight(this._config.inflight));
|
|
40
|
-
this._engine.use(withCache(this._config.cache));
|
|
41
|
-
this._engine.use(withInterceptors());
|
|
42
|
-
this._engine.use(withMetrics(this._config.metrics));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @ru Регистрирует дополнительный плагин в клиенте.
|
|
46
|
-
* @en Registers an additional plugin in the client.
|
|
47
|
-
* @param plugin - Plugin instance to register.
|
|
48
|
-
* @returns The current instance for chaining.
|
|
49
|
-
*/
|
|
50
|
-
use(plugin) {
|
|
51
|
-
this._engine.use(plugin);
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @ru Возвращает имя класса активного транспорта.
|
|
56
|
-
* @en Returns the class name of the active transport.
|
|
57
|
-
* @returns Promise resolving to the transport class name.
|
|
58
|
-
*/
|
|
59
|
-
async getTransportName() {
|
|
60
|
-
return this._engine.getTransportName();
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* @ru Строит RequestInterface, правильно извлекая данные из геттеров старого класса Request.
|
|
64
|
-
* @en Builds RequestInterface, correctly extracting data from getters of the old Request class.
|
|
65
|
-
* @param req - Request URL or configuration object.
|
|
66
|
-
* @param responseType - Response parsing strategy.
|
|
67
|
-
* @param body - Optional request body.
|
|
68
|
-
* @param signal - Optional abort signal.
|
|
69
|
-
* @returns Normalized RequestInterface ready for dispatching.
|
|
70
|
-
*/
|
|
71
|
-
_buildRequest(req, responseType, body, signal) {
|
|
72
|
-
if (typeof req === "string") {
|
|
73
|
-
return {
|
|
74
|
-
url: req,
|
|
75
|
-
headers: EMPTY_HEADERS,
|
|
76
|
-
body,
|
|
77
|
-
signal,
|
|
78
|
-
meta: { responseType },
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
const r = req;
|
|
82
|
-
const url = req.url ?? r.getURL?.() ?? "";
|
|
83
|
-
const headers = req.headers ?? r.getHeaders?.() ?? EMPTY_HEADERS;
|
|
84
|
-
const extractedBody = body ?? r.body ?? r.bodyData ?? r._bodyData ?? r.getBodyData?.() ?? r.getBodyDataString?.();
|
|
85
|
-
const extractedSignal = signal ?? req.signal ?? r.getSignal?.();
|
|
86
|
-
let finalUrl = url;
|
|
87
|
-
const query = req.query ?? r.getQuery?.();
|
|
88
|
-
if (query && Object.keys(query).length > 0) {
|
|
89
|
-
try {
|
|
90
|
-
const urlObj = new URL(finalUrl);
|
|
91
|
-
for (const k in query) {
|
|
92
|
-
if (Object.prototype.hasOwnProperty.call(query, k)) {
|
|
93
|
-
const v = query[k];
|
|
94
|
-
if (v == null)
|
|
95
|
-
continue;
|
|
96
|
-
if (Array.isArray(v)) {
|
|
97
|
-
for (const item of v) {
|
|
98
|
-
if (item != null)
|
|
99
|
-
urlObj.searchParams.append(k, String(item));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
urlObj.searchParams.set(k, String(v));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
finalUrl = urlObj.toString();
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
const qs = r.getQueryAsString?.();
|
|
111
|
-
if (qs)
|
|
112
|
-
finalUrl += qs;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
const qs = r.getQueryAsString?.();
|
|
117
|
-
if (qs)
|
|
118
|
-
finalUrl += qs;
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
url: finalUrl,
|
|
122
|
-
headers,
|
|
123
|
-
body: extractedBody,
|
|
124
|
-
signal: extractedSignal,
|
|
125
|
-
meta: { ...req.meta, responseType },
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @ru Выполняет HTTP-запрос через ядро и возвращает распарсенное тело ответа.
|
|
130
|
-
* Плагин withParser автоматически парсит тело на основе meta.responseType.
|
|
131
|
-
* @en Executes an HTTP request through the core and returns the parsed response body.
|
|
132
|
-
* The withParser plugin automatically parses the body based on meta.responseType.
|
|
133
|
-
* @template T - Expected response body type.
|
|
134
|
-
* @param method - HTTP method (GET, POST, etc.).
|
|
135
|
-
* @param req - Request URL or configuration object.
|
|
136
|
-
* @param responseType - Response parsing strategy.
|
|
137
|
-
* @param body - Optional request body.
|
|
138
|
-
* @param signal - Optional abort signal.
|
|
139
|
-
* @returns Promise resolving to the parsed response body.
|
|
140
|
-
*/
|
|
141
|
-
async _execute(method, req, responseType = "auto", body, signal) {
|
|
142
|
-
const request = this._buildRequest(req, responseType, body, signal);
|
|
143
|
-
let response;
|
|
144
|
-
switch (method) {
|
|
145
|
-
case "GET":
|
|
146
|
-
response = await this._engine.get(request, signal);
|
|
147
|
-
break;
|
|
148
|
-
case "POST":
|
|
149
|
-
response = await this._engine.post(request, request.body, signal);
|
|
150
|
-
break;
|
|
151
|
-
case "PUT":
|
|
152
|
-
response = await this._engine.put(request, request.body, signal);
|
|
153
|
-
break;
|
|
154
|
-
case "PATCH":
|
|
155
|
-
response = await this._engine.patch(request, request.body, signal);
|
|
156
|
-
break;
|
|
157
|
-
case "DELETE":
|
|
158
|
-
response = await this._engine.delete(request, signal);
|
|
159
|
-
break;
|
|
160
|
-
case "OPTIONS":
|
|
161
|
-
response = await this._engine.options(request, request.body, signal);
|
|
162
|
-
break;
|
|
163
|
-
case "HEAD":
|
|
164
|
-
response = await this._engine.head(request, signal);
|
|
165
|
-
break;
|
|
166
|
-
default:
|
|
167
|
-
response = await this._engine.get(request, signal);
|
|
168
|
-
}
|
|
169
|
-
return response.body;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* @ru Выполняет GET-запрос и возвращает распарсенный ответ.
|
|
173
|
-
* @en Performs a GET request and returns the parsed response.
|
|
174
|
-
* @template T - Expected response body type.
|
|
175
|
-
* @param req - Request URL or configuration object.
|
|
176
|
-
* @param responseType - Response parsing strategy ('auto', 'json', 'text', 'stream', 'buffer', 'blob', 'xml', 'html').
|
|
177
|
-
* @param signal - Optional abort signal.
|
|
178
|
-
* @returns Promise resolving to the parsed response body.
|
|
179
|
-
*/
|
|
180
|
-
get(req, responseType = "auto", signal) {
|
|
181
|
-
return this._execute("GET", req, responseType, undefined, signal);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* @ru Выполняет POST-запрос и возвращает распарсенный ответ.
|
|
185
|
-
* @en Performs a POST request and returns the parsed response.
|
|
186
|
-
* @template T - Expected response body type.
|
|
187
|
-
* @param req - Request URL or configuration object.
|
|
188
|
-
* @param responseType - Response parsing strategy.
|
|
189
|
-
* @param body - Request body data.
|
|
190
|
-
* @param signal - Optional abort signal.
|
|
191
|
-
* @returns Promise resolving to the parsed response body.
|
|
192
|
-
*/
|
|
193
|
-
post(req, responseType = "auto", body, signal) {
|
|
194
|
-
return this._execute("POST", req, responseType, body, signal);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* @ru Выполняет PUT-запрос и возвращает распарсенный ответ.
|
|
198
|
-
* @en Performs a PUT request and returns the parsed response.
|
|
199
|
-
* @template T - Expected response body type.
|
|
200
|
-
* @param req - Request URL or configuration object.
|
|
201
|
-
* @param responseType - Response parsing strategy.
|
|
202
|
-
* @param body - Request body data.
|
|
203
|
-
* @param signal - Optional abort signal.
|
|
204
|
-
* @returns Promise resolving to the parsed response body.
|
|
205
|
-
*/
|
|
206
|
-
put(req, responseType = "auto", body, signal) {
|
|
207
|
-
return this._execute("PUT", req, responseType, body, signal);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* @ru Выполняет PATCH-запрос и возвращает распарсенный ответ.
|
|
211
|
-
* @en Performs a PATCH request and returns the parsed response.
|
|
212
|
-
* @template T - Expected response body type.
|
|
213
|
-
* @param req - Request URL or configuration object.
|
|
214
|
-
* @param responseType - Response parsing strategy.
|
|
215
|
-
* @param body - Request body data.
|
|
216
|
-
* @param signal - Optional abort signal.
|
|
217
|
-
* @returns Promise resolving to the parsed response body.
|
|
218
|
-
*/
|
|
219
|
-
patch(req, responseType = "auto", body, signal) {
|
|
220
|
-
return this._execute("PATCH", req, responseType, body, signal);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @ru Выполняет DELETE-запрос и возвращает распарсенный ответ.
|
|
224
|
-
* @en Performs a DELETE request and returns the parsed response.
|
|
225
|
-
* @template T - Expected response body type.
|
|
226
|
-
* @param req - Request URL or configuration object.
|
|
227
|
-
* @param responseType - Response parsing strategy.
|
|
228
|
-
* @param signal - Optional abort signal.
|
|
229
|
-
* @returns Promise resolving to the parsed response body.
|
|
230
|
-
*/
|
|
231
|
-
delete(req, responseType = "auto", signal) {
|
|
232
|
-
return this._execute("DELETE", req, responseType, undefined, signal);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* @ru Выполняет OPTIONS-запрос и возвращает распарсенный ответ.
|
|
236
|
-
* @en Performs an OPTIONS request and returns the parsed response.
|
|
237
|
-
* @template T - Expected response body type.
|
|
238
|
-
* @param req - Request URL or configuration object.
|
|
239
|
-
* @param responseType - Response parsing strategy.
|
|
240
|
-
* @param body - Optional request body data.
|
|
241
|
-
* @param signal - Optional abort signal.
|
|
242
|
-
* @returns Promise resolving to the parsed response body.
|
|
243
|
-
*/
|
|
244
|
-
options(req, responseType = "auto", body, signal) {
|
|
245
|
-
return this._execute("OPTIONS", req, responseType, body, signal);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* @ru Выполняет HEAD-запрос и возвращает статус и заголовки (без тела).
|
|
249
|
-
* @en Performs a HEAD request and returns status and headers (no body).
|
|
250
|
-
* @param req - Request URL or configuration object.
|
|
251
|
-
* @param signal - Optional abort signal.
|
|
252
|
-
* @returns Promise resolving to an object with status and headers.
|
|
253
|
-
*/
|
|
254
|
-
async head(req, signal) {
|
|
255
|
-
const request = this._buildRequest(req, "auto", undefined, signal);
|
|
256
|
-
const response = await this._engine.head(request, signal);
|
|
257
|
-
return {
|
|
258
|
-
status: response.status,
|
|
259
|
-
headers: response.headers,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* @ru Выполняет потоковый GET-запрос. Тело ответа возвращается как ReadableStream.
|
|
264
|
-
* @en Performs a streaming GET request. Response body is returned as a ReadableStream.
|
|
265
|
-
* @param req - Request URL or configuration object.
|
|
266
|
-
* @param signal - Optional abort signal.
|
|
267
|
-
* @returns Promise resolving to the stream response.
|
|
268
|
-
*/
|
|
269
|
-
stream(req, signal) {
|
|
270
|
-
return this._engine.stream(req, signal);
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @ru Создаёт новый экземпляр клиента, объединяя текущую конфигурацию с переданными опциями.
|
|
274
|
-
* @en Creates a new client instance by merging the current configuration with provided options.
|
|
275
|
-
* @param options - Partial configuration options to extend.
|
|
276
|
-
* @returns A new HyperClient instance.
|
|
277
|
-
*/
|
|
278
|
-
extend(options) {
|
|
279
|
-
return new HyperClient({
|
|
280
|
-
...this._config,
|
|
281
|
-
...options,
|
|
282
|
-
network: { ...this._config.network, ...options.network },
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* @ru Алиас для extend(). Создаёт новый экземпляр клиента.
|
|
287
|
-
* @en Alias for extend(). Creates a new client instance.
|
|
288
|
-
* @param options - Partial configuration options.
|
|
289
|
-
* @returns A new HyperClient instance.
|
|
290
|
-
*/
|
|
291
|
-
create(options) {
|
|
292
|
-
return this.extend(options);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* @ru Завершает работу клиента и освобождает ресурсы (соединения, пулы, плагины).
|
|
296
|
-
* @en Shuts down the client and releases resources (connections, pools, plugins).
|
|
297
|
-
* @returns Promise that resolves when shutdown is complete.
|
|
298
|
-
*/
|
|
299
|
-
async destroy() {
|
|
300
|
-
await this._engine.destroy();
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* @ru Возвращает статистику работы клиента (активные соединения, очередь, кэш).
|
|
304
|
-
* Требует наличия плагина метрик или очереди.
|
|
305
|
-
* @en Returns client statistics (active connections, queue, cache).
|
|
306
|
-
* Requires metrics or queue plugin to be registered.
|
|
307
|
-
* @returns Statistics object, or undefined if no plugin provides it.
|
|
308
|
-
*/
|
|
309
|
-
getStats() {
|
|
310
|
-
return this._engine.getStats?.();
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* @ru Возвращает все агрегированные метрики (latency, RPS, cache hits и т.д.).
|
|
314
|
-
* Требует наличия плагина `withMetrics`.
|
|
315
|
-
* @en Returns all aggregated metrics (latency, RPS, cache hits, etc.).
|
|
316
|
-
* Requires the `withMetrics` plugin to be registered.
|
|
317
|
-
* @returns Array of metrics, or undefined if the plugin is not registered.
|
|
318
|
-
*/
|
|
319
|
-
getAllMetrics() {
|
|
320
|
-
return this._engine.getAllMetrics?.();
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* @ru Возвращает конкретную метрику по ключу.
|
|
324
|
-
* Требует наличия плагина `withMetrics`.
|
|
325
|
-
* @en Returns a specific metric by key.
|
|
326
|
-
* Requires the `withMetrics` plugin to be registered.
|
|
327
|
-
* @param key - Metric key (e.g., 'rps', 'avgLatency', 'cacheHits').
|
|
328
|
-
* @returns Metric value, or undefined if not found.
|
|
329
|
-
*/
|
|
330
|
-
getMetrics(key) {
|
|
331
|
-
return this._engine.getMetrics?.(key);
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* @ru Очищает кэш ответов. Требует наличия плагина `withCache`.
|
|
335
|
-
* @en Clears the response cache. Requires the `withCache` plugin.
|
|
336
|
-
* @returns Void or Promise if async clearing is required.
|
|
337
|
-
*/
|
|
338
|
-
clearCache() {
|
|
339
|
-
return this._engine.clearCache?.();
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* @ru Возвращает агрегированную сводку метрик (success rate, avg duration, bottlenecks).
|
|
343
|
-
* Требует наличия плагина `withMetrics`.
|
|
344
|
-
* @en Returns aggregated metrics summary (success rate, avg duration, bottlenecks).
|
|
345
|
-
* Requires the `withMetrics` plugin to be registered.
|
|
346
|
-
* @returns Summary object, or null if no metrics collected.
|
|
347
|
-
*/
|
|
348
|
-
getMetricsSummary() {
|
|
349
|
-
return this._engine.getMetricsSummary?.();
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* @ru Сбрасывает все накопленные метрики.
|
|
353
|
-
* Требует наличия плагина `withMetrics`.
|
|
354
|
-
* @en Resets all accumulated metrics.
|
|
355
|
-
* Requires the `withMetrics` plugin to be registered.
|
|
356
|
-
*/
|
|
357
|
-
resetMetrics() {
|
|
358
|
-
this._engine.resetMetrics?.();
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
//# sourceMappingURL=HyperClient.js.map
|
|
1
|
+
"use strict";import{defaultConfig as c}from"../defaultConfig.js";import{HyperCore as m}from"@hyperttp/core";import{withParser as p}from"@hyperttp/parser";import{withQueue as w}from"@hyperttp/queue";import{withCache as y}from"@hyperttp/cache";import{withRateLimit as l}from"@hyperttp/ratelimit";import{withInflight as b}from"@hyperttp/inflight";import{withInterceptors as T}from"@hyperttp/interceptors";import{withMetrics as k}from"@hyperttp/metrics";import{appendQueryToUrl as S}from"../Utils/query.js";import{RequestBuilder as x}from"../Utils/RequestBuilder.js";const _=Object.freeze({});export class HyperClient{_engine;_config;constructor(e=c,t){this._config={...c,...e,network:{...c.network,...e.network}},this._engine=new m(this._config,t),this._engine.use(p(this._config.responseConverter)),this._engine.use(w()),this._engine.use(l(this._config.rateLimit)),this._engine.use(b(this._config.inflight)),this._engine.use(y(this._config.cache)),this._engine.use(T()),this._engine.use(k(this._config.metrics))}use(e){return this._engine.use(e),this}async getTransportName(){return this._engine.getTransportName()}_buildRequest(e,t,r,n){if(typeof e=="string")return{url:e,headers:_,body:r,signal:n,meta:{responseType:t}};const i=e,s=e.url??i.getURL?.()??"",a=e.headers??i.getHeaders?.()??_,d=r??i.body??i.bodyData??i._bodyData??i.getBodyData?.()??i.getBodyDataString?.(),f=n??e.signal??i.getSignal?.();let o=s;const h=e.query??i.getQuery?.();if(h&&Object.keys(h).length>0){const u=S(o,h);if(u!==o)o=u;else{const g=i.getQueryAsString?.();g&&(o+=g)}}else{const u=i.getQueryAsString?.();u&&(o+=u)}return{url:o,headers:a,body:d,signal:f,meta:{...e.meta,responseType:t}}}async _execute(e,t,r="auto",n,i){const s=this._buildRequest(t,r,n,i);let a;switch(e){case"GET":a=await this._engine.get(s,i);break;case"POST":a=await this._engine.post(s,s.body,i);break;case"PUT":a=await this._engine.put(s,s.body,i);break;case"PATCH":a=await this._engine.patch(s,s.body,i);break;case"DELETE":a=await this._engine.delete(s,i);break;case"OPTIONS":a=await this._engine.options(s,s.body,i);break;case"HEAD":a=await this._engine.head(s,i);break;default:a=await this._engine.get(s,i)}return a.body}get(e,t="auto",r){return this._execute("GET",e,t,void 0,r)}post(e,t="auto",r,n){return this._execute("POST",e,t,r,n)}put(e,t="auto",r,n){return this._execute("PUT",e,t,r,n)}patch(e,t="auto",r,n){return this._execute("PATCH",e,t,r,n)}delete(e,t="auto",r){return this._execute("DELETE",e,t,void 0,r)}options(e,t="auto",r,n){return this._execute("OPTIONS",e,t,r,n)}async head(e,t){const r=this._buildRequest(e,"auto",void 0,t),n=await this._engine.head(r,t);return{status:n.status,headers:n.headers}}stream(e,t){return this._engine.stream(e,t)}request(e){return new x(e,this)}extend(e){return new HyperClient({...this._config,...e,network:{...this._config.network,...e.network}})}create(e){return this.extend(e)}async destroy(){await this._engine.destroy()}getStats(){return this._engine.getStats?.()}getAllMetrics(){return this._engine.getAllMetrics?.()}getMetrics(e){return this._engine.getMetrics?.(e)}clearCache(){return this._engine.clearCache?.()}getMetricsSummary(){return this._engine.getMetricsSummary?.()}resetMetrics(){this._engine.resetMetrics?.()}}
|
|
2
|
+
//# sourceMappingURL=HyperClient.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Hyperttp/Client/HyperClient.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n HttpResponse,\n ResponseType,\n HttpClientOptions,\n RequestBodyData,\n RequestInterface,\n RequestHeaders,\n HyperPlugin,\n Method,\n RequestMetrics,\n HyperTransport,\n} from \"@hyperttp/types\";\nimport { defaultConfig } from \"../defaultConfig.js\";\nimport { HyperCore } from \"@hyperttp/core\";\nimport { withParser } from \"@hyperttp/parser\";\nimport { withQueue } from \"@hyperttp/queue\";\nimport { withCache } from \"@hyperttp/cache\";\nimport { withRateLimit } from \"@hyperttp/ratelimit\";\nimport { withInflight } from \"@hyperttp/inflight\";\nimport { withInterceptors } from \"@hyperttp/interceptors\";\nimport { withMetrics } from \"@hyperttp/metrics\";\nimport { appendQueryToUrl } from \"../Utils/query.js\";\nimport { RequestBuilder } from \"../Utils/RequestBuilder.js\";\n\nconst EMPTY_HEADERS: Readonly<Record<string, never>> = Object.freeze({});\n\ninterface HyperCoreEngine {\n getStats?(): unknown;\n getAllMetrics?(): RequestMetrics[];\n getMetrics?(key: string): RequestMetrics | RequestMetrics[] | undefined;\n clearCache?(key?: string): void | Promise<void>;\n getMetricsSummary?(): unknown;\n resetMetrics?(): void;\n}\n\ntype RequestLike = RequestInterface & {\n body?: RequestBodyData;\n bodyData?: RequestBodyData;\n _bodyData?: RequestBodyData;\n getURL?: () => string;\n getHeaders?: () => RequestHeaders;\n getBodyData?: () => RequestBodyData;\n getBodyDataString?: () => string;\n getSignal?: () => AbortSignal | undefined;\n getQuery?: () => Record<string, unknown>;\n getQueryAsString?: () => string;\n};\n\n/**\n * @ru \u0412\u044B\u0441\u043E\u043A\u043E\u0443\u0440\u043E\u0432\u043D\u0435\u0432\u044B\u0439 HTTP-\u043A\u043B\u0438\u0435\u043D\u0442 \u0441 \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u043F\u043B\u0430\u0433\u0438\u043D\u043E\u0432\n * (\u0441\u0435\u0440\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F, \u043F\u0430\u0440\u0441\u0438\u043D\u0433, \u043E\u0447\u0435\u0440\u0435\u0434\u044C, rate limit, inflight, \u043A\u044D\u0448, \u043F\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0447\u0438\u043A\u0438, \u043C\u0435\u0442\u0440\u0438\u043A\u0438).\n * \u0414\u0435\u043B\u0435\u0433\u0438\u0440\u0443\u0435\u0442 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432 \u044F\u0434\u0440\u0443 HyperCore \u0438 \u0438\u0437\u0432\u043B\u0435\u043A\u0430\u0435\u0442 \u0442\u0435\u043B\u043E \u043E\u0442\u0432\u0435\u0442\u0430.\n * @en High-level HTTP client with automatic plugin registration\n * (serialization, parsing, queue, rate limit, inflight, cache, interceptors, metrics).\n * Delegates request execution to the HyperCore core and extracts the response body.\n */\nexport class HyperClient {\n private readonly _engine: HyperCore;\n private readonly _config: HttpClientOptions;\n\n /**\n * @ru \u0421\u043E\u0437\u0434\u0430\u0451\u0442 \u044D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440 HyperClient \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0435 \u043F\u043B\u0430\u0433\u0438\u043D\u044B.\n * @en Creates a HyperClient instance and registers all standard plugins.\n * @param config - Client configuration options.\n */\n constructor(config: HttpClientOptions = defaultConfig, transport?: HyperTransport) {\n this._config = {\n ...defaultConfig,\n ...config,\n network: { ...defaultConfig.network, ...config.network },\n };\n this._engine = new HyperCore(this._config, transport);\n\n this._engine.use(withParser(this._config.responseConverter));\n this._engine.use(withQueue());\n this._engine.use(withRateLimit(this._config.rateLimit));\n this._engine.use(withInflight(this._config.inflight));\n this._engine.use(withCache(this._config.cache));\n this._engine.use(withInterceptors());\n this._engine.use(withMetrics(this._config.metrics));\n }\n\n /**\n * @ru \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u043F\u043B\u0430\u0433\u0438\u043D \u0432 \u043A\u043B\u0438\u0435\u043D\u0442\u0435.\n * @en Registers an additional plugin in the client.\n * @param plugin - Plugin instance to register.\n * @returns The current instance for chaining.\n */\n public use(plugin: HyperPlugin): this {\n this._engine.use(plugin);\n return this;\n }\n\n /**\n * @ru \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043C\u044F \u043A\u043B\u0430\u0441\u0441\u0430 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0433\u043E \u0442\u0440\u0430\u043D\u0441\u043F\u043E\u0440\u0442\u0430.\n * @en Returns the class name of the active transport.\n * @returns Promise resolving to the transport class name.\n */\n public async getTransportName(): Promise<string> {\n return this._engine.getTransportName();\n }\n\n /**\n * @ru \u0421\u0442\u0440\u043E\u0438\u0442 RequestInterface, \u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u043E \u0438\u0437\u0432\u043B\u0435\u043A\u0430\u044F \u0434\u0430\u043D\u043D\u044B\u0435 \u0438\u0437 \u0433\u0435\u0442\u0442\u0435\u0440\u043E\u0432 \u0441\u0442\u0430\u0440\u043E\u0433\u043E \u043A\u043B\u0430\u0441\u0441\u0430 Request.\n * @en Builds RequestInterface, correctly extracting data from getters of the old Request class.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param body - Optional request body.\n * @param signal - Optional abort signal.\n * @returns Normalized RequestInterface ready for dispatching.\n */\n private _buildRequest(\n req: RequestInterface | string,\n responseType: ResponseType,\n body?: RequestBodyData,\n signal?: AbortSignal,\n ): RequestInterface {\n if (typeof req === \"string\") {\n return {\n url: req,\n headers: EMPTY_HEADERS,\n body,\n signal,\n meta: { responseType },\n };\n }\n const r = req as RequestLike;\n const url = req.url ?? r.getURL?.() ?? \"\";\n const headers = req.headers ?? r.getHeaders?.() ?? EMPTY_HEADERS;\n const extractedBody =\n body ?? r.body ?? r.bodyData ?? r._bodyData ?? r.getBodyData?.() ?? r.getBodyDataString?.();\n\n const extractedSignal = signal ?? req.signal ?? r.getSignal?.();\n\n let finalUrl = url;\n const query = req.query ?? r.getQuery?.();\n if (query && Object.keys(query).length > 0) {\n const appended = appendQueryToUrl(finalUrl, query as Record<string, string | string[] | number | boolean | undefined | null>);\n if (appended !== finalUrl) {\n finalUrl = appended;\n } else {\n const qs = r.getQueryAsString?.();\n if (qs) finalUrl += qs;\n }\n } else {\n const qs = r.getQueryAsString?.();\n if (qs) finalUrl += qs;\n }\n\n return {\n url: finalUrl,\n headers,\n body: extractedBody,\n signal: extractedSignal,\n meta: { ...req.meta, responseType },\n };\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 HTTP-\u0437\u0430\u043F\u0440\u043E\u0441 \u0447\u0435\u0440\u0435\u0437 \u044F\u0434\u0440\u043E \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u043E\u0435 \u0442\u0435\u043B\u043E \u043E\u0442\u0432\u0435\u0442\u0430.\n * \u041F\u043B\u0430\u0433\u0438\u043D withParser \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u043F\u0430\u0440\u0441\u0438\u0442 \u0442\u0435\u043B\u043E \u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u0435 meta.responseType.\n * @en Executes an HTTP request through the core and returns the parsed response body.\n * The withParser plugin automatically parses the body based on meta.responseType.\n * @template T - Expected response body type.\n * @param method - HTTP method (GET, POST, etc.).\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param body - Optional request body.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n private async _execute<T>(\n method: Method,\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n body?: RequestBodyData,\n signal?: AbortSignal,\n ): Promise<T> {\n const request = this._buildRequest(req, responseType, body, signal);\n\n let response: HttpResponse<unknown>;\n switch (method) {\n case \"GET\":\n response = await this._engine.get(request, signal);\n break;\n case \"POST\":\n response = await this._engine.post(request, request.body, signal);\n break;\n case \"PUT\":\n response = await this._engine.put(request, request.body, signal);\n break;\n case \"PATCH\":\n response = await this._engine.patch(request, request.body, signal);\n break;\n case \"DELETE\":\n response = await this._engine.delete(request, signal);\n break;\n case \"OPTIONS\":\n response = await this._engine.options(request, request.body, signal);\n break;\n case \"HEAD\":\n response = await this._engine.head(request, signal);\n break;\n default:\n response = await this._engine.get(request, signal);\n }\n\n return response.body as T;\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 GET-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442.\n * @en Performs a GET request and returns the parsed response.\n * @template T - Expected response body type.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy ('auto', 'json', 'text', 'stream', 'buffer', 'blob', 'xml', 'html').\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n public get<T = unknown>(\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n signal?: AbortSignal,\n ): Promise<T> {\n return this._execute<T>(\"GET\", req, responseType, undefined, signal);\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 POST-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442.\n * @en Performs a POST request and returns the parsed response.\n * @template T - Expected response body type.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param body - Request body data.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n public post<T = unknown>(\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n body?: RequestBodyData,\n signal?: AbortSignal,\n ): Promise<T> {\n return this._execute<T>(\"POST\", req, responseType, body, signal);\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 PUT-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442.\n * @en Performs a PUT request and returns the parsed response.\n * @template T - Expected response body type.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param body - Request body data.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n public put<T = unknown>(\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n body?: RequestBodyData,\n signal?: AbortSignal,\n ): Promise<T> {\n return this._execute<T>(\"PUT\", req, responseType, body, signal);\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 PATCH-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442.\n * @en Performs a PATCH request and returns the parsed response.\n * @template T - Expected response body type.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param body - Request body data.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n public patch<T = unknown>(\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n body?: RequestBodyData,\n signal?: AbortSignal,\n ): Promise<T> {\n return this._execute<T>(\"PATCH\", req, responseType, body, signal);\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 DELETE-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442.\n * @en Performs a DELETE request and returns the parsed response.\n * @template T - Expected response body type.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n public delete<T = unknown>(\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n signal?: AbortSignal,\n ): Promise<T> {\n return this._execute<T>(\"DELETE\", req, responseType, undefined, signal);\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 OPTIONS-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0441\u043F\u0430\u0440\u0441\u0435\u043D\u043D\u044B\u0439 \u043E\u0442\u0432\u0435\u0442.\n * @en Performs an OPTIONS request and returns the parsed response.\n * @template T - Expected response body type.\n * @param req - Request URL or configuration object.\n * @param responseType - Response parsing strategy.\n * @param body - Optional request body data.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the parsed response body.\n */\n public options<T = unknown>(\n req: RequestInterface | string,\n responseType: ResponseType = \"auto\",\n body?: RequestBodyData,\n signal?: AbortSignal,\n ): Promise<T> {\n return this._execute<T>(\"OPTIONS\", req, responseType, body, signal);\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 HEAD-\u0437\u0430\u043F\u0440\u043E\u0441 \u0438 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0438 \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 (\u0431\u0435\u0437 \u0442\u0435\u043B\u0430).\n * @en Performs a HEAD request and returns status and headers (no body).\n * @param req - Request URL or configuration object.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to an object with status and headers.\n */\n public async head(\n req: RequestInterface | string,\n signal?: AbortSignal,\n ): Promise<{ status: number; headers: Record<string, string | string[]> }> {\n const request = this._buildRequest(req, \"auto\", undefined, signal);\n const response = await this._engine.head(request, signal);\n return {\n status: response.status,\n headers: response.headers as Record<string, string | string[]>,\n };\n }\n\n /**\n * @ru \u0412\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u043F\u043E\u0442\u043E\u043A\u043E\u0432\u044B\u0439 GET-\u0437\u0430\u043F\u0440\u043E\u0441. \u0422\u0435\u043B\u043E \u043E\u0442\u0432\u0435\u0442\u0430 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044F \u043A\u0430\u043A ReadableStream.\n * @en Performs a streaming GET request. Response body is returned as a ReadableStream.\n * @param req - Request URL or configuration object.\n * @param signal - Optional abort signal.\n * @returns Promise resolving to the stream response.\n */\n public stream(req: RequestInterface | string, signal?: AbortSignal) {\n return this._engine.stream(req, signal);\n }\n\n /**\n * @ru \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043F\u043E\u0441\u0442\u0440\u043E\u0438\u0442\u0435\u043B\u044C \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432 \u0434\u043B\u044F \u0446\u0435\u043F\u043E\u0447\u0435\u0447\u043D\u043E\u0433\u043E \u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F HTTP-\u0437\u0430\u043F\u0440\u043E\u0441\u0430.\n * @en Returns a request builder for chainable HTTP request composition.\n * @param url - Target URL for the request.\n * @returns A RequestBuilder instance bound to this client.\n */\n public request(url: string): RequestBuilder {\n return new RequestBuilder(url, this);\n }\n\n /**\n * @ru \u0421\u043E\u0437\u0434\u0430\u0451\u0442 \u043D\u043E\u0432\u044B\u0439 \u044D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430, \u043E\u0431\u044A\u0435\u0434\u0438\u043D\u044F\u044F \u0442\u0435\u043A\u0443\u0449\u0443\u044E \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044E \u0441 \u043F\u0435\u0440\u0435\u0434\u0430\u043D\u043D\u044B\u043C\u0438 \u043E\u043F\u0446\u0438\u044F\u043C\u0438.\n * @en Creates a new client instance by merging the current configuration with provided options.\n * @param options - Partial configuration options to extend.\n * @returns A new HyperClient instance.\n */\n public extend(options: Partial<HttpClientOptions>): HyperClient {\n return new HyperClient({\n ...this._config,\n ...options,\n network: { ...this._config.network, ...options.network },\n });\n }\n\n /**\n * @ru \u0410\u043B\u0438\u0430\u0441 \u0434\u043B\u044F extend(). \u0421\u043E\u0437\u0434\u0430\u0451\u0442 \u043D\u043E\u0432\u044B\u0439 \u044D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440 \u043A\u043B\u0438\u0435\u043D\u0442\u0430.\n * @en Alias for extend(). Creates a new client instance.\n * @param options - Partial configuration options.\n * @returns A new HyperClient instance.\n */\n public create(options: Partial<HttpClientOptions>): HyperClient {\n return this.extend(options);\n }\n\n /**\n * @ru \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043E\u0442\u0443 \u043A\u043B\u0438\u0435\u043D\u0442\u0430 \u0438 \u043E\u0441\u0432\u043E\u0431\u043E\u0436\u0434\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044B (\u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F, \u043F\u0443\u043B\u044B, \u043F\u043B\u0430\u0433\u0438\u043D\u044B).\n * @en Shuts down the client and releases resources (connections, pools, plugins).\n * @returns Promise that resolves when shutdown is complete.\n */\n public async destroy(): Promise<void> {\n await this._engine.destroy();\n }\n\n /**\n * @ru \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0443 \u0440\u0430\u0431\u043E\u0442\u044B \u043A\u043B\u0438\u0435\u043D\u0442\u0430 (\u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u044F, \u043E\u0447\u0435\u0440\u0435\u0434\u044C, \u043A\u044D\u0448).\n * \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043F\u043B\u0430\u0433\u0438\u043D\u0430 \u043C\u0435\u0442\u0440\u0438\u043A \u0438\u043B\u0438 \u043E\u0447\u0435\u0440\u0435\u0434\u0438.\n * @en Returns client statistics (active connections, queue, cache).\n * Requires metrics or queue plugin to be registered.\n * @returns Statistics object, or undefined if no plugin provides it.\n */\n public getStats(): unknown {\n return (this._engine as unknown as HyperCoreEngine).getStats?.();\n }\n\n /**\n * @ru \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0441\u0435 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043C\u0435\u0442\u0440\u0438\u043A\u0438 (latency, RPS, cache hits \u0438 \u0442.\u0434.).\n * \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043F\u043B\u0430\u0433\u0438\u043D\u0430 `withMetrics`.\n * @en Returns all aggregated metrics (latency, RPS, cache hits, etc.).\n * Requires the `withMetrics` plugin to be registered.\n * @returns Array of metrics, or undefined if the plugin is not registered.\n */\n public getAllMetrics(): RequestMetrics[] | undefined {\n return (this._engine as unknown as HyperCoreEngine).getAllMetrics?.();\n }\n\n /**\n * @ru \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043A\u043E\u043D\u043A\u0440\u0435\u0442\u043D\u0443\u044E \u043C\u0435\u0442\u0440\u0438\u043A\u0443 \u043F\u043E \u043A\u043B\u044E\u0447\u0443.\n * \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043F\u043B\u0430\u0433\u0438\u043D\u0430 `withMetrics`.\n * @en Returns a specific metric by key.\n * Requires the `withMetrics` plugin to be registered.\n * @param key - Metric key (e.g., 'rps', 'avgLatency', 'cacheHits').\n * @returns Metric value, or undefined if not found.\n */\n public getMetrics(key: string): RequestMetrics | RequestMetrics[] | undefined {\n return (this._engine as unknown as HyperCoreEngine).getMetrics?.(key);\n }\n\n /**\n * @ru \u041E\u0447\u0438\u0449\u0430\u0435\u0442 \u043A\u044D\u0448 \u043E\u0442\u0432\u0435\u0442\u043E\u0432. \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043F\u043B\u0430\u0433\u0438\u043D\u0430 `withCache`.\n * @en Clears the response cache. Requires the `withCache` plugin.\n * @returns Void or Promise if async clearing is required.\n */\n public clearCache(): void | Promise<void> | undefined {\n return (this._engine as unknown as HyperCoreEngine).clearCache?.();\n }\n\n /**\n * @ru \u0412\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u0443\u044E \u0441\u0432\u043E\u0434\u043A\u0443 \u043C\u0435\u0442\u0440\u0438\u043A (success rate, avg duration, bottlenecks).\n * \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043F\u043B\u0430\u0433\u0438\u043D\u0430 `withMetrics`.\n * @en Returns aggregated metrics summary (success rate, avg duration, bottlenecks).\n * Requires the `withMetrics` plugin to be registered.\n * @returns Summary object, or null if no metrics collected.\n */\n public getMetricsSummary(): unknown {\n return (this._engine as unknown as HyperCoreEngine).getMetricsSummary?.();\n }\n\n /**\n * @ru \u0421\u0431\u0440\u0430\u0441\u044B\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u043D\u0430\u043A\u043E\u043F\u043B\u0435\u043D\u043D\u044B\u0435 \u043C\u0435\u0442\u0440\u0438\u043A\u0438.\n * \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043D\u0430\u043B\u0438\u0447\u0438\u044F \u043F\u043B\u0430\u0433\u0438\u043D\u0430 `withMetrics`.\n * @en Resets all accumulated metrics.\n * Requires the `withMetrics` plugin to be registered.\n */\n public resetMetrics(): void {\n (this._engine as unknown as HyperCoreEngine).resetMetrics?.();\n }\n}\n"],
|
|
5
|
+
"mappings": "aAYA,OAAS,iBAAAA,MAAqB,sBAC9B,OAAS,aAAAC,MAAiB,iBAC1B,OAAS,cAAAC,MAAkB,mBAC3B,OAAS,aAAAC,MAAiB,kBAC1B,OAAS,aAAAC,MAAiB,kBAC1B,OAAS,iBAAAC,MAAqB,sBAC9B,OAAS,gBAAAC,MAAoB,qBAC7B,OAAS,oBAAAC,MAAwB,yBACjC,OAAS,eAAAC,MAAmB,oBAC5B,OAAS,oBAAAC,MAAwB,oBACjC,OAAS,kBAAAC,MAAsB,6BAE/B,MAAMC,EAAiD,OAAO,OAAO,CAAA,CAAE,EAgCjE,aAAO,WAAW,CACL,QACA,QAOjB,YAAYC,EAA4BZ,EAAea,EAA0B,CAC/E,KAAK,QAAU,CACb,GAAGb,EACH,GAAGY,EACH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,YAAU,CACf,OAAQ,KAAK,QAAuC,aAAY,CAClE,CASO,mBAAiB,CACtB,OAAQ,KAAK,QAAuC,oBAAmB,CACzE,CAQO,cAAY,CAChB,KAAK,QAAuC,eAAc,CAC7D",
|
|
6
|
+
"names": ["defaultConfig", "HyperCore", "withParser", "withQueue", "withCache", "withRateLimit", "withInflight", "withInterceptors", "withMetrics", "appendQueryToUrl", "RequestBuilder", "EMPTY_HEADERS", "config", "transport", "plugin", "req", "responseType", "body", "signal", "r", "url", "headers", "extractedBody", "extractedSignal", "finalUrl", "query", "appended", "qs", "method", "request", "response", "options", "key"]
|
|
7
|
+
}
|
package/Hyperttp/Request.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export default class Request implements RequestInterface {
|
|
|
21
21
|
* @param config - Configuration object with scheme, host, port, path, headers, query, bodyData, meta.
|
|
22
22
|
*/
|
|
23
23
|
constructor(config: RequestConfig & {
|
|
24
|
-
meta?:
|
|
24
|
+
meta?: Record<string, unknown>;
|
|
25
25
|
});
|
|
26
26
|
/**
|
|
27
27
|
* @ru Полный URL запроса, построенный на основе схемы, хоста, порта, пути и параметров запроса.
|
|
@@ -47,7 +47,7 @@ export default class Request implements RequestInterface {
|
|
|
47
47
|
* @ru Мета-данные запроса (произвольные данные).
|
|
48
48
|
* @en Request metadata (arbitrary data).
|
|
49
49
|
*/
|
|
50
|
-
get meta():
|
|
50
|
+
get meta(): Record<string, unknown>;
|
|
51
51
|
/**
|
|
52
52
|
* @ru Строит объект URL из текущих параметров.
|
|
53
53
|
* @en Builds a URL object from current parameters.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Request.d.ts","sourceRoot":"","sources":["../../src/Hyperttp/Request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EACf,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,O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