hyperttp 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/Hyperttp/Core/CacheManager.d.ts +63 -40
  2. package/dist/Hyperttp/Core/CacheManager.d.ts.map +1 -1
  3. package/dist/Hyperttp/Core/CacheManager.js +64 -62
  4. package/dist/Hyperttp/Core/CacheManager.js.map +1 -1
  5. package/dist/Hyperttp/Core/HttpClientImproved.d.ts +55 -33
  6. package/dist/Hyperttp/Core/HttpClientImproved.d.ts.map +1 -1
  7. package/dist/Hyperttp/Core/HttpClientImproved.js +307 -211
  8. package/dist/Hyperttp/Core/HttpClientImproved.js.map +1 -1
  9. package/dist/Hyperttp/Core/InterceptorManager.d.ts +11 -11
  10. package/dist/Hyperttp/Core/InterceptorManager.d.ts.map +1 -1
  11. package/dist/Hyperttp/Core/InterceptorManager.js +10 -10
  12. package/dist/Hyperttp/Core/InterceptorManager.js.map +1 -1
  13. package/dist/Hyperttp/Core/MetricsManager.d.ts +33 -42
  14. package/dist/Hyperttp/Core/MetricsManager.d.ts.map +1 -1
  15. package/dist/Hyperttp/Core/MetricsManager.js +147 -58
  16. package/dist/Hyperttp/Core/MetricsManager.js.map +1 -1
  17. package/dist/Hyperttp/Core/QueueManager.d.ts +6 -4
  18. package/dist/Hyperttp/Core/QueueManager.d.ts.map +1 -1
  19. package/dist/Hyperttp/Core/QueueManager.js +36 -34
  20. package/dist/Hyperttp/Core/QueueManager.js.map +1 -1
  21. package/dist/Hyperttp/Core/RateLimiter.d.ts +29 -36
  22. package/dist/Hyperttp/Core/RateLimiter.d.ts.map +1 -1
  23. package/dist/Hyperttp/Core/RateLimiter.js +96 -36
  24. package/dist/Hyperttp/Core/RateLimiter.js.map +1 -1
  25. package/dist/Hyperttp/Core/RequestBuilder.d.ts +3 -1
  26. package/dist/Hyperttp/Core/RequestBuilder.d.ts.map +1 -1
  27. package/dist/Hyperttp/Core/RequestBuilder.js +10 -3
  28. package/dist/Hyperttp/Core/RequestBuilder.js.map +1 -1
  29. package/dist/Hyperttp/Core/RequestExecutor.d.ts +7 -34
  30. package/dist/Hyperttp/Core/RequestExecutor.d.ts.map +1 -1
  31. package/dist/Hyperttp/Core/RequestExecutor.js +120 -114
  32. package/dist/Hyperttp/Core/RequestExecutor.js.map +1 -1
  33. package/dist/Hyperttp/Core/ResponseConverter.d.ts +23 -0
  34. package/dist/Hyperttp/Core/ResponseConverter.d.ts.map +1 -0
  35. package/dist/Hyperttp/Core/ResponseConverter.js +368 -0
  36. package/dist/Hyperttp/Core/ResponseConverter.js.map +1 -0
  37. package/dist/Hyperttp/Core/index.d.ts +7 -10
  38. package/dist/Hyperttp/Core/index.d.ts.map +1 -1
  39. package/dist/Hyperttp/Core/index.js +26 -15
  40. package/dist/Hyperttp/Core/index.js.map +1 -1
  41. package/dist/Hyperttp/UrlExtractor.d.ts +1 -1
  42. package/dist/Hyperttp/UrlExtractor.d.ts.map +1 -1
  43. package/dist/Hyperttp/index.d.ts +1 -3
  44. package/dist/Hyperttp/index.d.ts.map +1 -1
  45. package/dist/Hyperttp/index.js +7 -8
  46. package/dist/Hyperttp/index.js.map +1 -1
  47. package/dist/Types/cache.d.ts +10 -0
  48. package/dist/Types/cache.d.ts.map +1 -0
  49. package/dist/Types/cache.js +3 -0
  50. package/dist/Types/cache.js.map +1 -0
  51. package/dist/Types/errors.d.ts +15 -0
  52. package/dist/Types/errors.d.ts.map +1 -0
  53. package/dist/Types/errors.js +34 -0
  54. package/dist/Types/errors.js.map +1 -0
  55. package/dist/Types/http-client.d.ts +39 -0
  56. package/dist/Types/http-client.d.ts.map +1 -0
  57. package/dist/Types/http-client.js +3 -0
  58. package/dist/Types/http-client.js.map +1 -0
  59. package/dist/Types/http.d.ts +5 -0
  60. package/dist/Types/http.d.ts.map +1 -0
  61. package/dist/Types/http.js +3 -0
  62. package/dist/Types/http.js.map +1 -0
  63. package/dist/Types/index.d.ts +12 -127
  64. package/dist/Types/index.d.ts.map +1 -1
  65. package/dist/Types/index.js +12 -39
  66. package/dist/Types/index.js.map +1 -1
  67. package/dist/Types/interceptors.d.ts +13 -0
  68. package/dist/Types/interceptors.d.ts.map +1 -0
  69. package/dist/Types/interceptors.js +3 -0
  70. package/dist/Types/interceptors.js.map +1 -0
  71. package/dist/Types/metrics.d.ts +67 -0
  72. package/dist/Types/metrics.d.ts.map +1 -0
  73. package/dist/Types/metrics.js +3 -0
  74. package/dist/Types/metrics.js.map +1 -0
  75. package/dist/Types/options.d.ts +233 -0
  76. package/dist/Types/options.d.ts.map +1 -0
  77. package/dist/Types/options.js +3 -0
  78. package/dist/Types/options.js.map +1 -0
  79. package/dist/Types/queue.d.ts +8 -0
  80. package/dist/Types/queue.d.ts.map +1 -0
  81. package/dist/Types/queue.js +3 -0
  82. package/dist/Types/queue.js.map +1 -0
  83. package/dist/Types/request.d.ts +148 -9
  84. package/dist/Types/request.d.ts.map +1 -1
  85. package/dist/Types/response.d.ts +28 -0
  86. package/dist/Types/response.d.ts.map +1 -0
  87. package/dist/Types/response.js +3 -0
  88. package/dist/Types/response.js.map +1 -0
  89. package/dist/Types/stream.d.ts +39 -0
  90. package/dist/Types/stream.d.ts.map +1 -0
  91. package/dist/Types/stream.js +3 -0
  92. package/dist/Types/stream.js.map +1 -0
  93. package/dist/Types/url-extractor.d.ts +10 -0
  94. package/dist/Types/url-extractor.d.ts.map +1 -0
  95. package/dist/Types/url-extractor.js +3 -0
  96. package/dist/Types/url-extractor.js.map +1 -0
  97. package/dist/index.d.ts +1 -2
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +7 -3
  100. package/dist/index.js.map +1 -1
  101. package/package.json +7 -5
  102. package/dist/Hyperttp/Core/ResponseTransformer.d.ts +0 -35
  103. package/dist/Hyperttp/Core/ResponseTransformer.d.ts.map +0 -1
  104. package/dist/Hyperttp/Core/ResponseTransformer.js +0 -171
  105. package/dist/Hyperttp/Core/ResponseTransformer.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/Types/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;IAG/B;IACA;IACA;IACA;IACA;IANT,YACE,OAAe,EACR,OAAe,YAAY,EAC3B,UAAmB,EACnB,aAAqB,EACrB,GAAY,EACZ,MAAe;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QANR,SAAI,GAAJ,IAAI,CAAuB;QAC3B,eAAU,GAAV,UAAU,CAAS;QACnB,kBAAa,GAAb,aAAa,CAAQ;QACrB,QAAG,GAAH,GAAG,CAAS;QACZ,WAAM,GAAN,MAAM,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAZD,0CAYC;AAED,MAAa,YAAa,SAAQ,eAAe;IAC/C,YAAY,GAAW,EAAE,OAAe;QACtC,KAAK,CAAC,iBAAiB,OAAO,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,MAAa,cAAe,SAAQ,eAAe;IACjD,YAAY,GAAW,EAAE,UAAmB;QAC1C,KAAK,CACH,eAAe,UAAU,CAAC,CAAC,CAAC,aAAa,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAC9D,YAAY,EACZ,GAAG,EACH,SAAS,EACT,GAAG,CACJ,CAAC;IACJ,CAAC;CACF;AAVD,wCAUC"}
@@ -0,0 +1,39 @@
1
+ import type { RequestInterface } from "./request.js";
2
+ import type { ResponseType } from "./http.js";
3
+ import type { StreamResponse } from "./stream.js";
4
+ import type { RequestMetrics } from "./metrics.js";
5
+ import type { HttpClientOptions } from "./options.js";
6
+ import type { RequestBuilder } from "../Hyperttp/Core/RequestBuilder.js";
7
+ export interface HttpClientStats {
8
+ cacheSize: number;
9
+ inflightRequests: number;
10
+ queuedRequests: number;
11
+ activeRequests: number;
12
+ currentRateLimit: number;
13
+ }
14
+ export interface HeadResponse {
15
+ status: number;
16
+ headers: Record<string, any>;
17
+ }
18
+ export interface HttpClientInterface {
19
+ readonly config?: HttpClientOptions;
20
+ get<T = unknown>(req: RequestInterface | string, responseType?: ResponseType): Promise<T>;
21
+ post<T = unknown>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
22
+ put<T = unknown>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
23
+ patch<T = unknown>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
24
+ delete<T = unknown>(req: RequestInterface | string, responseType?: ResponseType): Promise<T>;
25
+ options<T = unknown>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
26
+ head(req: RequestInterface | string): Promise<HeadResponse>;
27
+ stream(req: RequestInterface | string): Promise<StreamResponse>;
28
+ request<T = unknown>(url: string): RequestBuilder<T>;
29
+ create(options: Partial<HttpClientOptions>): HttpClientInterface;
30
+ extend(options: Partial<HttpClientOptions>): HttpClientInterface;
31
+ warmup(urls: string[], count?: number): Promise<void>;
32
+ getStats(): HttpClientStats;
33
+ getMetrics(key: string): RequestMetrics | undefined;
34
+ getAllMetrics(): RequestMetrics[];
35
+ clearMetrics(): void;
36
+ clearCache(): void;
37
+ destroy(): Promise<void>;
38
+ }
39
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/Types/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE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YAAY,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,OAAO,CAAC,CAAC,GAAG,OAAO,EACjB,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAC9B,IAAI,CAAC,EAAE,GAAG,EACV,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,IAAI,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE5D,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEhE,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAErD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,mBAAmB,CAAC;IACjE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,mBAAmB,CAAC;IAEjE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD,QAAQ,IAAI,eAAe,CAAC;IAC5B,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IACpD,aAAa,IAAI,cAAc,EAAE,CAAC;IAClC,YAAY,IAAI,IAAI,CAAC;IACrB,UAAU,IAAI,IAAI,CAAC;IAEnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/Types/http-client.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type LogLevel = "debug" | "info" | "warn" | "error";
2
+ export type Method = "GET" | "POST" | "PUT" | "PATCH" | "OPTIONS" | "DELETE" | "HEAD";
3
+ export type ResponseType = "auto" | "json" | "text" | "xml" | "html" | "buffer" | "stream";
4
+ export type SourceType = "json" | "xml" | "html" | "text" | "buffer";
5
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/Types/http.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,MAAM,MAAM,GACd,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,SAAS,GACT,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/Types/http.ts"],"names":[],"mappings":""}
@@ -1,128 +1,13 @@
1
- import { ResponseType, RequestInterface } from "./request";
2
- export * from "./request";
3
- /**
4
- * Базовый класс ошибки
5
- */
6
- export declare class HttpClientError extends Error {
7
- code: string;
8
- statusCode?: number | undefined;
9
- originalError?: Error | undefined;
10
- url?: string | undefined;
11
- method?: string | undefined;
12
- constructor(message: string, code?: string, statusCode?: number | undefined, originalError?: Error | undefined, url?: string | undefined, method?: string | undefined);
13
- }
14
- export declare class TimeoutError extends HttpClientError {
15
- constructor(url: string, timeout: number);
16
- }
17
- export declare class RateLimitError extends HttpClientError {
18
- retryAfter?: number | undefined;
19
- constructor(url: string, retryAfter?: number | undefined);
20
- }
21
- export type LogLevel = "debug" | "info" | "warn" | "error";
22
- export interface RetryOptions {
23
- maxRetries: number;
24
- baseDelay: number;
25
- maxDelay: number;
26
- retryStatusCodes: number[];
27
- jitter: boolean;
28
- }
29
- export type RequestInterceptor = (config: {
30
- url: string;
31
- method: string;
32
- headers: Record<string, string>;
33
- body?: any;
34
- }) => Promise<any> | any;
35
- export type ResponseInterceptor = (response: {
36
- status: number;
37
- headers: Record<string, any>;
38
- body: Buffer;
39
- url: string;
40
- }) => Promise<any> | any;
41
- export interface HttpClientOptions {
42
- timeout?: number;
43
- maxConcurrent?: number;
44
- maxRetries?: number;
45
- cacheTTL?: number;
46
- cacheMaxSize?: number;
47
- rateLimit?: {
48
- maxRequests: number;
49
- windowMs: number;
50
- };
51
- userAgent?: string;
52
- logger?: (level: LogLevel, message: string, meta?: any) => void;
53
- retryOptions?: Partial<RetryOptions>;
54
- followRedirects?: boolean;
55
- maxRedirects?: number;
56
- maxResponseBytes?: number;
57
- validateStatus?: (status: number) => boolean;
58
- cacheMethods?: string[];
59
- maxMetricsSize?: number;
60
- verbose?: boolean;
61
- enableQueue?: boolean;
62
- enableRateLimit?: boolean;
63
- enableCache?: boolean;
64
- allowHttp2?: boolean;
65
- }
66
- export interface HttpClientInterface {
67
- get<T = any>(req: RequestInterface | string, responseType?: ResponseType): Promise<T>;
68
- post<T = any>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
69
- put<T = any>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
70
- delete<T = any>(req: RequestInterface | string, responseType?: ResponseType): Promise<T>;
71
- patch<T = any>(req: RequestInterface | string, body?: any, responseType?: ResponseType): Promise<T>;
72
- head(req: RequestInterface | string): Promise<{
73
- status: number;
74
- headers: Record<string, any>;
75
- }>;
76
- stream(req: RequestInterface | string): Promise<StreamResponse>;
77
- clearCache(): void;
78
- }
79
- export interface RequestMetrics {
80
- startTime: number;
81
- endTime: number;
82
- duration: number;
83
- statusCode?: number;
84
- bytesReceived: number;
85
- bytesSent: number;
86
- retries: number;
87
- cached: boolean;
88
- url: string;
89
- method: string;
90
- bodyHash?: string;
91
- }
92
- export interface StreamResponse {
93
- status: number;
94
- headers: Record<string, any>;
95
- body: AsyncIterable<Uint8Array>;
96
- url: string;
97
- }
98
- /**
99
- * Interface for a universal URL extractor
100
- */
101
- export interface UrlExtractorInterface {
102
- /**
103
- * Register a platform with its URL patterns
104
- * @param platform Platform name (e.g., "yandex", "spotify")
105
- * @param patterns Array of URL patterns for the platform
106
- */
107
- registerPlatform(platform: string, patterns: UrlPattern[]): void;
108
- /**
109
- * Extract an entity ID or related info from a URL
110
- * @param url URL to extract from
111
- * @param entity Entity type ("track", "album", "artist", "playlist", etc.)
112
- * @param platform Platform name that has been registered
113
- * @returns Record of extracted values (keys depend on the pattern)
114
- */
115
- extractId<T extends string | number>(url: string, entity: string, platform: string): Record<string, T>;
116
- }
117
- /**
118
- * Defines a URL extraction pattern for a platform
119
- */
120
- export interface UrlPattern<T extends string = string> {
121
- /** Entity type this pattern applies to (track, album, artist, playlist, etc.) */
122
- entity: string;
123
- /** Regex with named capturing groups to extract IDs or info */
124
- regex: RegExp;
125
- /** Names of the capturing groups to extract */
126
- groupNames: T[];
127
- }
1
+ export * from "./cache.js";
2
+ export * from "./errors.js";
3
+ export * from "./http-client.js";
4
+ export * from "./http.js";
5
+ export * from "./interceptors.js";
6
+ export * from "./metrics.js";
7
+ export * from "./options.js";
8
+ export * from "./queue.js";
9
+ export * from "./request.js";
10
+ export * from "./response.js";
11
+ export * from "./stream.js";
12
+ export * from "./url-extractor.js";
128
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC3D,cAAc,WAAW,CAAC;AAE1B;;G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,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
@@ -14,43 +14,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.RateLimitError = exports.TimeoutError = exports.HttpClientError = void 0;
18
- __exportStar(require("./request"), exports);
19
- /**
20
- * Базовый класс ошибки
21
- */
22
- class HttpClientError extends Error {
23
- code;
24
- statusCode;
25
- originalError;
26
- url;
27
- method;
28
- constructor(message, code = "HTTP_ERROR", statusCode, originalError, url, method) {
29
- super(message);
30
- this.code = code;
31
- this.statusCode = statusCode;
32
- this.originalError = originalError;
33
- this.url = url;
34
- this.method = method;
35
- this.name = "HttpClientError";
36
- Object.setPrototypeOf(this, HttpClientError.prototype);
37
- }
38
- }
39
- exports.HttpClientError = HttpClientError;
40
- class TimeoutError extends HttpClientError {
41
- constructor(url, timeout) {
42
- super(`Request timeout after ${timeout}ms for ${url}`, "TIMEOUT", 408, undefined, url);
43
- this.name = "TimeoutError";
44
- }
45
- }
46
- exports.TimeoutError = TimeoutError;
47
- class RateLimitError extends HttpClientError {
48
- retryAfter;
49
- constructor(url, retryAfter) {
50
- super(`Rate limited for ${url}${retryAfter ? `, retry after ${retryAfter}ms` : ""}`, "RATE_LIMIT", 429, undefined, url);
51
- this.retryAfter = retryAfter;
52
- this.name = "RateLimitError";
53
- }
54
- }
55
- exports.RateLimitError = RateLimitError;
17
+ __exportStar(require("./cache.js"), exports);
18
+ __exportStar(require("./errors.js"), exports);
19
+ __exportStar(require("./http-client.js"), exports);
20
+ __exportStar(require("./http.js"), exports);
21
+ __exportStar(require("./interceptors.js"), exports);
22
+ __exportStar(require("./metrics.js"), exports);
23
+ __exportStar(require("./options.js"), exports);
24
+ __exportStar(require("./queue.js"), exports);
25
+ __exportStar(require("./request.js"), exports);
26
+ __exportStar(require("./response.js"), exports);
27
+ __exportStar(require("./stream.js"), exports);
28
+ __exportStar(require("./url-extractor.js"), exports);
56
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,4CAA0B;AAE1B;;GAEG;AACH,MAAa,eAAgB,SAAQ,KAAK;IAG/B;IACA;IACA;IACA;IACA;IANT,YACE,OAAe,EACR,OAAe,YAAY,EAC3B,UAAmB,EACnB,aAAqB,EACrB,GAAY,EACZ,MAAe;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QANR,SAAI,GAAJ,IAAI,CAAuB;QAC3B,eAAU,GAAV,UAAU,CAAS;QACnB,kBAAa,GAAb,aAAa,CAAQ;QACrB,QAAG,GAAH,GAAG,CAAS;QACZ,WAAM,GAAN,MAAM,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF;AAbD,0CAaC;AAED,MAAa,YAAa,SAAQ,eAAe;IAC/C,YAAY,GAAW,EAAE,OAAe;QACtC,KAAK,CACH,yBAAyB,OAAO,UAAU,GAAG,EAAE,EAC/C,SAAS,EACT,GAAG,EACH,SAAS,EACT,GAAG,CACJ,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAXD,oCAWC;AAED,MAAa,cAAe,SAAQ,eAAe;IAGxC;IAFT,YACE,GAAW,EACJ,UAAmB;QAE1B,KAAK,CACH,oBAAoB,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,iBAAiB,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAC7E,YAAY,EACZ,GAAG,EACH,SAAS,EACT,GAAG,CACJ,CAAC;QARK,eAAU,GAAV,UAAU,CAAS;QAS1B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAdD,wCAcC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,oDAAkC;AAClC,+CAA6B;AAC7B,+CAA6B;AAC7B,6CAA2B;AAC3B,+CAA6B;AAC7B,gDAA8B;AAC9B,8CAA4B;AAC5B,qDAAmC"}
@@ -0,0 +1,13 @@
1
+ export type RequestInterceptor = (config: {
2
+ url: string;
3
+ method: string;
4
+ headers: Record<string, string>;
5
+ body?: any;
6
+ }) => any | Promise<any>;
7
+ export type ResponseInterceptor = (response: {
8
+ status: number;
9
+ headers: Record<string, any>;
10
+ body: Buffer;
11
+ url: string;
12
+ }) => any | Promise<any>;
13
+ //# sourceMappingURL=interceptors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interceptors.d.ts","sourceRoot":"","sources":["../../src/Types/interceptors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAEzB,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interceptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interceptors.js","sourceRoot":"","sources":["../../src/Types/interceptors.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ export interface RequestMetrics {
2
+ /**
3
+ * @ru Время начала запроса (timestamp)
4
+ * @en Request start time (timestamp)
5
+ */
6
+ startTime: number;
7
+ /**
8
+ * @ru Время окончания запроса (timestamp)
9
+ * @en Request end time (timestamp)
10
+ */
11
+ endTime: number;
12
+ /**
13
+ * @ru Длительность запроса (мс)
14
+ * @en Request duration (ms)
15
+ */
16
+ duration: number;
17
+ /**
18
+ * @ru HTTP статус код ответа
19
+ * @en HTTP status code of response
20
+ */
21
+ statusCode?: number;
22
+ /**
23
+ * @ru Количество полученных байт
24
+ * @en Bytes received
25
+ */
26
+ bytesReceived: number;
27
+ /**
28
+ * @ru Количество отправленных байт
29
+ * @en Bytes sent
30
+ */
31
+ bytesSent: number;
32
+ /**
33
+ * @ru Количество повторных попыток
34
+ * @en Number of retries performed
35
+ */
36
+ retries: number;
37
+ /**
38
+ * @ru Ответ из кэша
39
+ * @en Response served from cache
40
+ */
41
+ cached: boolean;
42
+ /**
43
+ * @ru URL запроса
44
+ * @en Request URL
45
+ */
46
+ url: string;
47
+ /**
48
+ * @ru HTTP метод запроса
49
+ * @en HTTP method
50
+ */
51
+ method: string;
52
+ /**
53
+ * @ru Хэш тела запроса (для кэширования)
54
+ * @en Request body hash (for caching)
55
+ */
56
+ bodyHash?: string;
57
+ }
58
+ export type CircuitStateName = "CLOSED" | "OPEN" | "HALF_OPEN";
59
+ export type CircuitState = {
60
+ state: CircuitStateName;
61
+ failureScore: number;
62
+ consecutiveFailures: number;
63
+ lastFailureTime: number;
64
+ lastTransitionTime: number;
65
+ probeInFlight: boolean;
66
+ };
67
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/Types/metrics.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/D,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,gBAAgB,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/Types/metrics.ts"],"names":[],"mappings":""}
@@ -0,0 +1,233 @@
1
+ import { LogLevel, Method } from "./http";
2
+ import { ResponseConverterOptions } from "./response";
3
+ export interface RetryOptions {
4
+ /**
5
+ * @ru Максимальное количество повторных попыток
6
+ * @en Maximum number of retry attempts
7
+ */
8
+ maxRetries?: number;
9
+ /**
10
+ * @ru Базовая задержка между попытками (мс)
11
+ * @en Base delay between retries (ms)
12
+ */
13
+ baseDelay?: number;
14
+ /**
15
+ * @ru Максимальная задержка между попытками (мс)
16
+ * @en Maximum retry delay (ms)
17
+ */
18
+ maxDelay?: number;
19
+ /**
20
+ * @ru Коды HTTP, при которых выполняется retry
21
+ * @en HTTP status codes that trigger retry logic
22
+ */
23
+ retryStatusCodes?: readonly number[];
24
+ /**
25
+ * @ru Добавлять случайный jitter к задержке
26
+ * @en Add randomness (jitter) to retry delay
27
+ */
28
+ jitter?: boolean;
29
+ }
30
+ export interface CacheOptions {
31
+ /**
32
+ * @ru Включить кэш
33
+ * @en Enable cache
34
+ */
35
+ enabled?: boolean;
36
+ /**
37
+ * @ru Время жизни кэша (мс)
38
+ * @en Cache time-to-live in milliseconds
39
+ */
40
+ ttl?: number;
41
+ /**
42
+ * @ru Максимальный размер кэша
43
+ * @en Maximum cache size
44
+ */
45
+ maxSize?: number;
46
+ /**
47
+ * @ru HTTP методы, которые можно кэшировать
48
+ * @en HTTP methods allowed to be cached
49
+ */
50
+ methods?: readonly Method[];
51
+ }
52
+ export interface RateLimitOptions {
53
+ /**
54
+ * @ru Включить rate limit
55
+ * @en Enable rate limiting
56
+ */
57
+ enabled?: boolean;
58
+ /**
59
+ * @ru Максимальное число запросов
60
+ * @en Maximum number of requests
61
+ */
62
+ maxRequests?: number;
63
+ /**
64
+ * @ru Окно времени (мс)
65
+ * @en Time window in milliseconds
66
+ */
67
+ windowMs?: number;
68
+ }
69
+ export interface NetworkOptions {
70
+ /**
71
+ * @ru Таймаут запроса (мс)
72
+ * @en Request timeout in milliseconds
73
+ */
74
+ timeout?: number;
75
+ /**
76
+ * @ru Максимум одновременных запросов. 0 = без лимита
77
+ * @en Maximum concurrent requests. 0 = unlimited
78
+ */
79
+ maxConcurrent?: number;
80
+ /**
81
+ * @ru Количество pipelined запросов на соединение
82
+ * @en Number of pipelined requests per connection
83
+ */
84
+ pipelining?: number;
85
+ /**
86
+ * @ru Таймаут keep-alive соединения (мс)
87
+ * @en Keep-alive connection timeout in milliseconds
88
+ */
89
+ keepAliveTimeout?: number;
90
+ /**
91
+ * @ru Отклонять недоверенные SSL сертификаты
92
+ * @en Reject unauthorized SSL certificates
93
+ */
94
+ rejectUnauthorized?: boolean;
95
+ /**
96
+ * @ru Следовать за редиректами
97
+ * @en Follow HTTP redirects
98
+ */
99
+ followRedirects?: boolean;
100
+ /**
101
+ * @ru Максимум редиректов
102
+ * @en Maximum number of redirects to follow
103
+ */
104
+ maxRedirects?: number;
105
+ /**
106
+ * @ru Максимальный размер ответа (байты)
107
+ * @en Maximum response body size in bytes
108
+ */
109
+ maxResponseBytes?: number;
110
+ /**
111
+ * @ru Переключение режима HTTP/2 и HTTP/1.1
112
+ * @en Switching between HTTP/2 and HTTP/1.1 modes
113
+ */
114
+ allowHttp2?: boolean;
115
+ /**
116
+ * @ru User-Agent заголовок
117
+ * @en User-Agent header string
118
+ */
119
+ userAgent?: string;
120
+ /**
121
+ * @ru Функция валидации HTTP статуса
122
+ * @en Function to validate HTTP status code
123
+ * @param status - HTTP status code
124
+ * @returns `true` if status is valid
125
+ */
126
+ validateStatus?: (status: number) => boolean;
127
+ }
128
+ export interface MetricsOptions {
129
+ /**
130
+ * @ru Включить сбор метрик
131
+ * @en Enable metrics collection
132
+ */
133
+ enabled?: boolean;
134
+ /**
135
+ * @ru Максимальное количество записей в истории.
136
+ * @en Maximum number of entries in history.
137
+ */
138
+ maxHistory?: number;
139
+ /**
140
+ * @ru Время хранения метрик в миллисекундах.
141
+ * @en Time to keep metrics in milliseconds.
142
+ */
143
+ ttl?: number;
144
+ /**
145
+ * @ru Глубина scope для circuit breaker: 1 = host + первый сегмент пути.
146
+ * @en Scope depth for circuit breaker: 1 = host + first path segment.
147
+ */
148
+ scopeDepth?: number;
149
+ /**
150
+ * @ru Порог ошибки, после которого circuit breaker переходит в OPEN.
151
+ * @en Failure score threshold that opens the circuit breaker.
152
+ */
153
+ failureThreshold?: number;
154
+ /**
155
+ * @ru Время охлаждения перед переходом в HALF_OPEN.
156
+ * @en Cooldown time before switching to HALF_OPEN.
157
+ */
158
+ resetTimeout?: number;
159
+ /**
160
+ * @ru Порог "медленного" запроса в миллисекундах.
161
+ * @en Slow request threshold in milliseconds.
162
+ */
163
+ slowRequestMs?: number;
164
+ /**
165
+ * @ru Веса ошибок для разных классов отказов.
166
+ * @en Failure weights for different failure classes.
167
+ */
168
+ weights?: {
169
+ timeout?: number;
170
+ serverError?: number;
171
+ rateLimit?: number;
172
+ slowRequest?: number;
173
+ other?: number;
174
+ };
175
+ }
176
+ export interface QueueOptions {
177
+ /**
178
+ * @ru Включить очередь запросов
179
+ * @en Enable request queue
180
+ */
181
+ enabled?: boolean;
182
+ }
183
+ export interface HttpClientOptions {
184
+ /**
185
+ * @ru Настройки сети
186
+ * @en Network configuration
187
+ */
188
+ network?: Partial<NetworkOptions>;
189
+ /**
190
+ * @ru Настройки retry
191
+ * @en Retry configuration
192
+ */
193
+ retry?: Partial<RetryOptions>;
194
+ /**
195
+ * @ru Настройки кэша
196
+ * @en Cache configuration
197
+ */
198
+ cache?: Partial<CacheOptions>;
199
+ /**
200
+ * @ru Настройки rate limit
201
+ * @en Rate limiting configuration
202
+ */
203
+ rateLimit?: Partial<RateLimitOptions>;
204
+ /**
205
+ * @ru Метрики
206
+ * @en Metrics configuration
207
+ */
208
+ metrics?: Partial<MetricsOptions>;
209
+ /**
210
+ * @ru Очередь запросов
211
+ * @en Request queue configuration
212
+ */
213
+ queue?: Partial<QueueOptions>;
214
+ /**
215
+ * @ru Конвертер ответа
216
+ * @en Response converter configuration
217
+ */
218
+ responseConverter?: Partial<ResponseConverterOptions>;
219
+ /**
220
+ * @ru Логгер
221
+ * @en Logger function
222
+ * @param level - log level
223
+ * @param message - log message
224
+ * @param meta - additional metadata
225
+ */
226
+ logger?: (level: LogLevel, message: string, meta?: unknown) => void;
227
+ /**
228
+ * @ru Режим verbose логов
229
+ * @en Enable verbose logging
230
+ */
231
+ verbose?: boolean;
232
+ }
233
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/Types/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;O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AAC;IAE9B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAElC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAEtD;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAEpE;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/Types/options.ts"],"names":[],"mappings":""}