rdapify 0.1.1 → 0.1.2

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 (77) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/README.md +206 -18
  3. package/dist/application/client/RDAPClient.d.ts +21 -0
  4. package/dist/application/client/RDAPClient.d.ts.map +1 -1
  5. package/dist/application/client/RDAPClient.js +60 -6
  6. package/dist/application/client/RDAPClient.js.map +1 -1
  7. package/dist/application/services/BatchProcessor.d.ts +27 -0
  8. package/dist/application/services/BatchProcessor.d.ts.map +1 -0
  9. package/dist/application/services/BatchProcessor.js +89 -0
  10. package/dist/application/services/BatchProcessor.js.map +1 -0
  11. package/dist/application/services/QueryOrchestrator.d.ts +7 -3
  12. package/dist/application/services/QueryOrchestrator.d.ts.map +1 -1
  13. package/dist/application/services/QueryOrchestrator.js +183 -41
  14. package/dist/application/services/QueryOrchestrator.js.map +1 -1
  15. package/dist/application/services/QueryPriority.d.ts +35 -0
  16. package/dist/application/services/QueryPriority.d.ts.map +1 -0
  17. package/dist/application/services/QueryPriority.js +114 -0
  18. package/dist/application/services/QueryPriority.js.map +1 -0
  19. package/dist/application/services/index.d.ts +1 -0
  20. package/dist/application/services/index.d.ts.map +1 -1
  21. package/dist/application/services/index.js +3 -1
  22. package/dist/application/services/index.js.map +1 -1
  23. package/dist/index.d.ts +16 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +31 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/infrastructure/cache/PersistentCache.d.ts +39 -0
  28. package/dist/infrastructure/cache/PersistentCache.d.ts.map +1 -0
  29. package/dist/infrastructure/cache/PersistentCache.js +194 -0
  30. package/dist/infrastructure/cache/PersistentCache.js.map +1 -0
  31. package/dist/infrastructure/http/AuthenticationManager.d.ts +38 -0
  32. package/dist/infrastructure/http/AuthenticationManager.d.ts.map +1 -0
  33. package/dist/infrastructure/http/AuthenticationManager.js +99 -0
  34. package/dist/infrastructure/http/AuthenticationManager.js.map +1 -0
  35. package/dist/infrastructure/http/CompressionManager.d.ts +30 -0
  36. package/dist/infrastructure/http/CompressionManager.d.ts.map +1 -0
  37. package/dist/infrastructure/http/CompressionManager.js +86 -0
  38. package/dist/infrastructure/http/CompressionManager.js.map +1 -0
  39. package/dist/infrastructure/http/ConnectionPool.d.ts +25 -0
  40. package/dist/infrastructure/http/ConnectionPool.d.ts.map +1 -0
  41. package/dist/infrastructure/http/ConnectionPool.js +101 -0
  42. package/dist/infrastructure/http/ConnectionPool.js.map +1 -0
  43. package/dist/infrastructure/http/ProxyManager.d.ts +43 -0
  44. package/dist/infrastructure/http/ProxyManager.d.ts.map +1 -0
  45. package/dist/infrastructure/http/ProxyManager.js +87 -0
  46. package/dist/infrastructure/http/ProxyManager.js.map +1 -0
  47. package/dist/infrastructure/http/RateLimiter.d.ts +28 -0
  48. package/dist/infrastructure/http/RateLimiter.d.ts.map +1 -0
  49. package/dist/infrastructure/http/RateLimiter.js +101 -0
  50. package/dist/infrastructure/http/RateLimiter.js.map +1 -0
  51. package/dist/infrastructure/http/RetryStrategy.d.ts +58 -0
  52. package/dist/infrastructure/http/RetryStrategy.d.ts.map +1 -0
  53. package/dist/infrastructure/http/RetryStrategy.js +136 -0
  54. package/dist/infrastructure/http/RetryStrategy.js.map +1 -0
  55. package/dist/infrastructure/logging/Logger.d.ts +49 -0
  56. package/dist/infrastructure/logging/Logger.d.ts.map +1 -0
  57. package/dist/infrastructure/logging/Logger.js +126 -0
  58. package/dist/infrastructure/logging/Logger.js.map +1 -0
  59. package/dist/infrastructure/monitoring/MetricsCollector.d.ts +53 -0
  60. package/dist/infrastructure/monitoring/MetricsCollector.d.ts.map +1 -0
  61. package/dist/infrastructure/monitoring/MetricsCollector.js +109 -0
  62. package/dist/infrastructure/monitoring/MetricsCollector.js.map +1 -0
  63. package/dist/infrastructure/security/SSRFProtection.js +1 -1
  64. package/dist/infrastructure/security/SSRFProtection.js.map +1 -1
  65. package/dist/shared/errors/base.error.d.ts +11 -6
  66. package/dist/shared/errors/base.error.d.ts.map +1 -1
  67. package/dist/shared/errors/base.error.js +42 -11
  68. package/dist/shared/errors/base.error.js.map +1 -1
  69. package/dist/shared/types/generics.d.ts +32 -0
  70. package/dist/shared/types/generics.d.ts.map +1 -0
  71. package/dist/shared/types/generics.js +3 -0
  72. package/dist/shared/types/generics.js.map +1 -0
  73. package/dist/shared/utils/enhanced-validators.d.ts +18 -0
  74. package/dist/shared/utils/enhanced-validators.d.ts.map +1 -0
  75. package/dist/shared/utils/enhanced-validators.js +162 -0
  76. package/dist/shared/utils/enhanced-validators.js.map +1 -0
  77. package/package.json +20 -3
package/dist/index.d.ts CHANGED
@@ -1,10 +1,26 @@
1
1
  export { RDAPClient } from './application/client';
2
2
  export type { DomainResponse, IPResponse, ASNResponse, RDAPResponse, RDAPEvent, RDAPEntity, RDAPLink, RDAPRemark, RDAPNameserver, RawRDAPResponse, QueryType, ObjectClass, RDAPStatus, EventType, RoleType, CacheStrategy, BackoffStrategy, LogLevel, } from './shared/types';
3
+ export type { QueryTypeLiteral, QueryResult, QueryResultMap, BatchQueryResult, TypedQueryOptions, } from './shared/types/generics';
3
4
  export type { RDAPClientOptions, RetryOptions, CacheOptions, SSRFProtectionOptions, PrivacyOptions, TimeoutOptions, LoggingOptions, RateLimitOptions, } from './shared/types/options';
4
5
  export { RDAPifyError, SSRFProtectionError, NetworkError, TimeoutError, RDAPServerError, NoServerFoundError, ValidationError, ParseError, CacheError, RateLimitError, isRDAPifyError, isSSRFProtectionError, isNetworkError, isTimeoutError, isRateLimitError, } from './shared/errors';
5
6
  export { validateDomain, validateIP, validateIPv4, validateIPv6, validateASN, isPrivateIP, isLocalhost, isLinkLocal, normalizeDomain, normalizeIP, normalizeASN, } from './shared/utils/validators';
6
7
  export type { ICachePort } from './core/ports';
7
8
  export declare const VERSION = "0.1.0-alpha.4";
9
+ export { BatchProcessor } from './application/services/BatchProcessor';
10
+ export { RateLimiter } from './infrastructure/http/RateLimiter';
11
+ export { ConnectionPool } from './infrastructure/http/ConnectionPool';
12
+ export { MetricsCollector } from './infrastructure/monitoring/MetricsCollector';
13
+ export { Logger } from './infrastructure/logging/Logger';
14
+ export { RetryStrategy } from './infrastructure/http/RetryStrategy';
15
+ export { QueryPriorityQueue } from './application/services/QueryPriority';
16
+ export { PersistentCache } from './infrastructure/cache/PersistentCache';
17
+ export { validateIdnDomain, validateIpv6WithZone, validateAsnRange, isIdnDomain, isPunycodeDomain, idnToAscii, asciiToIdn, } from './shared/utils/enhanced-validators';
18
+ export { AuthenticationManager } from './infrastructure/http/AuthenticationManager';
19
+ export type { AuthenticationOptions, AuthType, OAuth2Options } from './infrastructure/http/AuthenticationManager';
20
+ export { ProxyManager } from './infrastructure/http/ProxyManager';
21
+ export type { ProxyOptions, ProxyProtocol } from './infrastructure/http/ProxyManager';
22
+ export { CompressionManager } from './infrastructure/http/CompressionManager';
23
+ export type { CompressionOptions, CompressionType } from './infrastructure/http/CompressionManager';
8
24
  import { RDAPClient as RDAPClientClass } from './application/client';
9
25
  export default RDAPClientClass;
10
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMlD,YAAY,EAEV,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,cAAc,EACd,eAAe,EAGf,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,eAAe,EACf,QAAQ,GACT,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAEV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAoBhC,OAAO,EACL,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AAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAgBpG,OAAO,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACrE,eAAe,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VERSION = exports.normalizeASN = exports.normalizeIP = exports.normalizeDomain = exports.isLinkLocal = exports.isLocalhost = exports.isPrivateIP = exports.validateASN = exports.validateIPv6 = exports.validateIPv4 = exports.validateIP = exports.validateDomain = exports.isRateLimitError = exports.isTimeoutError = exports.isNetworkError = exports.isSSRFProtectionError = exports.isRDAPifyError = exports.RateLimitError = exports.CacheError = exports.ParseError = exports.ValidationError = exports.NoServerFoundError = exports.RDAPServerError = exports.TimeoutError = exports.NetworkError = exports.SSRFProtectionError = exports.RDAPifyError = exports.RDAPClient = void 0;
3
+ exports.CompressionManager = exports.ProxyManager = exports.AuthenticationManager = exports.asciiToIdn = exports.idnToAscii = exports.isPunycodeDomain = exports.isIdnDomain = exports.validateAsnRange = exports.validateIpv6WithZone = exports.validateIdnDomain = exports.PersistentCache = exports.QueryPriorityQueue = exports.RetryStrategy = exports.Logger = exports.MetricsCollector = exports.ConnectionPool = exports.RateLimiter = exports.BatchProcessor = exports.VERSION = exports.normalizeASN = exports.normalizeIP = exports.normalizeDomain = exports.isLinkLocal = exports.isLocalhost = exports.isPrivateIP = exports.validateASN = exports.validateIPv6 = exports.validateIPv4 = exports.validateIP = exports.validateDomain = exports.isRateLimitError = exports.isTimeoutError = exports.isNetworkError = exports.isSSRFProtectionError = exports.isRDAPifyError = exports.RateLimitError = exports.CacheError = exports.ParseError = exports.ValidationError = exports.NoServerFoundError = exports.RDAPServerError = exports.TimeoutError = exports.NetworkError = exports.SSRFProtectionError = exports.RDAPifyError = exports.RDAPClient = void 0;
4
4
  var client_1 = require("./application/client");
5
5
  Object.defineProperty(exports, "RDAPClient", { enumerable: true, get: function () { return client_1.RDAPClient; } });
6
6
  var errors_1 = require("./shared/errors");
@@ -32,6 +32,36 @@ Object.defineProperty(exports, "normalizeDomain", { enumerable: true, get: funct
32
32
  Object.defineProperty(exports, "normalizeIP", { enumerable: true, get: function () { return validators_1.normalizeIP; } });
33
33
  Object.defineProperty(exports, "normalizeASN", { enumerable: true, get: function () { return validators_1.normalizeASN; } });
34
34
  exports.VERSION = '0.1.0-alpha.4';
35
+ var BatchProcessor_1 = require("./application/services/BatchProcessor");
36
+ Object.defineProperty(exports, "BatchProcessor", { enumerable: true, get: function () { return BatchProcessor_1.BatchProcessor; } });
37
+ var RateLimiter_1 = require("./infrastructure/http/RateLimiter");
38
+ Object.defineProperty(exports, "RateLimiter", { enumerable: true, get: function () { return RateLimiter_1.RateLimiter; } });
39
+ var ConnectionPool_1 = require("./infrastructure/http/ConnectionPool");
40
+ Object.defineProperty(exports, "ConnectionPool", { enumerable: true, get: function () { return ConnectionPool_1.ConnectionPool; } });
41
+ var MetricsCollector_1 = require("./infrastructure/monitoring/MetricsCollector");
42
+ Object.defineProperty(exports, "MetricsCollector", { enumerable: true, get: function () { return MetricsCollector_1.MetricsCollector; } });
43
+ var Logger_1 = require("./infrastructure/logging/Logger");
44
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.Logger; } });
45
+ var RetryStrategy_1 = require("./infrastructure/http/RetryStrategy");
46
+ Object.defineProperty(exports, "RetryStrategy", { enumerable: true, get: function () { return RetryStrategy_1.RetryStrategy; } });
47
+ var QueryPriority_1 = require("./application/services/QueryPriority");
48
+ Object.defineProperty(exports, "QueryPriorityQueue", { enumerable: true, get: function () { return QueryPriority_1.QueryPriorityQueue; } });
49
+ var PersistentCache_1 = require("./infrastructure/cache/PersistentCache");
50
+ Object.defineProperty(exports, "PersistentCache", { enumerable: true, get: function () { return PersistentCache_1.PersistentCache; } });
51
+ var enhanced_validators_1 = require("./shared/utils/enhanced-validators");
52
+ Object.defineProperty(exports, "validateIdnDomain", { enumerable: true, get: function () { return enhanced_validators_1.validateIdnDomain; } });
53
+ Object.defineProperty(exports, "validateIpv6WithZone", { enumerable: true, get: function () { return enhanced_validators_1.validateIpv6WithZone; } });
54
+ Object.defineProperty(exports, "validateAsnRange", { enumerable: true, get: function () { return enhanced_validators_1.validateAsnRange; } });
55
+ Object.defineProperty(exports, "isIdnDomain", { enumerable: true, get: function () { return enhanced_validators_1.isIdnDomain; } });
56
+ Object.defineProperty(exports, "isPunycodeDomain", { enumerable: true, get: function () { return enhanced_validators_1.isPunycodeDomain; } });
57
+ Object.defineProperty(exports, "idnToAscii", { enumerable: true, get: function () { return enhanced_validators_1.idnToAscii; } });
58
+ Object.defineProperty(exports, "asciiToIdn", { enumerable: true, get: function () { return enhanced_validators_1.asciiToIdn; } });
59
+ var AuthenticationManager_1 = require("./infrastructure/http/AuthenticationManager");
60
+ Object.defineProperty(exports, "AuthenticationManager", { enumerable: true, get: function () { return AuthenticationManager_1.AuthenticationManager; } });
61
+ var ProxyManager_1 = require("./infrastructure/http/ProxyManager");
62
+ Object.defineProperty(exports, "ProxyManager", { enumerable: true, get: function () { return ProxyManager_1.ProxyManager; } });
63
+ var CompressionManager_1 = require("./infrastructure/http/CompressionManager");
64
+ Object.defineProperty(exports, "CompressionManager", { enumerable: true, get: function () { return CompressionManager_1.CompressionManager; } });
35
65
  const client_2 = require("./application/client");
36
66
  exports.default = client_2.RDAPClient;
37
67
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA4CA,+CAAkD;AAAzC,oGAAA,UAAU,OAAA;AA4DnB,0CAkByB;AAjBvB,sGAAA,YAAY,OAAA;AACZ,6GAAA,mBAAmB,OAAA;AACnB,sGAAA,YAAY,OAAA;AACZ,sGAAA,YAAY,OAAA;AACZ,yGAAA,eAAe,OAAA;AACf,4GAAA,kB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,yGAAA,WAAW,OAAA;AACX,yGAAA,WAAW,OAAA;AACX,yGAAA,WAAW,OAAA;AACX,yGAAA,WAAW,OAAA;AACX,6GAAA,eAAe,OAAA;AACf,yGAAA,WAAW,OAAA;AACX,0GAAA,YAAY,OAAA;AA8BD,QAAA,OAAO,GAAG,eAAe,CAAC;AAsBvC,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAkBvB,iEAAgE;AAAvD,0GAAA,WAAW,OAAA;AAKpB,uEAAsE;AAA7D,gHAAA,cAAc,OAAA;AAKvB,iFAAgF;AAAvE,oHAAA,gBAAgB,OAAA;AAKzB,0DAAyD;AAAhD,gGAAA,MAAM,OAAA;AAKf,qEAAoE;AAA3D,8GAAA,aAAa,OAAA;AAKtB,sEAA0E;AAAjE,mHAAA,kBAAkB,OAAA;AAK3B,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AAKxB,0EAQ4C;AAP1C,wHAAA,iBAAiB,OAAA;AACjB,2HAAA,oBAAoB,OAAA;AACpB,uHAAA,gBAAgB,OAAA;AAChB,kHAAA,WAAW,OAAA;AACX,uHAAA,gBAAgB,OAAA;AAChB,iHAAA,UAAU,OAAA;AACV,iHAAA,UAAU,OAAA;AAMZ,qFAAoF;AAA3E,8HAAA,qBAAqB,OAAA;AAM9B,mEAAkE;AAAzD,4GAAA,YAAY,OAAA;AAMrB,+EAA8E;AAArE,wHAAA,kBAAkB,OAAA;AAiB3B,iDAAqE;AACrE,kBAAe,mBAAe,CAAC"}
@@ -0,0 +1,39 @@
1
+ export interface PersistentCacheOptions {
2
+ storage?: 'file' | 'memory';
3
+ path?: string;
4
+ ttl?: number;
5
+ maxSize?: number;
6
+ autoSave?: boolean;
7
+ saveInterval?: number;
8
+ }
9
+ export declare class PersistentCache {
10
+ private cache;
11
+ private readonly storage;
12
+ private readonly filePath?;
13
+ private readonly ttl;
14
+ private readonly maxSize;
15
+ private readonly autoSave;
16
+ private saveTimer?;
17
+ private dirty;
18
+ constructor(options?: PersistentCacheOptions);
19
+ get(key: string): Promise<any | null>;
20
+ set(key: string, value: any, ttl?: number): Promise<void>;
21
+ delete(key: string): Promise<boolean>;
22
+ has(key: string): Promise<boolean>;
23
+ clear(): Promise<void>;
24
+ getStats(): Promise<{
25
+ size: number;
26
+ maxSize: number;
27
+ storage: string;
28
+ hits: number;
29
+ oldestEntry?: number;
30
+ newestEntry?: number;
31
+ }>;
32
+ private evictLRU;
33
+ private ensureCacheDirectory;
34
+ private load;
35
+ private save;
36
+ cleanup(): Promise<number>;
37
+ destroy(): void;
38
+ }
39
+ //# sourceMappingURL=PersistentCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentCache.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cache/PersistentCache.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAaD,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,SAAS,CAAC,CAAiB;IACnC,OAAO,CAAC,KAAK,CAAkB;gBAEnB,OAAO,GAAE,sBAA2B;IA0B1C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAyBrC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BzD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWrC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoBlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,QAAQ,IAAI,OAAO,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IA8BF,OAAO,CAAC,QAAQ;IAoBhB,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,IAAI;YA8BE,IAAI;IAqBZ,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAqBhC,OAAO,IAAI,IAAI;CAYhB"}
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PersistentCache = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs = tslib_1.__importStar(require("fs"));
6
+ const path = tslib_1.__importStar(require("path"));
7
+ class PersistentCache {
8
+ constructor(options = {}) {
9
+ this.cache = new Map();
10
+ this.dirty = false;
11
+ this.storage = options.storage || 'memory';
12
+ this.ttl = options.ttl || 3600000;
13
+ this.maxSize = options.maxSize || 1000;
14
+ this.autoSave = options.autoSave ?? true;
15
+ if (this.storage === 'file') {
16
+ this.filePath = options.path || path.join(process.cwd(), '.cache', 'rdap-cache.json');
17
+ this.ensureCacheDirectory();
18
+ this.load();
19
+ if (this.autoSave) {
20
+ const interval = options.saveInterval || 60000;
21
+ this.saveTimer = setInterval(() => {
22
+ if (this.dirty) {
23
+ this.save();
24
+ }
25
+ }, interval);
26
+ }
27
+ }
28
+ }
29
+ async get(key) {
30
+ const entry = this.cache.get(key);
31
+ if (!entry) {
32
+ return null;
33
+ }
34
+ if (Date.now() > entry.expires) {
35
+ this.cache.delete(key);
36
+ this.dirty = true;
37
+ return null;
38
+ }
39
+ entry.accessed = Date.now();
40
+ entry.hits++;
41
+ this.dirty = true;
42
+ return entry.value;
43
+ }
44
+ async set(key, value, ttl) {
45
+ const effectiveTtl = ttl || this.ttl;
46
+ const now = Date.now();
47
+ const entry = {
48
+ value,
49
+ expires: now + effectiveTtl,
50
+ created: now,
51
+ accessed: now,
52
+ hits: 0,
53
+ };
54
+ this.cache.set(key, entry);
55
+ this.dirty = true;
56
+ if (this.cache.size > this.maxSize) {
57
+ this.evictLRU();
58
+ }
59
+ if (this.storage === 'file' && !this.autoSave) {
60
+ await this.save();
61
+ }
62
+ }
63
+ async delete(key) {
64
+ const deleted = this.cache.delete(key);
65
+ if (deleted) {
66
+ this.dirty = true;
67
+ }
68
+ return deleted;
69
+ }
70
+ async has(key) {
71
+ const entry = this.cache.get(key);
72
+ if (!entry) {
73
+ return false;
74
+ }
75
+ if (Date.now() > entry.expires) {
76
+ this.cache.delete(key);
77
+ this.dirty = true;
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+ async clear() {
83
+ this.cache.clear();
84
+ this.dirty = true;
85
+ if (this.storage === 'file') {
86
+ await this.save();
87
+ }
88
+ }
89
+ async getStats() {
90
+ let totalHits = 0;
91
+ let oldestEntry;
92
+ let newestEntry;
93
+ for (const entry of this.cache.values()) {
94
+ totalHits += entry.hits;
95
+ if (!oldestEntry || entry.created < oldestEntry) {
96
+ oldestEntry = entry.created;
97
+ }
98
+ if (!newestEntry || entry.created > newestEntry) {
99
+ newestEntry = entry.created;
100
+ }
101
+ }
102
+ return {
103
+ size: this.cache.size,
104
+ maxSize: this.maxSize,
105
+ storage: this.storage,
106
+ hits: totalHits,
107
+ oldestEntry,
108
+ newestEntry,
109
+ };
110
+ }
111
+ evictLRU() {
112
+ let lruKey = null;
113
+ let lruTime = Infinity;
114
+ for (const [key, entry] of this.cache.entries()) {
115
+ if (entry.accessed < lruTime) {
116
+ lruTime = entry.accessed;
117
+ lruKey = key;
118
+ }
119
+ }
120
+ if (lruKey) {
121
+ this.cache.delete(lruKey);
122
+ }
123
+ }
124
+ ensureCacheDirectory() {
125
+ if (!this.filePath)
126
+ return;
127
+ const dir = path.dirname(this.filePath);
128
+ if (!fs.existsSync(dir)) {
129
+ fs.mkdirSync(dir, { recursive: true });
130
+ }
131
+ }
132
+ load() {
133
+ if (!this.filePath || !fs.existsSync(this.filePath)) {
134
+ return;
135
+ }
136
+ try {
137
+ const data = fs.readFileSync(this.filePath, 'utf-8');
138
+ const entries = JSON.parse(data);
139
+ const now = Date.now();
140
+ for (const [key, entry] of Object.entries(entries)) {
141
+ const cacheEntry = entry;
142
+ if (cacheEntry.expires > now) {
143
+ this.cache.set(key, cacheEntry);
144
+ }
145
+ }
146
+ this.dirty = false;
147
+ }
148
+ catch (error) {
149
+ console.warn('Failed to load cache:', error);
150
+ }
151
+ }
152
+ async save() {
153
+ if (!this.filePath)
154
+ return;
155
+ try {
156
+ const entries = {};
157
+ for (const [key, entry] of this.cache.entries()) {
158
+ entries[key] = entry;
159
+ }
160
+ const data = JSON.stringify(entries, null, 2);
161
+ fs.writeFileSync(this.filePath, data, 'utf-8');
162
+ this.dirty = false;
163
+ }
164
+ catch (error) {
165
+ console.error('Failed to save cache:', error);
166
+ }
167
+ }
168
+ async cleanup() {
169
+ const now = Date.now();
170
+ let removed = 0;
171
+ for (const [key, entry] of this.cache.entries()) {
172
+ if (entry.expires < now) {
173
+ this.cache.delete(key);
174
+ removed++;
175
+ }
176
+ }
177
+ if (removed > 0) {
178
+ this.dirty = true;
179
+ }
180
+ return removed;
181
+ }
182
+ destroy() {
183
+ if (this.saveTimer) {
184
+ clearInterval(this.saveTimer);
185
+ this.saveTimer = undefined;
186
+ }
187
+ if (this.storage === 'file' && this.dirty) {
188
+ this.save();
189
+ }
190
+ this.cache.clear();
191
+ }
192
+ }
193
+ exports.PersistentCache = PersistentCache;
194
+ //# sourceMappingURL=PersistentCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersistentCache.js","sourceRoot":"","sources":["../../../src/infrastructure/cache/PersistentCache.ts"],"names":[],"mappings":";;;;AAKA,+CAAyB;AACzB,mDAA6B;AAsB7B,MAAa,eAAe;IAU1B,YAAY,UAAkC,EAAE;QATxC,UAAK,GAA4B,IAAI,GAAG,EAAE,CAAC;QAO3C,UAAK,GAAY,KAAK,CAAC;QAG7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;QAEzC,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;YACtF,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;YAGZ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,IAAI,KAAK,CAAC;gBAC/C,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;oBAChC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;wBACf,IAAI,CAAC,IAAI,EAAE,CAAC;oBACd,CAAC;gBACH,CAAC,EAAE,QAAQ,CAAC,CAAC;YACf,CAAC;QACH,CAAC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;
5
+ password?: string;
6
+ token?: string;
7
+ apiKey?: string;
8
+ apiKeyHeader?: string;
9
+ oauth2?: OAuth2Options;
10
+ }
11
+ export interface OAuth2Options {
12
+ accessToken: string;
13
+ tokenType?: string;
14
+ refreshToken?: string;
15
+ expiresAt?: number;
16
+ }
17
+ export declare class AuthenticationManager {
18
+ private readonly type;
19
+ private readonly username?;
20
+ private readonly password?;
21
+ private readonly token?;
22
+ private readonly apiKey?;
23
+ private readonly apiKeyHeader;
24
+ private oauth2?;
25
+ constructor(options: AuthenticationOptions);
26
+ private validate;
27
+ getHeaders(): Record<string, string>;
28
+ isTokenExpired(): boolean;
29
+ updateOAuth2Token(options: OAuth2Options): void;
30
+ getType(): AuthType;
31
+ getInfo(): {
32
+ type: AuthType;
33
+ username?: string;
34
+ apiKeyHeader?: string;
35
+ tokenExpired?: boolean;
36
+ };
37
+ }
38
+ //# sourceMappingURL=AuthenticationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationManager.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/http/AuthenticationManager.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,MAAM,CAAC,CAAgB;gBAEnB,OAAO,EAAE,qBAAqB;IAe1C,OAAO,CAAC,QAAQ;IA+BhB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAqCpC,cAAc,IAAI,OAAO;IAWzB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAW/C,OAAO,IAAI,QAAQ;IAOnB,OAAO,IAAI;QACT,IAAI,EAAE,QAAQ,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;CAmBF"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthenticationManager = void 0;
4
+ class AuthenticationManager {
5
+ constructor(options) {
6
+ this.type = options.type;
7
+ this.username = options.username;
8
+ this.password = options.password;
9
+ this.token = options.token;
10
+ this.apiKey = options.apiKey;
11
+ this.apiKeyHeader = options.apiKeyHeader || 'X-API-Key';
12
+ this.oauth2 = options.oauth2;
13
+ this.validate();
14
+ }
15
+ validate() {
16
+ switch (this.type) {
17
+ case 'basic':
18
+ if (!this.username || !this.password) {
19
+ throw new Error('Basic auth requires username and password');
20
+ }
21
+ break;
22
+ case 'bearer':
23
+ if (!this.token) {
24
+ throw new Error('Bearer auth requires token');
25
+ }
26
+ break;
27
+ case 'apikey':
28
+ if (!this.apiKey) {
29
+ throw new Error('API key auth requires apiKey');
30
+ }
31
+ break;
32
+ case 'oauth2':
33
+ if (!this.oauth2?.accessToken) {
34
+ throw new Error('OAuth2 requires accessToken');
35
+ }
36
+ break;
37
+ }
38
+ }
39
+ getHeaders() {
40
+ const headers = {};
41
+ switch (this.type) {
42
+ case 'basic':
43
+ if (this.username && this.password) {
44
+ const credentials = Buffer.from(`${this.username}:${this.password}`).toString('base64');
45
+ headers['Authorization'] = `Basic ${credentials}`;
46
+ }
47
+ break;
48
+ case 'bearer':
49
+ if (this.token) {
50
+ headers['Authorization'] = `Bearer ${this.token}`;
51
+ }
52
+ break;
53
+ case 'apikey':
54
+ if (this.apiKey) {
55
+ headers[this.apiKeyHeader] = this.apiKey;
56
+ }
57
+ break;
58
+ case 'oauth2':
59
+ if (this.oauth2?.accessToken) {
60
+ const tokenType = this.oauth2.tokenType || 'Bearer';
61
+ headers['Authorization'] = `${tokenType} ${this.oauth2.accessToken}`;
62
+ }
63
+ break;
64
+ }
65
+ return headers;
66
+ }
67
+ isTokenExpired() {
68
+ if (this.type !== 'oauth2' || !this.oauth2?.expiresAt) {
69
+ return false;
70
+ }
71
+ return Date.now() >= this.oauth2.expiresAt;
72
+ }
73
+ updateOAuth2Token(options) {
74
+ if (this.type !== 'oauth2') {
75
+ throw new Error('Cannot update OAuth2 token for non-OAuth2 auth');
76
+ }
77
+ this.oauth2 = options;
78
+ }
79
+ getType() {
80
+ return this.type;
81
+ }
82
+ getInfo() {
83
+ const info = {
84
+ type: this.type,
85
+ };
86
+ if (this.type === 'basic' && this.username) {
87
+ info.username = this.username;
88
+ }
89
+ if (this.type === 'apikey') {
90
+ info.apiKeyHeader = this.apiKeyHeader;
91
+ }
92
+ if (this.type === 'oauth2') {
93
+ info.tokenExpired = this.isTokenExpired();
94
+ }
95
+ return info;
96
+ }
97
+ }
98
+ exports.AuthenticationManager = AuthenticationManager;
99
+ //# sourceMappingURL=AuthenticationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC7C,CAAC;IAKD,iBAAiB,CAAC,OAAsB;QACtC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;IACxB,CAAC;IAKD,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAKD,OAAO;QAML,MAAM,IAAI,GAAQ;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;QAEF,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACxC,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjJD,sDAiJC"}
@@ -0,0 +1,30 @@
1
+ export type CompressionType = 'gzip' | 'br' | 'deflate';
2
+ export interface CompressionOptions {
3
+ enabled?: boolean;
4
+ types?: CompressionType[];
5
+ threshold?: number;
6
+ }
7
+ export declare class CompressionManager {
8
+ private readonly enabled;
9
+ private readonly types;
10
+ private readonly threshold;
11
+ constructor(options?: CompressionOptions);
12
+ getAcceptEncodingHeader(): string | undefined;
13
+ decompress(data: Buffer, encoding?: string): Promise<Buffer>;
14
+ shouldCompress(size: number): boolean;
15
+ getSupportedTypes(): CompressionType[];
16
+ isSupported(type: CompressionType): boolean;
17
+ getInfo(): {
18
+ enabled: boolean;
19
+ types: CompressionType[];
20
+ threshold: number;
21
+ };
22
+ estimateRatio(originalSize: number, compressedSize: number): number;
23
+ getStats(originalSize: number, compressedSize: number): {
24
+ originalSize: number;
25
+ compressedSize: number;
26
+ savedBytes: number;
27
+ savedPercentage: number;
28
+ };
29
+ }
30
+ //# sourceMappingURL=CompressionManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompressionManager.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/http/CompressionManager.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,GAAE,kBAAuB;IAS5C,uBAAuB,IAAI,MAAM,GAAG,SAAS;IAwBvC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgClE,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOrC,iBAAiB,IAAI,eAAe,EAAE;IAOtC,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO;IAO3C,OAAO,IAAI;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,eAAe,EAAE,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;KACnB;IAWD,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;IAQnE,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG;QACtD,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;KACzB;CAWF"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompressionManager = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const zlib = tslib_1.__importStar(require("zlib"));
6
+ const util_1 = require("util");
7
+ const gunzip = (0, util_1.promisify)(zlib.gunzip);
8
+ const brotliDecompress = (0, util_1.promisify)(zlib.brotliDecompress);
9
+ class CompressionManager {
10
+ constructor(options = {}) {
11
+ this.enabled = options.enabled ?? true;
12
+ this.types = new Set(options.types || ['gzip', 'br']);
13
+ this.threshold = options.threshold || 1024;
14
+ }
15
+ getAcceptEncodingHeader() {
16
+ if (!this.enabled || this.types.size === 0) {
17
+ return undefined;
18
+ }
19
+ const encodings = [];
20
+ if (this.types.has('br')) {
21
+ encodings.push('br;q=1.0');
22
+ }
23
+ if (this.types.has('gzip')) {
24
+ encodings.push('gzip;q=0.9');
25
+ }
26
+ if (this.types.has('deflate')) {
27
+ encodings.push('deflate;q=0.8');
28
+ }
29
+ return encodings.length > 0 ? encodings.join(', ') : undefined;
30
+ }
31
+ async decompress(data, encoding) {
32
+ if (!encoding || !this.enabled) {
33
+ return data;
34
+ }
35
+ const normalizedEncoding = encoding.toLowerCase().trim();
36
+ try {
37
+ switch (normalizedEncoding) {
38
+ case 'gzip':
39
+ return await gunzip(data);
40
+ case 'br':
41
+ return await brotliDecompress(data);
42
+ case 'deflate':
43
+ return await (0, util_1.promisify)(zlib.inflate)(data);
44
+ default:
45
+ return data;
46
+ }
47
+ }
48
+ catch (error) {
49
+ console.warn(`Failed to decompress ${encoding}:`, error);
50
+ return data;
51
+ }
52
+ }
53
+ shouldCompress(size) {
54
+ return this.enabled && size >= this.threshold;
55
+ }
56
+ getSupportedTypes() {
57
+ return Array.from(this.types);
58
+ }
59
+ isSupported(type) {
60
+ return this.types.has(type);
61
+ }
62
+ getInfo() {
63
+ return {
64
+ enabled: this.enabled,
65
+ types: this.getSupportedTypes(),
66
+ threshold: this.threshold,
67
+ };
68
+ }
69
+ estimateRatio(originalSize, compressedSize) {
70
+ if (originalSize === 0)
71
+ return 0;
72
+ return ((originalSize - compressedSize) / originalSize) * 100;
73
+ }
74
+ getStats(originalSize, compressedSize) {
75
+ const savedBytes = originalSize - compressedSize;
76
+ const savedPercentage = this.estimateRatio(originalSize, compressedSize);
77
+ return {
78
+ originalSize,
79
+ compressedSize,
80
+ savedBytes,
81
+ savedPercentage,
82
+ };
83
+ }
84
+ }
85
+ exports.CompressionManager = CompressionManager;
86
+ //# sourceMappingURL=CompressionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompressionManager.js","sourceRoot":"","sources":["../../../src/infrastructure/http/CompressionManager.ts"],"names":[],"mappings":";;;;AAKA,mDAA6B;AAC7B,+BAAiC;AAEjC,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACtC,MAAM,gBAAgB,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAa1D,MAAa,kBAAkB;IAK7B,YAAY,UAA8B,EAAE;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;IAC7C,CAAC;IAKD,uBAAuB;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,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AE,CAAC;YAEf,OAAO,CAAC,IAAI,CAAC,wBAAwB,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAKD,cAAc,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC;IAChD,CAAC;IAKD,iBAAiB;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAKD,WAAW,CAAC,IAAqB;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAKD,OAAO;QAKL,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;IAKD,aAAa,CAAC,YAAoB,EAAE,cAAsB;QACxD,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,CAAC,YAAY,GAAG,cAAc,CAAC,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC;IAChE,CAAC;IAKD,QAAQ,CAAC,YAAoB,EAAE,cAAsB;QAMnD,MAAM,UAAU,GAAG,YAAY,GAAG,cAAc,CAAC;QACjD,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QAEzE,OAAO;YACL,YAAY;YACZ,cAAc;YACd,UAAU;YACV,eAAe;SAChB,CAAC;IACJ,CAAC;CACF;AAlID,gDAkIC"}
@@ -0,0 +1,25 @@
1
+ export interface ConnectionPoolOptions {
2
+ maxConnections?: number;
3
+ keepAlive?: boolean;
4
+ maxIdleTime?: number;
5
+ }
6
+ export declare class ConnectionPool {
7
+ private readonly maxConnections;
8
+ private readonly keepAlive;
9
+ private readonly maxIdleTime;
10
+ private connections;
11
+ private cleanupInterval?;
12
+ constructor(options?: ConnectionPoolOptions);
13
+ acquire(host: string): Promise<string>;
14
+ release(connectionId: string): void;
15
+ private waitForConnection;
16
+ private cleanup;
17
+ getStats(): {
18
+ totalConnections: number;
19
+ activeConnections: number;
20
+ idleConnections: number;
21
+ hosts: number;
22
+ };
23
+ destroy(): void;
24
+ }
25
+ //# sourceMappingURL=ConnectionPool.d.ts.map