hyperttp 0.4.10 → 0.4.12
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.map +1 -1
- package/Hyperttp/Client/HyperClient.js +1 -1
- package/Hyperttp/Client/HyperClient.js.map +2 -2
- package/Hyperttp/Request.d.ts.map +1 -1
- package/Hyperttp/UrlExtractor.d.ts.map +1 -1
- package/Hyperttp/Utils/RequestBuilder.d.ts.map +1 -1
- package/README.md +158 -275
- package/package.json +3 -3
|
@@ -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,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,OAAO,CAAoB;IAE5C;;;;OAIG;
|
|
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,OAAO,CAAoB;IAE5C;;;;OAIG;IACH,YACE,MAAM,GAA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pD;IAED;;;;;;OAMG;IACI,iBAAiB,IAAI,OAAO,CAElC;IAED;;;;;OAKG;IACI,YAAY,IAAI,IAAI,CAE1B;CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
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?.()}}
|
|
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;if(!i.getURL){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
2
|
//# sourceMappingURL=HyperClient.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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,
|
|
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(\n config: HttpClientOptions = defaultConfig,\n transport?: HyperTransport,\n ) {\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 ??\n r.body ??\n r.bodyData ??\n r._bodyData ??\n r.getBodyData?.() ??\n r.getBodyDataString?.();\n\n const extractedSignal = signal ?? req.signal ?? r.getSignal?.();\n\n let finalUrl = url;\n\n if (!r.getURL) {\n const query = req.query ?? r.getQuery?.();\n if (query && Object.keys(query).length > 0) {\n const appended = appendQueryToUrl(\n finalUrl,\n query as Record<\n string,\n string | string[] | number | boolean | undefined | null\n >,\n );\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\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(\n key: string,\n ): 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,MAAM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C5B,CASO,UAAQ,CACb,OAAQ,KAAK,QAAuC,WAAU,CAChE,CASO,eAAa,CAClB,OAAQ,KAAK,QAAuC,gBAAe,CACrE,CAUO,WACLC,EAAW,CAEX,OAAQ,KAAK,QAAuC,aAAaA,CAAG,CACtE,CAOO,YAAU,CACf,OAAQ,KAAK,QAAuC,aAAY,CAClE,CASO,mBAAiB,CACtB,OAAQ,KAAK,QAAuC,oBAAmB,CACzE,CAQO,cAAY,CAChB,KAAK,QAAuC,eAAc,CAC7D",
|
|
6
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
7
|
}
|
|
@@ -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,OAAQ,YAAW,gBAAgB;IACtD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAC,CAAc;IACvB,MAAM,EAAE,MAAM,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,KAAK,CAA+B;IACrC,KAAK,EAAE,YAAY,CAAC;IAE3B;;;;OAIG;
|
|
1
|
+
{"version":3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;OAIG;IACH,YAAY,OAAO,EAAE,MAAM,EAU1B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlExtractor.d.ts","sourceRoot":"","sources":["../../src/Hyperttp/UrlExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,qBAAqB;IAChE,OAAO,CAAC,QAAQ,CAAoC;IAEpD;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"UrlExtractor.d.ts","sourceRoot":"","sources":["../../src/Hyperttp/UrlExtractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,qBAAqB;IAChE,OAAO,CAAC,QAAQ,CAAoC;IAEpD;;;;;;;;;;;;;;;;;OAiBG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAExD;IAED;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAerB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACjC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,UAAO,GACjB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CA0BnB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestBuilder.d.ts","sourceRoot":"","sources":["../../../src/Hyperttp/Utils/RequestBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkC,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,KAAK,CAAC,CAAU;IACxB,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,YAAY,CAAoB;IAExC;;;;;OAKG;
|
|
1
|
+
{"version":3,"file":"RequestBuilder.d.ts","sourceRoot":"","sources":["../../../src/Hyperttp/Utils/RequestBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkC,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,KAAK,CAAC,CAAU;IACxB,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,YAAY,CAAoB;IAExC;;;;;OAKG;IACH,YAAY,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAG3C;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG3B;IAED;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA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erplate.**
|
|
4
|
+
|
|
5
|
+
> English | [Русский](https://github.com/dirold2/hyperttp/tree/main/lang/ru)
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/hyperttp)
|
|
6
8
|
[](https://www.npmjs.com/package/hyperttp)
|
|
7
9
|
[](./LICENSE)
|
|
8
10
|
[](https://www.typescriptlang.org/)
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
An HTTP client for **Node.js**, **Bun**, **Deno**, and the **Browser** that provides retries,
|
|
13
|
+
caching, rate limiting, metrics, parsing, serialization, and interceptors **out of the box**.
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
```ts
|
|
16
|
+
import { HyperClient } from "hyperttp";
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
- 🇷🇺 [Русский](https://github.com/Dirold2/hyperttp/tree/main/lang/ru)
|
|
18
|
+
const client = new HyperClient();
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
// Automatically parses response based on the second argument
|
|
21
|
+
const user = await client.get("https://api.example.com/users/1", "json");
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
console.log(user);
|
|
24
|
+
```
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- ⚙️ **Core engine:** [`@hyperttp/core`](https://www.npmjs.com/package/@hyperttp/core)
|
|
26
|
+
No manual setup.
|
|
27
|
+
No unnecessary code.
|
|
28
|
+
Just make requests.
|
|
25
29
|
|
|
26
30
|
---
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
It is a feature-rich, production-ready extension over the optimized [`@hyperttp/core`](https://www.npmjs.com/package/@hyperttp/core) engine,
|
|
30
|
-
shipping with caching, rate limiting, request queuing, inflight deduplication, performance metrics, and a fluent chainable API — all pre-wired and ready to use.
|
|
32
|
+
## What is Hyperttp?
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Most HTTP clients solve one problem:
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
> "Send an HTTP request."
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
- **🔀 Concurrency Management:** Built-in queue plugin (`withQueue`) to strictly enforce concurrent request limits.
|
|
38
|
-
- **💾 Smart LRU Caching:** Dedicated caching layer (`withCache`) with TTL support to prevent redundant network drift.
|
|
39
|
-
- **🚦 Rate Limiting:** Built-in Token Bucket algorithm to protect against external API blocks and rate limits.
|
|
40
|
-
- **🛡️ Inflight Deduplication:** Prevents duplicate simultaneous requests to the same endpoint if the first is pending.
|
|
41
|
-
- **📈 Real-Time Metrics:** Out-of-the-box telemetry tracking latencies, RPS, cache hits, and overall client health.
|
|
42
|
-
- **🔌 Modular Architecture:** Clean pipeline approach allowing custom plugins, serialization layers, and interceptors.
|
|
43
|
-
- **💎 Fluent Request Builder API:** Clean, chainable API syntax to compose and configure requests with ease.
|
|
44
|
-
- **🗜️ Transparent Decompression:** Automatic handling of `gzip`, `deflate`, and `br` (Brotli) out of the box.
|
|
38
|
+
But real applications need much more:
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
- retries
|
|
41
|
+
- rate limiting
|
|
42
|
+
- caching
|
|
43
|
+
- request deduplication
|
|
44
|
+
- parsing
|
|
45
|
+
- serialization
|
|
46
|
+
- metrics
|
|
47
|
+
- interceptors
|
|
48
|
+
- request queues
|
|
49
|
+
- timeouts
|
|
50
|
+
|
|
51
|
+
With most libraries, this turns into installing many additional packages and building your own wrappers.
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| Package | Description | Repository |
|
|
51
|
-
| ---------------------------------------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------- |
|
|
52
|
-
| **`hyperttp`** (you are here) | High-level client with all plugins pre-wired | [GitHub](https://github.com/dirold2/hyperttp) |
|
|
53
|
-
| [`@hyperttp/core`](https://www.npmjs.com/package/@hyperttp/core) | Low-level core with transport pipeline | [GitHub](https://github.com/IT-IF-OR/hyperttp-core) |
|
|
54
|
-
| [`@hyperttp/types`](https://www.npmjs.com/package/@hyperttp/types) | Shared TypeScript type definitions | [GitHub](https://github.com/dirold2/hyperttp-types) |
|
|
55
|
-
| [`@hyperttp/transport-bun`](https://www.npmjs.com/package/@hyperttp/transport-bun) | Native Bun transport | [GitHub](https://github.com/IT-IF-OR/hyperttp-transport-bun) |
|
|
56
|
-
| [`@hyperttp/transport-undici`](https://www.npmjs.com/package/@hyperttp/transport-undici) | Undici transport for Node.js | [GitHub](https://github.com/IT-IF-OR/hyperttp-transport-undici) |
|
|
57
|
-
| [`@hyperttp/parser`](https://www.npmjs.com/package/@hyperttp/parser) | Response body parser (JSON/XML/HTML) | [GitHub](https://github.com/IT-IF-OR/hyperttp-parser) |
|
|
58
|
-
| [`@hyperttp/serializer`](https://www.npmjs.com/package/@hyperttp/serializer) | Request body serializer | [GitHub](https://github.com/IT-IF-OR/hyperttp-serializer) |
|
|
59
|
-
| [`@hyperttp/cache`](https://www.npmjs.com/package/@hyperttp/cache) | HTTP response caching | [GitHub](https://github.com/IT-IF-OR/hyperttp-cache) |
|
|
60
|
-
| [`@hyperttp/queue`](https://www.npmjs.com/package/@hyperttp/queue) | Request queueing | [GitHub](https://github.com/IT-IF-OR/hyperttp-queue) |
|
|
61
|
-
| [`@hyperttp/ratelimit`](https://www.npmjs.com/package/@hyperttp/ratelimit) | Rate limiting | [GitHub](https://github.com/IT-IF-OR/hyperttp-ratelimit) |
|
|
62
|
-
| [`@hyperttp/inflight`](https://www.npmjs.com/package/@hyperttp/inflight) | In-flight request deduplication | [GitHub](https://github.com/IT-IF-OR/hyperttp-inflight) |
|
|
63
|
-
| [`@hyperttp/interceptors`](https://www.npmjs.com/package/@hyperttp/interceptors) | Request/response interceptors | [GitHub](https://github.com/IT-IF-OR/hyperttp-interceptors) |
|
|
64
|
-
| [`@hyperttp/metrics`](https://www.npmjs.com/package/@hyperttp/metrics) | Performance metrics | [GitHub](https://github.com/IT-IF-OR/hyperttp-metrics) |
|
|
65
|
-
|
|
66
|
-
### Which package should I use?
|
|
67
|
-
|
|
68
|
-
- **Just need HTTP requests with caching, retries, and parsing?** → Use `hyperttp` (this package)
|
|
69
|
-
- **Need full control over the pipeline?** → Use `@hyperttp/core`
|
|
70
|
-
- **Building a custom transport or plugin?** → Use `@hyperttp/types`
|
|
53
|
+
Hyperttp provides these capabilities through a single client.
|
|
71
54
|
|
|
72
55
|
---
|
|
73
56
|
|
|
74
|
-
##
|
|
57
|
+
## Why Hyperttp?
|
|
75
58
|
|
|
76
|
-
|
|
77
|
-
npm install hyperttp
|
|
59
|
+
Instead of building your own networking layer:
|
|
78
60
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
```text
|
|
62
|
+
fetch
|
|
63
|
+
├── retry
|
|
64
|
+
├── cache
|
|
65
|
+
├── parser
|
|
66
|
+
├── metrics
|
|
67
|
+
├── serializer
|
|
68
|
+
├── queue
|
|
69
|
+
├── timeout
|
|
70
|
+
└── custom wrappers
|
|
83
71
|
|
|
84
|
-
|
|
72
|
+
```
|
|
85
73
|
|
|
86
|
-
|
|
74
|
+
Hyperttp provides a ready-to-use infrastructure:
|
|
87
75
|
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
```text
|
|
77
|
+
Hyperttp
|
|
78
|
+
├── Retry
|
|
79
|
+
├── Cache
|
|
80
|
+
├── Metrics
|
|
81
|
+
├── Parser
|
|
82
|
+
├── Serializer
|
|
83
|
+
├── Queue
|
|
84
|
+
├── Interceptors
|
|
85
|
+
├── Timeout
|
|
86
|
+
└── Rate Limiter
|
|
90
87
|
|
|
91
|
-
```
|
|
92
|
-
import { HyperClient } from "hyperttp";
|
|
88
|
+
```
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
Create a client.
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
const data = await client.get<MyDataType>("https://api.example.com/data");
|
|
92
|
+
Start making requests.
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
const newItem = await client.post<Item>("https://api.example.com/items", "json", {
|
|
101
|
-
name: "New Item Structure",
|
|
102
|
-
});
|
|
94
|
+
---
|
|
103
95
|
|
|
104
|
-
|
|
105
|
-
const html = await client.get<string>("https://example.com", "text");
|
|
106
|
-
const xml = await client.get<XmlDoc>("https://api.example.com/feed.xml", "xml");
|
|
96
|
+
## Quick Start
|
|
107
97
|
|
|
108
|
-
|
|
109
|
-
const chatStream = await client.stream("https://api.openai.com/v1/chat/completions");
|
|
110
|
-
const reader = chatStream.body.getReader();
|
|
111
|
-
```
|
|
98
|
+
### 1. Install core package
|
|
112
99
|
|
|
113
|
-
|
|
100
|
+
```bash
|
|
101
|
+
# Node.js
|
|
102
|
+
npm install hyperttp
|
|
103
|
+
pnpm add hyperttp
|
|
114
104
|
|
|
115
|
-
|
|
105
|
+
# Bun
|
|
106
|
+
bun add hyperttp
|
|
116
107
|
|
|
117
|
-
|
|
108
|
+
# Deno
|
|
109
|
+
deno add npm:hyperttp
|
|
118
110
|
|
|
119
|
-
```typescript
|
|
120
|
-
const user = await client
|
|
121
|
-
.request("https://api.example.com/users")
|
|
122
|
-
.post() // Specify HTTP Method (Defaults to GET)
|
|
123
|
-
.query({ include: "profile" }) // Safely append and encode Query Parameters
|
|
124
|
-
.headers({ "X-Request-ID": crypto.randomUUID() })
|
|
125
|
-
.jsonBody({ name: "John", email: "john@example.com" }) // Automatically serializes and sets Content-Type header
|
|
126
|
-
.json<User>() // Asserts expected response format (.text(), .buffer(), .stream())
|
|
127
|
-
.timeout(5000) // Instantiates a contextual, request-scoped AbortSignal timeout
|
|
128
|
-
.send();
|
|
129
111
|
```
|
|
130
112
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
## ⚙️ Advanced Configuration
|
|
113
|
+
### 2. Basic Usage
|
|
134
114
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
115
|
+
```ts
|
|
138
116
|
import { HyperClient } from "hyperttp";
|
|
139
117
|
|
|
140
118
|
const client = new HyperClient({
|
|
141
|
-
|
|
142
|
-
network: {
|
|
143
|
-
timeout: 10000, // Request timeout in milliseconds
|
|
144
|
-
maxConcurrent: 50, // Maximum simultaneous active sockets (0 = unlimited)
|
|
145
|
-
pipelining: 1, // Pipelined requests per connection limit
|
|
146
|
-
keepAliveTimeout: 30000, // Keep-alive socket preservation time in ms
|
|
147
|
-
rejectUnauthorized: true, // Reject untrusted or self-signed SSL certificates
|
|
148
|
-
followRedirects: true, // Automatically follow HTTP redirects
|
|
149
|
-
maxRedirects: 5, // Maximum follow threshold for redirects
|
|
150
|
-
maxResponseBytes: 10 * 1024 * 1024, // Prevents OOM by capping response body size (10 MB)
|
|
151
|
-
userAgent: "HyperClient/2.0", // Global fallback User-Agent header
|
|
152
|
-
headers: {
|
|
153
|
-
// Default baseline headers appended to every request
|
|
154
|
-
"X-App-Client": "Backend",
|
|
155
|
-
},
|
|
156
|
-
validateStatus: (status) => status >= 200 && status < 300, // Status success validation rules
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
// 🔄 Automated Retry Logic (RetryOptions)
|
|
160
|
-
retry: {
|
|
161
|
-
maxRetries: 3, // Number of recovery attempts before failing
|
|
162
|
-
baseDelay: 1000, // Initial delay baseline between retries (ms)
|
|
163
|
-
maxDelay: 10000, // Maximum cap for retry delay intervals (ms)
|
|
164
|
-
retryStatusCodes: [408, 429, 502, 503, 504], // Target status codes that trigger a retry
|
|
165
|
-
jitter: true, // Randomized delay variations to avoid thundering herd crashes
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
// 📈 Telemetry and Engine Logging
|
|
169
|
-
trackMetrics: true, // Enables global system performance collection
|
|
170
|
-
verbose: false, // Toggles internal micro-logs output
|
|
171
|
-
logger: (level, message, meta) => {
|
|
172
|
-
// Custom logging implementation sink
|
|
173
|
-
console.log(`[${level}] ${message}`, meta ?? "");
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
// 💾 Extended Plugin Configurations (Injected via HyperttpPluginsExtension)
|
|
177
|
-
cache: {
|
|
178
|
-
enabled: true,
|
|
179
|
-
ttl: 300000, // 5 minutes cache lifespan
|
|
180
|
-
maxSize: 500, // Max item limit for local LRU storage
|
|
181
|
-
},
|
|
182
|
-
rateLimit: {
|
|
183
|
-
enabled: true,
|
|
184
|
-
maxRequests: 100,
|
|
185
|
-
windowMs: 60000,
|
|
186
|
-
},
|
|
187
|
-
inflight: {
|
|
188
|
-
enabled: true,
|
|
189
|
-
},
|
|
119
|
+
baseURL: "https://api.example.com",
|
|
190
120
|
});
|
|
121
|
+
|
|
122
|
+
await client.get("/users", "json");
|
|
123
|
+
await client.post("/users", { name: "John" }, "json");
|
|
124
|
+
await client.put("/users/1", { name: "Alice" }, "json");
|
|
125
|
+
await client.delete("/users/1");
|
|
191
126
|
```
|
|
192
127
|
|
|
193
128
|
---
|
|
194
129
|
|
|
195
|
-
##
|
|
130
|
+
## Hyperttp vs Other HTTP Clients
|
|
196
131
|
|
|
197
|
-
|
|
132
|
+
| Feature | fetch | Axios | Ky | Hyperttp |
|
|
133
|
+
| ------------------------ | ----- | ------ | ------- | -------- |
|
|
134
|
+
| Promise API | ✅ | ✅ | ✅ | ✅ |
|
|
135
|
+
| Retry | ❌ | Plugin | ✅ | ✅ |
|
|
136
|
+
| Cache | ❌ | ❌ | ❌ | ✅ |
|
|
137
|
+
| Metrics | ❌ | ❌ | ❌ | ✅ |
|
|
138
|
+
| Rate Limiter | ❌ | ❌ | ❌ | ✅ |
|
|
139
|
+
| Queue | ❌ | ❌ | ❌ | ✅ |
|
|
140
|
+
| Parser | ❌ | ❌ | Partial | ✅ |
|
|
141
|
+
| Serializer | ❌ | ❌ | ❌ | ✅ |
|
|
142
|
+
| Interceptors | ❌ | ✅ | Hooks | ✅ |
|
|
143
|
+
| Transport auto-detection | ❌ | ❌ | ❌ | ✅ |
|
|
198
144
|
|
|
199
|
-
|
|
200
|
-
| ------------------ | ----------------------------------------------------------- |
|
|
201
|
-
| `withParser` | Parses response bodies based on `responseType` |
|
|
202
|
-
| `withQueue` | Queues requests when concurrency limit is reached |
|
|
203
|
-
| `withRateLimit` | Enforces rate limits |
|
|
204
|
-
| `withInflight` | Deduplicates in-flight requests |
|
|
205
|
-
| `withCache` | Caches responses based on HTTP headers |
|
|
206
|
-
| `withInterceptors` | Request/response interceptors |
|
|
207
|
-
| `withMetrics` | Collects performance metrics |
|
|
145
|
+
---
|
|
208
146
|
|
|
209
|
-
|
|
147
|
+
## Who is Hyperttp for?
|
|
210
148
|
|
|
211
|
-
|
|
149
|
+
Perfect for:
|
|
212
150
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
151
|
+
- REST APIs & SDKs
|
|
152
|
+
- CLI applications & Discord bots
|
|
153
|
+
- Backend & Serverless services
|
|
154
|
+
- Web scraping
|
|
155
|
+
- Enterprise applications
|
|
218
156
|
|
|
219
|
-
|
|
220
|
-
ctx.config.logger?.info?.("Plugin active");
|
|
221
|
-
},
|
|
157
|
+
---
|
|
222
158
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
159
|
+
## Advanced Configuration
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
const client = new HyperClient({
|
|
163
|
+
baseURL: "https://api.example.com",
|
|
226
164
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
console.log(`[${req.method}] ${req.url} -> ${res.status} (${duration.toFixed(2)}ms)`);
|
|
165
|
+
retry: {
|
|
166
|
+
retries: 3,
|
|
230
167
|
},
|
|
231
168
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// Return a response object here to bypass/recover from the failure
|
|
169
|
+
cache: {
|
|
170
|
+
ttl: 60_000,
|
|
235
171
|
},
|
|
172
|
+
|
|
173
|
+
timeout: 30_000,
|
|
236
174
|
});
|
|
237
175
|
```
|
|
238
176
|
|
|
239
|
-
### Plugin Phases
|
|
240
|
-
|
|
241
|
-
| Phase | Hook | Description |
|
|
242
|
-
| ----------- | ---------------- | ------------------------------------------------------- |
|
|
243
|
-
| **REQUEST** | `onRequest` | Intercepts before execution. Supports short-circuiting. |
|
|
244
|
-
| **DATA** | `onResponseData` | Transforms raw transport responses before mapping. |
|
|
245
|
-
| **FORMAT** | `onResponse` | Modifies client-facing responses. |
|
|
246
|
-
| **ERROR** | `onError` | Catches and recovers from errors. |
|
|
247
|
-
|
|
248
177
|
---
|
|
249
178
|
|
|
250
|
-
##
|
|
179
|
+
## Architecture
|
|
251
180
|
|
|
252
|
-
|
|
181
|
+
```text
|
|
182
|
+
Application
|
|
183
|
+
│
|
|
184
|
+
▼
|
|
185
|
+
HyperClient
|
|
186
|
+
│
|
|
187
|
+
Plugin Pipeline
|
|
188
|
+
│
|
|
189
|
+
Transport (Auto-detected)
|
|
190
|
+
│
|
|
191
|
+
HTTP
|
|
253
192
|
|
|
254
193
|
```
|
|
255
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
256
|
-
│ HyperClient │
|
|
257
|
-
│ (Auto-wires: Parser → Queue → RateLimit → │
|
|
258
|
-
│ Inflight → Cache → Interceptors → Metrics) │
|
|
259
|
-
└──────────────────────────┬──────────────────────────────────────┘
|
|
260
|
-
│
|
|
261
|
-
▼
|
|
262
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
263
|
-
│ HyperCore │
|
|
264
|
-
│ │
|
|
265
|
-
│ 1. Request Pipeline (onRequest) ─── short-circuit capable │
|
|
266
|
-
│ │ │
|
|
267
|
-
│ 2. Transport Execution (HyperTransport) │
|
|
268
|
-
│ ├─ BunTransport (native Bun fetch) │
|
|
269
|
-
│ ├─ UndiciTransport (Node.js) │
|
|
270
|
-
│ └─ NodeTransport (global fetch) │
|
|
271
|
-
│ │ │
|
|
272
|
-
│ 3. Response Data Pipeline (onResponseData) │
|
|
273
|
-
│ │ │
|
|
274
|
-
│ 4. Internal Processing (decompression, mapping) │
|
|
275
|
-
│ │ │
|
|
276
|
-
│ 5. Response Pipeline (onResponse) │
|
|
277
|
-
│ ├─ Mutators (sync/async modification) │
|
|
278
|
-
│ └─ Side Effects (background, non-blocking) │
|
|
279
|
-
│ │ │
|
|
280
|
-
│ 6. Error Pipeline (onError) ─── recovery capable │
|
|
281
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## 🛠️ Advanced Features
|
|
287
194
|
|
|
288
|
-
|
|
195
|
+
All components are independent and replaceable.
|
|
289
196
|
|
|
290
|
-
|
|
291
|
-
// Inspect pipeline internals (active connections, active queue payloads)
|
|
292
|
-
const stats = client.getStats();
|
|
293
|
-
console.log(stats);
|
|
294
|
-
|
|
295
|
-
// Retrieve aggregated historical latency and performance metrics
|
|
296
|
-
const allMetrics = client.getAllMetrics();
|
|
297
|
-
console.log(allMetrics);
|
|
197
|
+
---
|
|
298
198
|
|
|
299
|
-
|
|
300
|
-
await client.clearCache();
|
|
199
|
+
## Runtime Transports
|
|
301
200
|
|
|
302
|
-
|
|
303
|
-
const transportName = await client.getTransportName();
|
|
304
|
-
console.log(`Current Active Transport Driver: ${transportName}`);
|
|
201
|
+
Hyperttp works **out of the box** in any environment using standard `globalThis.fetch`.
|
|
305
202
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
```
|
|
203
|
+
For maximum performance and native features,
|
|
204
|
+
you can optionally install an optimized transport package tailored for your specific runtime:
|
|
309
205
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const reader = streamResponse.body.getReader();
|
|
316
|
-
```
|
|
206
|
+
| Runtime | Package | Description |
|
|
207
|
+
| ------- | ---------------------------- | -------------------------------------------- |
|
|
208
|
+
| Node.js | `@hyperttp/transport-undici` | Uses high-performance native `undici` client |
|
|
209
|
+
| Bun | `@hyperttp/transport-bun` | Leverages native `Bun.fetch` optimizations |
|
|
210
|
+
| Deno | `@hyperttp/transport-deno` | Optimized for native Deno network layer |
|
|
317
211
|
|
|
318
|
-
|
|
212
|
+
Once installed, no additional configuration is required:
|
|
319
213
|
|
|
320
|
-
|
|
214
|
+
```ts
|
|
215
|
+
import { HyperClient } from "hyperttp";
|
|
321
216
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
network: { headers: { Authorization: "Bearer token_abc" } },
|
|
325
|
-
});
|
|
217
|
+
const client = new HyperClient();
|
|
218
|
+
// Automatically discovers and uses UndiciTransport on Node.js, BunTransport on Bun, etc.
|
|
326
219
|
```
|
|
327
220
|
|
|
328
221
|
---
|
|
329
222
|
|
|
330
|
-
##
|
|
331
|
-
|
|
332
|
-
If you're migrating from axios, Hyperttp provides a familiar API:
|
|
223
|
+
## Ecosystem
|
|
333
224
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
225
|
+
- hyperttp
|
|
226
|
+
- @hyperttp/core
|
|
227
|
+
- @hyperttp/types
|
|
228
|
+
- @hyperttp/parser
|
|
229
|
+
- @hyperttp/cache
|
|
230
|
+
- @hyperttp/retry
|
|
231
|
+
- @hyperttp/metrics
|
|
232
|
+
- @hyperttp/serializer
|
|
233
|
+
- @hyperttp/transport-undici
|
|
234
|
+
- @hyperttp/transport-bun
|
|
235
|
+
- @hyperttp/transport-deno
|
|
344
236
|
|
|
345
237
|
---
|
|
346
238
|
|
|
347
|
-
##
|
|
239
|
+
## Performance
|
|
348
240
|
|
|
349
|
-
|
|
241
|
+
Hyperttp is designed with zero-allocation middleware pipelines and minimal overhead.
|
|
242
|
+
By using native runtime transports, it achieves near-raw-fetch speeds while providing a full feature set.
|
|
350
243
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
- **Bun + BunTransport**: ~15.22K RPS with all plugins enabled
|
|
354
|
-
- **Node.js + UndiciTransport**: ~10.82K RPS with all plugins enabled
|
|
355
|
-
- **Plugin Overhead**: Only ~9-14% compared to the bare `@hyperttp/core`
|
|
356
|
-
- **Zero Error Rate**: 0% errors across all benchmark scenarios
|
|
244
|
+
Detailed benchmarks comparing memory footprints and
|
|
245
|
+
request execution times across runtimes are available in the [IT-IF-OR/bench](https://github.com/IT-IF-OR/bench) repository.
|
|
357
246
|
|
|
358
247
|
---
|
|
359
248
|
|
|
360
|
-
##
|
|
249
|
+
## License
|
|
361
250
|
|
|
362
251
|
MIT
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
|
-
<p align="center">
|
|
367
|
-
<a href="https://github.com/dirold2">dirold2</a>
|
|
368
|
-
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperttp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "A high-performance, universal HTTP client for Node.js, Bun, Deno and Browser with caching, retries, queueing, rate limiting, cookies and logging.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@hyperttp/cache": "^1.1.6",
|
|
39
|
-
"@hyperttp/core": "^1.5.
|
|
39
|
+
"@hyperttp/core": "^1.5.3",
|
|
40
40
|
"@hyperttp/inflight": "^1.1.6",
|
|
41
41
|
"@hyperttp/interceptors": "^1.1.5",
|
|
42
42
|
"@hyperttp/metrics": "^1.2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@hyperttp/queue": "^1.1.5",
|
|
45
45
|
"@hyperttp/ratelimit": "^1.1.5",
|
|
46
46
|
"@hyperttp/serializer": "^1.2.0",
|
|
47
|
-
"@hyperttp/types": "^0.2.
|
|
47
|
+
"@hyperttp/types": "^0.2.5"
|
|
48
48
|
},
|
|
49
49
|
"private": false
|
|
50
50
|
}
|