hyperttp 0.2.6 → 3.0.1
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 +30 -0
- package/Hyperttp/Client/HyperClient.d.ts.map +1 -0
- package/Hyperttp/Client/HyperClient.js +215 -0
- package/Hyperttp/Client/HyperClient.js.map +1 -0
- package/{dist/Hyperttp → Hyperttp}/Request.d.ts +1 -1
- package/{dist/Hyperttp → Hyperttp}/Request.d.ts.map +1 -1
- package/{dist/Hyperttp → Hyperttp}/Request.js +2 -7
- package/Hyperttp/Request.js.map +1 -0
- package/{dist/Hyperttp → Hyperttp}/UrlExtractor.d.ts +1 -1
- package/{dist/Hyperttp → Hyperttp}/UrlExtractor.d.ts.map +1 -1
- package/{dist/Hyperttp → Hyperttp}/UrlExtractor.js +1 -4
- package/Hyperttp/UrlExtractor.js.map +1 -0
- package/Hyperttp/Utils/RequestBuilder.d.ts +32 -0
- package/Hyperttp/Utils/RequestBuilder.d.ts.map +1 -0
- package/Hyperttp/Utils/RequestBuilder.js +129 -0
- package/Hyperttp/Utils/RequestBuilder.js.map +1 -0
- package/Hyperttp/Utils/index.d.ts +2 -0
- package/Hyperttp/Utils/index.d.ts.map +1 -0
- package/Hyperttp/Utils/index.js +2 -0
- package/Hyperttp/Utils/index.js.map +1 -0
- package/Hyperttp/Utils/merge.d.ts +2 -0
- package/Hyperttp/Utils/merge.d.ts.map +1 -0
- package/Hyperttp/Utils/merge.js +25 -0
- package/Hyperttp/Utils/merge.js.map +1 -0
- package/Hyperttp/defaultConfig.d.ts +3 -0
- package/Hyperttp/defaultConfig.d.ts.map +1 -0
- package/Hyperttp/defaultConfig.js +39 -0
- package/Hyperttp/defaultConfig.js.map +1 -0
- package/Hyperttp/index.d.ts +6 -0
- package/Hyperttp/index.d.ts.map +1 -0
- package/Hyperttp/index.js +6 -0
- package/Hyperttp/index.js.map +1 -0
- package/{dist/Types → Types}/http-client.d.ts +2 -6
- package/Types/http-client.d.ts.map +1 -0
- package/Types/http-client.js +2 -0
- package/Types/index.d.ts +3 -0
- package/Types/index.d.ts.map +1 -0
- package/Types/index.js +3 -0
- package/Types/index.js.map +1 -0
- package/Types/url-extractor.js +2 -0
- package/index.d.ts +13 -0
- package/index.d.ts.map +1 -0
- package/index.js +12 -0
- package/index.js.map +1 -0
- package/package.json +22 -11
- package/LICENSE +0 -21
- package/README.md +0 -195
- package/dist/Hyperttp/Core/CacheManager.d.ts +0 -84
- package/dist/Hyperttp/Core/CacheManager.d.ts.map +0 -1
- package/dist/Hyperttp/Core/CacheManager.js +0 -109
- package/dist/Hyperttp/Core/CacheManager.js.map +0 -1
- package/dist/Hyperttp/Core/HttpClientImproved.d.ts +0 -149
- package/dist/Hyperttp/Core/HttpClientImproved.d.ts.map +0 -1
- package/dist/Hyperttp/Core/HttpClientImproved.js +0 -541
- package/dist/Hyperttp/Core/HttpClientImproved.js.map +0 -1
- package/dist/Hyperttp/Core/InterceptorManager.d.ts +0 -62
- package/dist/Hyperttp/Core/InterceptorManager.d.ts.map +0 -1
- package/dist/Hyperttp/Core/InterceptorManager.js +0 -64
- package/dist/Hyperttp/Core/InterceptorManager.js.map +0 -1
- package/dist/Hyperttp/Core/MetricsManager.d.ts +0 -71
- package/dist/Hyperttp/Core/MetricsManager.d.ts.map +0 -1
- package/dist/Hyperttp/Core/MetricsManager.js +0 -246
- package/dist/Hyperttp/Core/MetricsManager.js.map +0 -1
- package/dist/Hyperttp/Core/QueueManager.d.ts +0 -16
- package/dist/Hyperttp/Core/QueueManager.d.ts.map +0 -1
- package/dist/Hyperttp/Core/QueueManager.js +0 -75
- package/dist/Hyperttp/Core/QueueManager.js.map +0 -1
- package/dist/Hyperttp/Core/RateLimiter.d.ts +0 -63
- package/dist/Hyperttp/Core/RateLimiter.d.ts.map +0 -1
- package/dist/Hyperttp/Core/RateLimiter.js +0 -170
- package/dist/Hyperttp/Core/RateLimiter.js.map +0 -1
- package/dist/Hyperttp/Core/RequestBuilder.d.ts +0 -83
- package/dist/Hyperttp/Core/RequestBuilder.d.ts.map +0 -1
- package/dist/Hyperttp/Core/RequestBuilder.js +0 -169
- package/dist/Hyperttp/Core/RequestBuilder.js.map +0 -1
- package/dist/Hyperttp/Core/RequestExecutor.d.ts +0 -31
- package/dist/Hyperttp/Core/RequestExecutor.d.ts.map +0 -1
- package/dist/Hyperttp/Core/RequestExecutor.js +0 -167
- package/dist/Hyperttp/Core/RequestExecutor.js.map +0 -1
- package/dist/Hyperttp/Core/RequestProfiler.d.ts +0 -10
- package/dist/Hyperttp/Core/RequestProfiler.d.ts.map +0 -1
- package/dist/Hyperttp/Core/RequestProfiler.js +0 -55
- package/dist/Hyperttp/Core/RequestProfiler.js.map +0 -1
- package/dist/Hyperttp/Core/ResponseConverter.d.ts +0 -23
- package/dist/Hyperttp/Core/ResponseConverter.d.ts.map +0 -1
- package/dist/Hyperttp/Core/ResponseConverter.js +0 -369
- package/dist/Hyperttp/Core/ResponseConverter.js.map +0 -1
- package/dist/Hyperttp/Core/index.d.ts +0 -27
- package/dist/Hyperttp/Core/index.d.ts.map +0 -1
- package/dist/Hyperttp/Core/index.js +0 -56
- package/dist/Hyperttp/Core/index.js.map +0 -1
- package/dist/Hyperttp/Request.js.map +0 -1
- package/dist/Hyperttp/UrlExtractor.js.map +0 -1
- package/dist/Hyperttp/index.d.ts +0 -5
- package/dist/Hyperttp/index.d.ts.map +0 -1
- package/dist/Hyperttp/index.js +0 -24
- package/dist/Hyperttp/index.js.map +0 -1
- package/dist/Types/cache.d.ts +0 -10
- package/dist/Types/cache.d.ts.map +0 -1
- package/dist/Types/cache.js +0 -3
- package/dist/Types/cache.js.map +0 -1
- package/dist/Types/errors.d.ts +0 -15
- package/dist/Types/errors.d.ts.map +0 -1
- package/dist/Types/errors.js +0 -34
- package/dist/Types/errors.js.map +0 -1
- package/dist/Types/http-client.d.ts.map +0 -1
- package/dist/Types/http-client.js +0 -3
- package/dist/Types/http.d.ts +0 -5
- package/dist/Types/http.d.ts.map +0 -1
- package/dist/Types/http.js +0 -3
- package/dist/Types/http.js.map +0 -1
- package/dist/Types/index.d.ts +0 -13
- package/dist/Types/index.d.ts.map +0 -1
- package/dist/Types/index.js +0 -29
- package/dist/Types/index.js.map +0 -1
- package/dist/Types/interceptors.d.ts +0 -13
- package/dist/Types/interceptors.d.ts.map +0 -1
- package/dist/Types/interceptors.js +0 -3
- package/dist/Types/interceptors.js.map +0 -1
- package/dist/Types/metrics.d.ts +0 -90
- package/dist/Types/metrics.d.ts.map +0 -1
- package/dist/Types/metrics.js +0 -3
- package/dist/Types/metrics.js.map +0 -1
- package/dist/Types/options.d.ts +0 -233
- package/dist/Types/options.d.ts.map +0 -1
- package/dist/Types/options.js +0 -3
- package/dist/Types/options.js.map +0 -1
- package/dist/Types/queue.d.ts +0 -8
- package/dist/Types/queue.d.ts.map +0 -1
- package/dist/Types/queue.js +0 -3
- package/dist/Types/queue.js.map +0 -1
- package/dist/Types/request.d.ts +0 -189
- package/dist/Types/request.d.ts.map +0 -1
- package/dist/Types/request.js +0 -3
- package/dist/Types/request.js.map +0 -1
- package/dist/Types/response.d.ts +0 -28
- package/dist/Types/response.d.ts.map +0 -1
- package/dist/Types/response.js +0 -3
- package/dist/Types/response.js.map +0 -1
- package/dist/Types/stream.d.ts +0 -39
- package/dist/Types/stream.d.ts.map +0 -1
- package/dist/Types/stream.js +0 -3
- package/dist/Types/stream.js.map +0 -1
- package/dist/Types/url-extractor.js +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- /package/{dist/Types → Types}/http-client.js.map +0 -0
- /package/{dist/Types → Types}/url-extractor.d.ts +0 -0
- /package/{dist/Types → Types}/url-extractor.d.ts.map +0 -0
- /package/{dist/Types → Types}/url-extractor.js.map +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const defaultConfig = {
|
|
2
|
+
network: {
|
|
3
|
+
timeout: 30000,
|
|
4
|
+
maxConcurrent: 500,
|
|
5
|
+
allowHttp2: true,
|
|
6
|
+
pipelining: 10,
|
|
7
|
+
keepAliveTimeout: 30000,
|
|
8
|
+
followRedirects: true,
|
|
9
|
+
maxRedirects: 5,
|
|
10
|
+
rejectUnauthorized: true,
|
|
11
|
+
userAgent: "Hyperttp/2.0",
|
|
12
|
+
},
|
|
13
|
+
retry: {
|
|
14
|
+
maxRetries: 3,
|
|
15
|
+
baseDelay: 100,
|
|
16
|
+
maxDelay: 5000,
|
|
17
|
+
jitter: true,
|
|
18
|
+
},
|
|
19
|
+
metrics: {
|
|
20
|
+
enabled: true,
|
|
21
|
+
},
|
|
22
|
+
cache: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
ttl: 60000,
|
|
25
|
+
},
|
|
26
|
+
interceptors: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
},
|
|
29
|
+
rateLimit: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
maxRequests: 10000,
|
|
32
|
+
windowMs: 1000,
|
|
33
|
+
},
|
|
34
|
+
queue: {
|
|
35
|
+
enabled: true,
|
|
36
|
+
},
|
|
37
|
+
verbose: false,
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=defaultConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultConfig.js","sourceRoot":"","sources":["../../src/Hyperttp/defaultConfig.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,aAAa,EAAE,GAAG;QAClB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,EAAE;QACd,gBAAgB,EAAE,KAAK;QACvB,eAAe,EAAE,IAAI;QACrB,YAAY,EAAE,CAAC;QACf,kBAAkB,EAAE,IAAI;QACxB,SAAS,EAAE,cAAc;KAC1B;IAED,KAAK,EAAE;QACL,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,GAAG;QACd,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb;IAED,OAAO,EAAE;QACP,OAAO,EAAE,IAAI;KACd;IAED,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,KAAK;KACX;IAED,YAAY,EAAE;QACZ,OAAO,EAAE,IAAI;KACd;IAED,SAAS,EAAE;QACT,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;KACf;IAED,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;KACd;IAED,OAAO,EAAE,KAAK;CACf,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { HyperClient } from "./Client/HyperClient.js";
|
|
2
|
+
export { default as Request } from "./Request.js";
|
|
3
|
+
export { PreparedRequest } from "./Request.js";
|
|
4
|
+
export { default as UrlExtractor } from "./UrlExtractor.js";
|
|
5
|
+
export * from "./Utils/index.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Hyperttp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { HyperClient } from "./Client/HyperClient.js";
|
|
2
|
+
export { default as Request } from "./Request.js";
|
|
3
|
+
export { PreparedRequest } from "./Request.js";
|
|
4
|
+
export { default as UrlExtractor } from "./UrlExtractor.js";
|
|
5
|
+
export * from "./Utils/index.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Hyperttp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ResponseType } from "
|
|
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";
|
|
1
|
+
import { RequestBuilder } from "../Hyperttp/Utils/RequestBuilder.js";
|
|
2
|
+
import type { HttpClientOptions, RequestInterface, RequestMetrics, ResponseType, StreamResponse } from "@hyperttp/core";
|
|
7
3
|
export interface HttpClientStats {
|
|
8
4
|
cacheSize: number;
|
|
9
5
|
inflightRequests: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/Types/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAEpC,GAAG,CAAC,CAAC,GAAG,OAAO,EACb,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAC9B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,IAAI,CAAC,CAAC,GAAG,OAAO,EACd,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAC9B,IAAI,CAAC,EAAE,GAAG,EACV,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,GAAG,CAAC,CAAC,GAAG,OAAO,EACb,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAC9B,IAAI,CAAC,EAAE,GAAG,EACV,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,KAAK,CAAC,CAAC,GAAG,OAAO,EACf,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAC9B,IAAI,CAAC,EAAE,GAAG,EACV,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd,MAAM,CAAC,CAAC,GAAG,OAAO,EAChB,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAC9B,YAAY,CAAC,EAAE,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,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC;IAErC,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"}
|
package/Types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/Types/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { Request, PreparedRequest, UrlExtractor, HyperClient, } from "./Hyperttp/index.js";
|
|
2
|
+
export * from "./Types/index.js";
|
|
3
|
+
export type * from "./Types/index.js";
|
|
4
|
+
export * from "@hyperttp/cache";
|
|
5
|
+
export * from "@hyperttp/parser";
|
|
6
|
+
export * from "@hyperttp/inflight";
|
|
7
|
+
export * from "@hyperttp/interceptors";
|
|
8
|
+
export * from "@hyperttp/metrics";
|
|
9
|
+
export * from "@hyperttp/queue";
|
|
10
|
+
export * from "@hyperttp/serializer";
|
|
11
|
+
export * from "@hyperttp/ratelimit";
|
|
12
|
+
export * from "@hyperttp/retry";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAE7B,cAAc,kBAAkB,CAAC;AAEjC,mBAAmB,kBAAkB,CAAC;AAEtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { Request, PreparedRequest, UrlExtractor, HyperClient, } from "./Hyperttp/index.js";
|
|
2
|
+
export * from "./Types/index.js";
|
|
3
|
+
export * from "@hyperttp/cache";
|
|
4
|
+
export * from "@hyperttp/parser";
|
|
5
|
+
export * from "@hyperttp/inflight";
|
|
6
|
+
export * from "@hyperttp/interceptors";
|
|
7
|
+
export * from "@hyperttp/metrics";
|
|
8
|
+
export * from "@hyperttp/queue";
|
|
9
|
+
export * from "@hyperttp/serializer";
|
|
10
|
+
export * from "@hyperttp/ratelimit";
|
|
11
|
+
export * from "@hyperttp/retry";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAE7B,cAAc,kBAAkB,CAAC;AAIjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperttp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A high-performance, universal HTTP client for Node.js with caching, retries, queueing, rate limiting, cookies and logging.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
7
8
|
"author": "dirold2",
|
|
8
9
|
"license": "MIT",
|
|
9
10
|
"repository": {
|
|
@@ -22,13 +23,23 @@
|
|
|
22
23
|
"cookies",
|
|
23
24
|
"logger"
|
|
24
25
|
],
|
|
26
|
+
"exports": {
|
|
27
|
+
"./*": {
|
|
28
|
+
"types": "./Types/*.d.ts",
|
|
29
|
+
"import": "./Types/*.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
25
32
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
+
"@hyperttp/core": "^1.1.7",
|
|
34
|
+
"@hyperttp/cache": "^1.0.13",
|
|
35
|
+
"@hyperttp/parser": "^1.0.18",
|
|
36
|
+
"@hyperttp/inflight": "^1.0.4",
|
|
37
|
+
"@hyperttp/interceptors": "^1.0.3",
|
|
38
|
+
"@hyperttp/metrics": "^1.0.3",
|
|
39
|
+
"@hyperttp/queue": "^1.0.3",
|
|
40
|
+
"@hyperttp/profiler": "^1.0.1",
|
|
41
|
+
"@hyperttp/serializer": "^1.0.4",
|
|
42
|
+
"@hyperttp/ratelimit": "^1.0.4",
|
|
43
|
+
"@hyperttp/retry": "^1.0.1"
|
|
33
44
|
}
|
|
34
|
-
}
|
|
45
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 [Your Name or Organization]
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# Hyperttp
|
|
2
|
-
|
|
3
|
-
Advanced HTTP client for Node.js with caching, rate limiting, request queuing, automatic retries, cookie management, and automatic JSON/XML parsing.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Automatic request deduplication
|
|
8
|
-
- LRU caching with TTL
|
|
9
|
-
- Configurable rate limiting
|
|
10
|
-
- Concurrent request management
|
|
11
|
-
- Exponential backoff with jitter for retries
|
|
12
|
-
- Cookie jar support
|
|
13
|
-
- Automatic response parsing (JSON/XML/text/buffer)
|
|
14
|
-
- Automatic handling of redirects
|
|
15
|
-
- Fluent request builder API
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install hyperttp
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 🚀 Simple Usage
|
|
26
|
-
|
|
27
|
-
Get started in seconds — just import and make requests:
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import HttpClientImproved from "hyperttp";
|
|
31
|
-
|
|
32
|
-
const client = new HttpClientImproved();
|
|
33
|
-
|
|
34
|
-
// Simple GET request
|
|
35
|
-
const data = await client.get("https://api.example.com/data");
|
|
36
|
-
console.log(data);
|
|
37
|
-
|
|
38
|
-
// POST request with JSON body
|
|
39
|
-
const postData = await client.post("https://api.example.com/items", {
|
|
40
|
-
name: "Item 1",
|
|
41
|
-
});
|
|
42
|
-
console.log(postData);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**That's it!** Caching, request queuing, and retries are enabled by default.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## ⚙️ Advanced Configuration
|
|
50
|
-
|
|
51
|
-
Configure all components for your specific needs:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
import HttpClientImproved from "hyperttp";
|
|
55
|
-
|
|
56
|
-
const client = new HttpClientImproved({
|
|
57
|
-
// 🌐 Network settings
|
|
58
|
-
network: {
|
|
59
|
-
timeout: 10000, // Request timeout (ms)
|
|
60
|
-
maxConcurrent: 50, // Max concurrent requests
|
|
61
|
-
maxRedirects: 5, // Max redirects to follow
|
|
62
|
-
followRedirects: true, // Follow redirects automatically
|
|
63
|
-
userAgent: "MyApp/1.0", // User-Agent header
|
|
64
|
-
allowHttp2: true, // Enable HTTP/2
|
|
65
|
-
pipelining: 10, // Request pipelining
|
|
66
|
-
keepAliveTimeout: 30000, // Keep-alive timeout
|
|
67
|
-
rejectUnauthorized: false, // Skip SSL certificate validation
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
// 💾 Caching (LRU cache)
|
|
71
|
-
cache: {
|
|
72
|
-
enabled: true, // Enable caching
|
|
73
|
-
ttl: 1000 * 60 * 5, // Cache TTL (5 minutes)
|
|
74
|
-
maxSize: 500, // Max cache size (entries)
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
// 🚦 Rate Limiting (Token Bucket)
|
|
78
|
-
rateLimit: {
|
|
79
|
-
enabled: true, // Enable rate limiting
|
|
80
|
-
maxRequests: 100, // Max requests per window
|
|
81
|
-
windowMs: 60000, // Time window (ms)
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
// 📊 Request Queue
|
|
85
|
-
queue: {
|
|
86
|
-
enabled: true, // Enable request queue
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
// 🔄 Retry Logic
|
|
90
|
-
retry: {
|
|
91
|
-
maxRetries: 3, // Max retry attempts
|
|
92
|
-
baseDelay: 1000, // Base delay between retries (ms)
|
|
93
|
-
maxDelay: 10000, // Max delay (ms)
|
|
94
|
-
jitter: true, // Add randomization to delays
|
|
95
|
-
retryStatusCodes: [408, 429, 500, 502, 503, 504],
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
// 📈 Metrics
|
|
99
|
-
metrics: {
|
|
100
|
-
enabled: true, // Enable metrics collection
|
|
101
|
-
maxHistory: 1000, // Metrics history size
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
// 🔍 Logging
|
|
105
|
-
verbose: true, // Enable verbose logging
|
|
106
|
-
logger: (level, msg) => console.log(`[${level}] ${msg}`),
|
|
107
|
-
});
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Using Advanced Features
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
// Using Fluent RequestBuilder
|
|
114
|
-
const result = await client
|
|
115
|
-
.request("https://api.example.com/search")
|
|
116
|
-
.query({ q: "hyperttp", limit: 10 })
|
|
117
|
-
.headers({ Authorization: "Bearer TOKEN" })
|
|
118
|
-
.json()
|
|
119
|
-
.send();
|
|
120
|
-
|
|
121
|
-
console.log(result);
|
|
122
|
-
|
|
123
|
-
// Get client statistics
|
|
124
|
-
const stats = client.getStats();
|
|
125
|
-
console.log({
|
|
126
|
-
cacheSize: stats.cacheSize, // Current cache size
|
|
127
|
-
inflightRequests: stats.inflightRequests, // Active requests
|
|
128
|
-
queuedRequests: stats.queuedRequests, // Requests waiting in queue
|
|
129
|
-
activeRequests: stats.activeRequests, // Currently executing
|
|
130
|
-
currentRateLimit: stats.currentRateLimit, // Used rate limit slots
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// Work with metrics
|
|
134
|
-
const metrics = client.getMetrics("https://api.example.com/data");
|
|
135
|
-
console.log(metrics); // Timing, bytes, retries, cache hits
|
|
136
|
-
|
|
137
|
-
// Clear cache
|
|
138
|
-
client.clearCache();
|
|
139
|
-
|
|
140
|
-
// Clear metrics
|
|
141
|
-
client.clearMetrics();
|
|
142
|
-
|
|
143
|
-
// Graceful shutdown
|
|
144
|
-
await client.destroy();
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Fluent Builder API
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
client
|
|
153
|
-
.request("https://api.example.com/data")
|
|
154
|
-
.get() // default
|
|
155
|
-
.headers({ "X-Test": "123" })
|
|
156
|
-
.query({ page: 1 })
|
|
157
|
-
.json() // or .text(), .xml()
|
|
158
|
-
.send()
|
|
159
|
-
.then(console.log);
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## Architecture Components
|
|
165
|
-
|
|
166
|
-
### 💾 CacheManager
|
|
167
|
-
LRU cache with TTL and metadata support (etag, lastModified):
|
|
168
|
-
- Automatically caches GET/HEAD responses
|
|
169
|
-
- Configurable size and TTL
|
|
170
|
-
- Methods: `get()`, `set()`, `getWithMetadata()`, `setWithMetadata()`
|
|
171
|
-
|
|
172
|
-
### 📊 QueueManager
|
|
173
|
-
Request queue management:
|
|
174
|
-
- Concurrency control (maxConcurrent)
|
|
175
|
-
- FIFO processing of pending requests
|
|
176
|
-
- Methods: `enqueue()`, `activeCount`, `queuedCount`
|
|
177
|
-
|
|
178
|
-
### 🚦 RateLimiter
|
|
179
|
-
Token bucket algorithm with wait queue:
|
|
180
|
-
- Smooth rate limiting
|
|
181
|
-
- FIFO waiting when limit exceeded
|
|
182
|
-
- Methods: `wait()`, `tryConsume()`, `remainingRequests`
|
|
183
|
-
|
|
184
|
-
### 📈 MetricsManager
|
|
185
|
-
Performance metrics collection and analysis:
|
|
186
|
-
- Request timing
|
|
187
|
-
- Bytes sent/received
|
|
188
|
-
- Cache hits/misses
|
|
189
|
-
- Retry counts
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## Documentation
|
|
194
|
-
|
|
195
|
-
- [Русский](https://github.com/Dirold2/hyperttp/blob/main/lang/ru/README.md)
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { CacheManagerOptions } from "../../Types/cache";
|
|
2
|
-
/**
|
|
3
|
-
* @class CacheManager
|
|
4
|
-
* @en High-performance in-memory cache based on LRU strategy.
|
|
5
|
-
* Provides TTL support, metadata storage (etag, lastModified) and fast key-value access.
|
|
6
|
-
*
|
|
7
|
-
* @ru Высокопроизводительный in-memory кэш на основе LRU стратегии.
|
|
8
|
-
* Поддерживает TTL, хранение метаданных (etag, lastModified) и быстрый доступ по ключу.
|
|
9
|
-
*/
|
|
10
|
-
export declare class CacheManager {
|
|
11
|
-
private readonly cache;
|
|
12
|
-
constructor(options?: CacheManagerOptions);
|
|
13
|
-
/**
|
|
14
|
-
* @en Retrieves cached value by key.
|
|
15
|
-
* @ru Получает значение из кэша по ключу.
|
|
16
|
-
*
|
|
17
|
-
* @template T
|
|
18
|
-
* @param key Cache key
|
|
19
|
-
* @returns Cached value or undefined if not found
|
|
20
|
-
*/
|
|
21
|
-
get<T>(key: string): T | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* @en Stores value in cache.
|
|
24
|
-
* @ru Сохраняет значение в кэш.
|
|
25
|
-
*
|
|
26
|
-
* @template T
|
|
27
|
-
* @param key Cache key
|
|
28
|
-
* @param value Value to store
|
|
29
|
-
*/
|
|
30
|
-
set<T>(key: string, value: T): void;
|
|
31
|
-
/**
|
|
32
|
-
* @en Retrieves cached entry with metadata (etag, lastModified).
|
|
33
|
-
* @ru Получает запись кэша вместе с метаданными (etag, lastModified).
|
|
34
|
-
*
|
|
35
|
-
* @template T
|
|
36
|
-
* @param key Cache key
|
|
37
|
-
* @returns Cached entry with metadata or undefined
|
|
38
|
-
*/
|
|
39
|
-
getWithMetadata<T>(key: string): {
|
|
40
|
-
data: T;
|
|
41
|
-
etag?: string;
|
|
42
|
-
lastModified?: string;
|
|
43
|
-
} | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* @en Stores value with optional HTTP metadata (etag, lastModified).
|
|
46
|
-
* @ru Сохраняет значение с дополнительными HTTP метаданными (etag, lastModified).
|
|
47
|
-
*
|
|
48
|
-
* @template T
|
|
49
|
-
* @param key Cache key
|
|
50
|
-
* @param data Value to store
|
|
51
|
-
* @param meta Optional HTTP metadata
|
|
52
|
-
*/
|
|
53
|
-
setWithMetadata<T>(key: string, data: T, meta?: {
|
|
54
|
-
etag?: string;
|
|
55
|
-
lastModified?: string;
|
|
56
|
-
}): void;
|
|
57
|
-
/**
|
|
58
|
-
* @en Checks if key exists in cache.
|
|
59
|
-
* @ru Проверяет наличие ключа в кэше.
|
|
60
|
-
*
|
|
61
|
-
* @param key Cache key
|
|
62
|
-
* @returns true if exists, otherwise false
|
|
63
|
-
*/
|
|
64
|
-
has(key: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* @en Deletes value from cache by key.
|
|
67
|
-
* @ru Удаляет значение из кэша по ключу.
|
|
68
|
-
*
|
|
69
|
-
* @param key Cache key
|
|
70
|
-
* @returns true if value was removed
|
|
71
|
-
*/
|
|
72
|
-
delete(key: string): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* @en Clears entire cache.
|
|
75
|
-
* @ru Очищает весь кэш.
|
|
76
|
-
*/
|
|
77
|
-
clear(): void;
|
|
78
|
-
/**
|
|
79
|
-
* @en Returns current cache size.
|
|
80
|
-
* @ru Возвращает текущий размер кэша.
|
|
81
|
-
*/
|
|
82
|
-
get size(): number;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=CacheManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CacheManager.d.ts","sourceRoot":"","sources":["../../../src/Hyperttp/Core/CacheManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEpE;;;;;;;GAOG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;gBAE9C,OAAO,CAAC,EAAE,mBAAmB;IAQzC;;;;;;;OAOG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIlC;;;;;;;OAOG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAMnC;;;;;;;OAOG;IACH,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAC1B;QACE,IAAI,EAAE,CAAC,CAAC;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACD,SAAS;IAIb;;;;;;;;OAQG;IACH,eAAe,CAAC,CAAC,EACf,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACA,IAAI;IAQP;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CacheManager = void 0;
|
|
4
|
-
const lru_cache_1 = require("lru-cache");
|
|
5
|
-
/**
|
|
6
|
-
* @class CacheManager
|
|
7
|
-
* @en High-performance in-memory cache based on LRU strategy.
|
|
8
|
-
* Provides TTL support, metadata storage (etag, lastModified) and fast key-value access.
|
|
9
|
-
*
|
|
10
|
-
* @ru Высокопроизводительный in-memory кэш на основе LRU стратегии.
|
|
11
|
-
* Поддерживает TTL, хранение метаданных (etag, lastModified) и быстрый доступ по ключу.
|
|
12
|
-
*/
|
|
13
|
-
class CacheManager {
|
|
14
|
-
cache;
|
|
15
|
-
constructor(options) {
|
|
16
|
-
this.cache = new lru_cache_1.LRUCache({
|
|
17
|
-
max: options?.cacheMaxSize ?? 500,
|
|
18
|
-
ttl: options?.cacheTTL ?? 300_000,
|
|
19
|
-
updateAgeOnGet: true,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @en Retrieves cached value by key.
|
|
24
|
-
* @ru Получает значение из кэша по ключу.
|
|
25
|
-
*
|
|
26
|
-
* @template T
|
|
27
|
-
* @param key Cache key
|
|
28
|
-
* @returns Cached value or undefined if not found
|
|
29
|
-
*/
|
|
30
|
-
get(key) {
|
|
31
|
-
return this.cache.get(key)?.data;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @en Stores value in cache.
|
|
35
|
-
* @ru Сохраняет значение в кэш.
|
|
36
|
-
*
|
|
37
|
-
* @template T
|
|
38
|
-
* @param key Cache key
|
|
39
|
-
* @param value Value to store
|
|
40
|
-
*/
|
|
41
|
-
set(key, value) {
|
|
42
|
-
this.cache.set(key, {
|
|
43
|
-
data: value,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @en Retrieves cached entry with metadata (etag, lastModified).
|
|
48
|
-
* @ru Получает запись кэша вместе с метаданными (etag, lastModified).
|
|
49
|
-
*
|
|
50
|
-
* @template T
|
|
51
|
-
* @param key Cache key
|
|
52
|
-
* @returns Cached entry with metadata or undefined
|
|
53
|
-
*/
|
|
54
|
-
getWithMetadata(key) {
|
|
55
|
-
return this.cache.get(key);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @en Stores value with optional HTTP metadata (etag, lastModified).
|
|
59
|
-
* @ru Сохраняет значение с дополнительными HTTP метаданными (etag, lastModified).
|
|
60
|
-
*
|
|
61
|
-
* @template T
|
|
62
|
-
* @param key Cache key
|
|
63
|
-
* @param data Value to store
|
|
64
|
-
* @param meta Optional HTTP metadata
|
|
65
|
-
*/
|
|
66
|
-
setWithMetadata(key, data, meta) {
|
|
67
|
-
this.cache.set(key, {
|
|
68
|
-
data,
|
|
69
|
-
etag: meta?.etag,
|
|
70
|
-
lastModified: meta?.lastModified,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @en Checks if key exists in cache.
|
|
75
|
-
* @ru Проверяет наличие ключа в кэше.
|
|
76
|
-
*
|
|
77
|
-
* @param key Cache key
|
|
78
|
-
* @returns true if exists, otherwise false
|
|
79
|
-
*/
|
|
80
|
-
has(key) {
|
|
81
|
-
return this.cache.has(key);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @en Deletes value from cache by key.
|
|
85
|
-
* @ru Удаляет значение из кэша по ключу.
|
|
86
|
-
*
|
|
87
|
-
* @param key Cache key
|
|
88
|
-
* @returns true if value was removed
|
|
89
|
-
*/
|
|
90
|
-
delete(key) {
|
|
91
|
-
return this.cache.delete(key);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* @en Clears entire cache.
|
|
95
|
-
* @ru Очищает весь кэш.
|
|
96
|
-
*/
|
|
97
|
-
clear() {
|
|
98
|
-
this.cache.clear();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @en Returns current cache size.
|
|
102
|
-
* @ru Возвращает текущий размер кэша.
|
|
103
|
-
*/
|
|
104
|
-
get size() {
|
|
105
|
-
return this.cache.size;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.CacheManager = CacheManager;
|
|
109
|
-
//# sourceMappingURL=CacheManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CacheManager.js","sourceRoot":"","sources":["../../../src/Hyperttp/Core/CacheManager.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAGrC;;;;;;;GAOG;AACH,MAAa,YAAY;IACN,KAAK,CAAoC;IAE1D,YAAY,OAA6B;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,oBAAQ,CAAC;YACxB,GAAG,EAAE,OAAO,EAAE,YAAY,IAAI,GAAG;YACjC,GAAG,EAAE,OAAO,EAAE,QAAQ,IAAI,OAAO;YACjC,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAI,GAAW;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IACnC,CAAC;IAED;;;;;;;OAOG;IACH,GAAG,CAAI,GAAW,EAAE,KAAQ;QAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YAClB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,eAAe,CAAI,GAAW;QAO5B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,eAAe,CACb,GAAW,EACX,IAAO,EACP,IAGC;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YAClB,IAAI;YACJ,IAAI,EAAE,IAAI,EAAE,IAAI;YAChB,YAAY,EAAE,IAAI,EAAE,YAAY;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;CACF;AApHD,oCAoHC"}
|