rdapify 0.2.3 → 0.3.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/README.ar.md +572 -0
- package/README.md +74 -77
- package/dist/{application → cjs/application}/client/RDAPClient.js +197 -6
- package/dist/{application → cjs/application}/client/index.js +0 -1
- package/dist/{application → cjs/application}/deduplication/QueryDeduplicator.js +0 -1
- package/dist/{application → cjs/application}/hooks/MiddlewareHooks.js +0 -1
- package/dist/{application → cjs/application}/services/BatchProcessor.js +0 -1
- package/dist/{application → cjs/application}/services/QueryOrchestrator.js +0 -1
- package/dist/{application → cjs/application}/services/QueryPriority.js +0 -1
- package/dist/{application → cjs/application}/services/index.js +0 -1
- package/dist/{cli → cjs/cli}/index.js +0 -1
- package/dist/cjs/core/ports/bootstrap.port.js +2 -0
- package/dist/cjs/core/ports/cache.port.js +2 -0
- package/dist/cjs/core/ports/fetcher.port.js +2 -0
- package/dist/{core → cjs/core}/ports/index.js +0 -1
- package/dist/cjs/core/ports/normalizer.port.js +2 -0
- package/dist/cjs/core/ports/pii-redactor.port.js +2 -0
- package/dist/{index.js → cjs/index.js} +8 -4
- package/dist/{infrastructure → cjs/infrastructure}/cache/CacheManager.js +4 -1
- package/dist/{infrastructure → cjs/infrastructure}/cache/InMemoryCache.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/cache/PersistentCache.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/cache/RedisCache.js +0 -1
- package/dist/cjs/infrastructure/cache/StaleWhileRevalidateCache.js +47 -0
- package/dist/{infrastructure → cjs/infrastructure}/cache/index.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/AuthenticationManager.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/BootstrapDiscovery.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/BrowserFetcher.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/BunFetcher.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/CircuitBreaker.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/CloudflareWorkersFetcher.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/CompressionManager.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/ConnectionPool.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/DenoFetcher.js +0 -1
- package/dist/cjs/infrastructure/http/DistributedRateLimiter.js +26 -0
- package/dist/{infrastructure → cjs/infrastructure}/http/Fetcher.js +5 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/Normalizer.js +23 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/ProxyManager.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/RateLimiter.js +6 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/RetryStrategy.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/http/index.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/logging/AuditLogger.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/logging/Logger.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/monitoring/GrafanaDashboard.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/monitoring/MetricsCollector.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/monitoring/PrometheusExporter.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/monitoring/TelemetryExporter.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/native/NativeBackend.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/security/PIIRedactor.js +0 -1
- package/dist/{infrastructure → cjs/infrastructure}/security/SSRFProtection.js +23 -1
- package/dist/{infrastructure → cjs/infrastructure}/security/index.js +0 -1
- package/dist/cjs/infrastructure/telemetry/UsageTelemetry.js +89 -0
- package/dist/{infrastructure → cjs/infrastructure}/validation/ResponseValidator.js +0 -1
- package/dist/{integrations → cjs/integrations}/express.js +0 -1
- package/dist/{integrations → cjs/integrations}/graphql.js +0 -1
- package/dist/{integrations → cjs/integrations}/nestjs.js +0 -1
- package/dist/{shared → cjs/shared}/constants/http.constants.js +0 -1
- package/dist/{shared → cjs/shared}/constants/index.js +0 -1
- package/dist/{shared → cjs/shared}/constants/rdap.constants.js +0 -1
- package/dist/{shared → cjs/shared}/errors/base.error.js +7 -2
- package/dist/{shared → cjs/shared}/errors/index.js +0 -1
- package/dist/{shared → cjs/shared}/types/entities.js +0 -1
- package/dist/{shared → cjs/shared}/types/enums.js +0 -1
- package/dist/{shared → cjs/shared}/types/errors.js +0 -1
- package/dist/{shared → cjs/shared}/types/generics.js +0 -1
- package/dist/{shared → cjs/shared}/types/index.js +0 -1
- package/dist/{shared → cjs/shared}/types/options.js +5 -1
- package/dist/cjs/shared/types/responses.js +2 -0
- package/dist/{shared → cjs/shared}/utils/deprecation.js +0 -1
- package/dist/{shared → cjs/shared}/utils/enhanced-validators.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/async.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/cache.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/format.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/http.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/index.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/object.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/runtime.js +0 -1
- package/dist/{shared → cjs/shared}/utils/helpers/string.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/asn.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/config-validation.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/domain.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/entity.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/index.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/ip.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/nameserver.js +0 -1
- package/dist/{shared → cjs/shared}/utils/validators/network.js +0 -1
- package/dist/esm/application/client/RDAPClient.js +439 -0
- package/dist/esm/application/client/index.js +1 -0
- package/dist/esm/application/deduplication/QueryDeduplicator.js +41 -0
- package/dist/esm/application/hooks/MiddlewareHooks.js +79 -0
- package/dist/esm/application/services/BatchProcessor.js +145 -0
- package/dist/esm/application/services/QueryOrchestrator.js +615 -0
- package/dist/esm/application/services/QueryPriority.js +109 -0
- package/dist/esm/application/services/index.js +2 -0
- package/dist/esm/cli/index.js +297 -0
- package/dist/esm/core/ports/bootstrap.port.js +1 -0
- package/dist/esm/core/ports/cache.port.js +1 -0
- package/dist/esm/core/ports/fetcher.port.js +1 -0
- package/dist/esm/core/ports/index.js +5 -0
- package/dist/esm/core/ports/normalizer.port.js +1 -0
- package/dist/esm/core/ports/pii-redactor.port.js +1 -0
- package/dist/esm/index.js +40 -0
- package/dist/esm/infrastructure/cache/CacheManager.js +123 -0
- package/dist/esm/infrastructure/cache/InMemoryCache.js +91 -0
- package/dist/esm/infrastructure/cache/PersistentCache.js +188 -0
- package/dist/esm/infrastructure/cache/RedisCache.js +106 -0
- package/dist/esm/infrastructure/cache/StaleWhileRevalidateCache.js +43 -0
- package/dist/esm/infrastructure/cache/index.js +3 -0
- package/dist/esm/infrastructure/http/AuthenticationManager.js +94 -0
- package/dist/esm/infrastructure/http/BootstrapDiscovery.js +189 -0
- package/dist/esm/infrastructure/http/BrowserFetcher.js +42 -0
- package/dist/esm/infrastructure/http/BunFetcher.js +46 -0
- package/dist/esm/infrastructure/http/CircuitBreaker.js +98 -0
- package/dist/esm/infrastructure/http/CloudflareWorkersFetcher.js +39 -0
- package/dist/esm/infrastructure/http/CompressionManager.js +80 -0
- package/dist/esm/infrastructure/http/ConnectionPool.js +101 -0
- package/dist/esm/infrastructure/http/DenoFetcher.js +38 -0
- package/dist/esm/infrastructure/http/DistributedRateLimiter.js +22 -0
- package/dist/esm/infrastructure/http/Fetcher.js +127 -0
- package/dist/esm/infrastructure/http/Normalizer.js +233 -0
- package/dist/esm/infrastructure/http/ProxyManager.js +82 -0
- package/dist/esm/infrastructure/http/RateLimiter.js +102 -0
- package/dist/esm/infrastructure/http/RetryStrategy.js +131 -0
- package/dist/esm/infrastructure/http/index.js +3 -0
- package/dist/esm/infrastructure/logging/AuditLogger.js +187 -0
- package/dist/esm/infrastructure/logging/Logger.js +145 -0
- package/dist/esm/infrastructure/monitoring/GrafanaDashboard.js +115 -0
- package/dist/esm/infrastructure/monitoring/MetricsCollector.js +284 -0
- package/dist/esm/infrastructure/monitoring/PrometheusExporter.js +72 -0
- package/dist/esm/infrastructure/monitoring/TelemetryExporter.js +112 -0
- package/dist/esm/infrastructure/native/NativeBackend.js +86 -0
- package/dist/esm/infrastructure/security/PIIRedactor.js +85 -0
- package/dist/esm/infrastructure/security/SSRFProtection.js +162 -0
- package/dist/esm/infrastructure/security/index.js +2 -0
- package/dist/esm/infrastructure/telemetry/UsageTelemetry.js +84 -0
- package/dist/esm/infrastructure/validation/ResponseValidator.js +194 -0
- package/dist/esm/integrations/express.js +43 -0
- package/dist/esm/integrations/graphql.js +80 -0
- package/dist/esm/integrations/nestjs.js +23 -0
- package/dist/esm/shared/constants/http.constants.js +25 -0
- package/dist/esm/shared/constants/index.js +2 -0
- package/dist/esm/shared/constants/rdap.constants.js +17 -0
- package/dist/esm/shared/errors/base.error.js +140 -0
- package/dist/esm/shared/errors/index.js +1 -0
- package/dist/esm/shared/types/entities.js +1 -0
- package/dist/esm/shared/types/enums.js +1 -0
- package/dist/esm/shared/types/errors.js +82 -0
- package/dist/esm/shared/types/generics.js +1 -0
- package/dist/esm/shared/types/index.js +1 -0
- package/dist/esm/shared/types/options.js +66 -0
- package/dist/esm/shared/types/responses.js +1 -0
- package/dist/esm/shared/utils/deprecation.js +20 -0
- package/dist/esm/shared/utils/enhanced-validators.js +148 -0
- package/dist/esm/shared/utils/helpers/async.js +40 -0
- package/dist/esm/shared/utils/helpers/cache.js +3 -0
- package/dist/esm/shared/utils/helpers/format.js +17 -0
- package/dist/esm/shared/utils/helpers/http.js +13 -0
- package/dist/esm/shared/utils/helpers/index.js +7 -0
- package/dist/esm/shared/utils/helpers/object.js +19 -0
- package/dist/esm/shared/utils/helpers/runtime.js +34 -0
- package/dist/esm/shared/utils/helpers/string.js +23 -0
- package/dist/esm/shared/utils/validators/asn.js +25 -0
- package/dist/esm/shared/utils/validators/config-validation.js +93 -0
- package/dist/esm/shared/utils/validators/domain.js +29 -0
- package/dist/esm/shared/utils/validators/entity.js +22 -0
- package/dist/esm/shared/utils/validators/index.js +7 -0
- package/dist/esm/shared/utils/validators/ip.js +48 -0
- package/dist/esm/shared/utils/validators/nameserver.js +44 -0
- package/dist/esm/shared/utils/validators/network.js +42 -0
- package/dist/{application → types/application}/client/RDAPClient.d.ts +10 -1
- package/dist/types/application/client/RDAPClient.d.ts.map +1 -0
- package/dist/types/application/client/index.d.ts.map +1 -0
- package/dist/types/application/deduplication/QueryDeduplicator.d.ts.map +1 -0
- package/dist/types/application/hooks/MiddlewareHooks.d.ts.map +1 -0
- package/dist/types/application/services/BatchProcessor.d.ts.map +1 -0
- package/dist/types/application/services/QueryOrchestrator.d.ts.map +1 -0
- package/dist/types/application/services/QueryPriority.d.ts.map +1 -0
- package/dist/types/application/services/index.d.ts.map +1 -0
- package/dist/{cli → types/cli}/index.d.ts.map +1 -1
- package/dist/types/core/ports/bootstrap.port.d.ts.map +1 -0
- package/dist/types/core/ports/cache.port.d.ts.map +1 -0
- package/dist/types/core/ports/fetcher.port.d.ts.map +1 -0
- package/dist/types/core/ports/index.d.ts.map +1 -0
- package/dist/types/core/ports/normalizer.port.d.ts.map +1 -0
- package/dist/types/core/ports/pii-redactor.port.d.ts.map +1 -0
- package/dist/{index.d.ts → types/index.d.ts} +6 -3
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/infrastructure/cache/CacheManager.d.ts.map +1 -0
- package/dist/types/infrastructure/cache/InMemoryCache.d.ts.map +1 -0
- package/dist/types/infrastructure/cache/PersistentCache.d.ts.map +1 -0
- package/dist/types/infrastructure/cache/RedisCache.d.ts.map +1 -0
- package/dist/types/infrastructure/cache/StaleWhileRevalidateCache.d.ts +16 -0
- package/dist/types/infrastructure/cache/StaleWhileRevalidateCache.d.ts.map +1 -0
- package/dist/types/infrastructure/cache/index.d.ts.map +1 -0
- package/dist/types/infrastructure/http/AuthenticationManager.d.ts.map +1 -0
- package/dist/types/infrastructure/http/BootstrapDiscovery.d.ts.map +1 -0
- package/dist/types/infrastructure/http/BrowserFetcher.d.ts.map +1 -0
- package/dist/types/infrastructure/http/BunFetcher.d.ts.map +1 -0
- package/dist/types/infrastructure/http/CircuitBreaker.d.ts.map +1 -0
- package/dist/types/infrastructure/http/CloudflareWorkersFetcher.d.ts.map +1 -0
- package/dist/types/infrastructure/http/CompressionManager.d.ts.map +1 -0
- package/dist/types/infrastructure/http/ConnectionPool.d.ts.map +1 -0
- package/dist/types/infrastructure/http/DenoFetcher.d.ts.map +1 -0
- package/dist/types/infrastructure/http/DistributedRateLimiter.d.ts +12 -0
- package/dist/types/infrastructure/http/DistributedRateLimiter.d.ts.map +1 -0
- package/dist/{infrastructure → types/infrastructure}/http/Fetcher.d.ts +2 -0
- package/dist/types/infrastructure/http/Fetcher.d.ts.map +1 -0
- package/dist/types/infrastructure/http/Normalizer.d.ts.map +1 -0
- package/dist/types/infrastructure/http/ProxyManager.d.ts.map +1 -0
- package/dist/{infrastructure → types/infrastructure}/http/RateLimiter.d.ts +5 -0
- package/dist/types/infrastructure/http/RateLimiter.d.ts.map +1 -0
- package/dist/types/infrastructure/http/RetryStrategy.d.ts.map +1 -0
- package/dist/types/infrastructure/http/index.d.ts.map +1 -0
- package/dist/types/infrastructure/logging/AuditLogger.d.ts.map +1 -0
- package/dist/types/infrastructure/logging/Logger.d.ts.map +1 -0
- package/dist/{infrastructure → types/infrastructure}/monitoring/GrafanaDashboard.d.ts.map +1 -1
- package/dist/types/infrastructure/monitoring/MetricsCollector.d.ts.map +1 -0
- package/dist/types/infrastructure/monitoring/PrometheusExporter.d.ts.map +1 -0
- package/dist/types/infrastructure/monitoring/TelemetryExporter.d.ts.map +1 -0
- package/dist/types/infrastructure/native/NativeBackend.d.ts.map +1 -0
- package/dist/types/infrastructure/security/PIIRedactor.d.ts.map +1 -0
- package/dist/{infrastructure → types/infrastructure}/security/SSRFProtection.d.ts +1 -0
- package/dist/types/infrastructure/security/SSRFProtection.d.ts.map +1 -0
- package/dist/types/infrastructure/security/index.d.ts.map +1 -0
- package/dist/types/infrastructure/telemetry/UsageTelemetry.d.ts +13 -0
- package/dist/types/infrastructure/telemetry/UsageTelemetry.d.ts.map +1 -0
- package/dist/types/infrastructure/validation/ResponseValidator.d.ts.map +1 -0
- package/dist/types/integrations/express.d.ts.map +1 -0
- package/dist/types/integrations/graphql.d.ts.map +1 -0
- package/dist/types/integrations/nestjs.d.ts.map +1 -0
- package/dist/types/shared/constants/http.constants.d.ts.map +1 -0
- package/dist/types/shared/constants/index.d.ts.map +1 -0
- package/dist/types/shared/constants/rdap.constants.d.ts.map +1 -0
- package/dist/{shared → types/shared}/errors/base.error.d.ts +3 -0
- package/dist/types/shared/errors/base.error.d.ts.map +1 -0
- package/dist/types/shared/errors/index.d.ts.map +1 -0
- package/dist/types/shared/types/entities.d.ts.map +1 -0
- package/dist/{shared → types/shared}/types/enums.d.ts +1 -1
- package/dist/types/shared/types/enums.d.ts.map +1 -0
- package/dist/types/shared/types/errors.d.ts.map +1 -0
- package/dist/types/shared/types/generics.d.ts.map +1 -0
- package/dist/{shared → types/shared}/types/index.d.ts +1 -1
- package/dist/types/shared/types/index.d.ts.map +1 -0
- package/dist/{shared → types/shared}/types/options.d.ts +9 -0
- package/dist/types/shared/types/options.d.ts.map +1 -0
- package/dist/{shared → types/shared}/types/responses.d.ts +20 -0
- package/dist/types/shared/types/responses.d.ts.map +1 -0
- package/dist/types/shared/utils/deprecation.d.ts.map +1 -0
- package/dist/types/shared/utils/enhanced-validators.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/async.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/cache.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/format.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/http.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/index.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/object.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/runtime.d.ts.map +1 -0
- package/dist/types/shared/utils/helpers/string.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/asn.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/config-validation.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/domain.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/entity.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/index.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/ip.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/nameserver.d.ts.map +1 -0
- package/dist/types/shared/utils/validators/network.d.ts.map +1 -0
- package/package.json +29 -25
- package/dist/application/client/RDAPClient.d.ts.map +0 -1
- package/dist/application/client/RDAPClient.js.map +0 -1
- package/dist/application/client/index.d.ts.map +0 -1
- package/dist/application/client/index.js.map +0 -1
- package/dist/application/deduplication/QueryDeduplicator.d.ts.map +0 -1
- package/dist/application/deduplication/QueryDeduplicator.js.map +0 -1
- package/dist/application/hooks/MiddlewareHooks.d.ts.map +0 -1
- package/dist/application/hooks/MiddlewareHooks.js.map +0 -1
- package/dist/application/services/BatchProcessor.d.ts.map +0 -1
- package/dist/application/services/BatchProcessor.js.map +0 -1
- package/dist/application/services/QueryOrchestrator.d.ts.map +0 -1
- package/dist/application/services/QueryOrchestrator.js.map +0 -1
- package/dist/application/services/QueryPriority.d.ts.map +0 -1
- package/dist/application/services/QueryPriority.js.map +0 -1
- package/dist/application/services/index.d.ts.map +0 -1
- package/dist/application/services/index.js.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/core/ports/bootstrap.port.d.ts.map +0 -1
- package/dist/core/ports/bootstrap.port.js +0 -3
- package/dist/core/ports/bootstrap.port.js.map +0 -1
- package/dist/core/ports/cache.port.d.ts.map +0 -1
- package/dist/core/ports/cache.port.js +0 -3
- package/dist/core/ports/cache.port.js.map +0 -1
- package/dist/core/ports/fetcher.port.d.ts.map +0 -1
- package/dist/core/ports/fetcher.port.js +0 -3
- package/dist/core/ports/fetcher.port.js.map +0 -1
- package/dist/core/ports/index.d.ts.map +0 -1
- package/dist/core/ports/index.js.map +0 -1
- package/dist/core/ports/normalizer.port.d.ts.map +0 -1
- package/dist/core/ports/normalizer.port.js +0 -3
- package/dist/core/ports/normalizer.port.js.map +0 -1
- package/dist/core/ports/pii-redactor.port.d.ts.map +0 -1
- package/dist/core/ports/pii-redactor.port.js +0 -3
- package/dist/core/ports/pii-redactor.port.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infrastructure/cache/CacheManager.d.ts.map +0 -1
- package/dist/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/infrastructure/cache/InMemoryCache.d.ts.map +0 -1
- package/dist/infrastructure/cache/InMemoryCache.js.map +0 -1
- package/dist/infrastructure/cache/PersistentCache.d.ts.map +0 -1
- package/dist/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/infrastructure/cache/RedisCache.d.ts.map +0 -1
- package/dist/infrastructure/cache/RedisCache.js.map +0 -1
- package/dist/infrastructure/cache/index.d.ts.map +0 -1
- package/dist/infrastructure/cache/index.js.map +0 -1
- package/dist/infrastructure/http/AuthenticationManager.d.ts.map +0 -1
- package/dist/infrastructure/http/AuthenticationManager.js.map +0 -1
- package/dist/infrastructure/http/BootstrapDiscovery.d.ts.map +0 -1
- package/dist/infrastructure/http/BootstrapDiscovery.js.map +0 -1
- package/dist/infrastructure/http/BrowserFetcher.d.ts.map +0 -1
- package/dist/infrastructure/http/BrowserFetcher.js.map +0 -1
- package/dist/infrastructure/http/BunFetcher.d.ts.map +0 -1
- package/dist/infrastructure/http/BunFetcher.js.map +0 -1
- package/dist/infrastructure/http/CircuitBreaker.d.ts.map +0 -1
- package/dist/infrastructure/http/CircuitBreaker.js.map +0 -1
- package/dist/infrastructure/http/CloudflareWorkersFetcher.d.ts.map +0 -1
- package/dist/infrastructure/http/CloudflareWorkersFetcher.js.map +0 -1
- package/dist/infrastructure/http/CompressionManager.d.ts.map +0 -1
- package/dist/infrastructure/http/CompressionManager.js.map +0 -1
- package/dist/infrastructure/http/ConnectionPool.d.ts.map +0 -1
- package/dist/infrastructure/http/ConnectionPool.js.map +0 -1
- package/dist/infrastructure/http/DenoFetcher.d.ts.map +0 -1
- package/dist/infrastructure/http/DenoFetcher.js.map +0 -1
- package/dist/infrastructure/http/Fetcher.d.ts.map +0 -1
- package/dist/infrastructure/http/Fetcher.js.map +0 -1
- package/dist/infrastructure/http/Normalizer.d.ts.map +0 -1
- package/dist/infrastructure/http/Normalizer.js.map +0 -1
- package/dist/infrastructure/http/ProxyManager.d.ts.map +0 -1
- package/dist/infrastructure/http/ProxyManager.js.map +0 -1
- package/dist/infrastructure/http/RateLimiter.d.ts.map +0 -1
- package/dist/infrastructure/http/RateLimiter.js.map +0 -1
- package/dist/infrastructure/http/RetryStrategy.d.ts.map +0 -1
- package/dist/infrastructure/http/RetryStrategy.js.map +0 -1
- package/dist/infrastructure/http/index.d.ts.map +0 -1
- package/dist/infrastructure/http/index.js.map +0 -1
- package/dist/infrastructure/logging/AuditLogger.d.ts.map +0 -1
- package/dist/infrastructure/logging/AuditLogger.js.map +0 -1
- package/dist/infrastructure/logging/Logger.d.ts.map +0 -1
- package/dist/infrastructure/logging/Logger.js.map +0 -1
- package/dist/infrastructure/monitoring/GrafanaDashboard.js.map +0 -1
- package/dist/infrastructure/monitoring/MetricsCollector.d.ts.map +0 -1
- package/dist/infrastructure/monitoring/MetricsCollector.js.map +0 -1
- package/dist/infrastructure/monitoring/PrometheusExporter.d.ts.map +0 -1
- package/dist/infrastructure/monitoring/PrometheusExporter.js.map +0 -1
- package/dist/infrastructure/monitoring/TelemetryExporter.d.ts.map +0 -1
- package/dist/infrastructure/monitoring/TelemetryExporter.js.map +0 -1
- package/dist/infrastructure/native/NativeBackend.d.ts.map +0 -1
- package/dist/infrastructure/native/NativeBackend.js.map +0 -1
- package/dist/infrastructure/security/PIIRedactor.d.ts.map +0 -1
- package/dist/infrastructure/security/PIIRedactor.js.map +0 -1
- package/dist/infrastructure/security/SSRFProtection.d.ts.map +0 -1
- package/dist/infrastructure/security/SSRFProtection.js.map +0 -1
- package/dist/infrastructure/security/index.d.ts.map +0 -1
- package/dist/infrastructure/security/index.js.map +0 -1
- package/dist/infrastructure/validation/ResponseValidator.d.ts.map +0 -1
- package/dist/infrastructure/validation/ResponseValidator.js.map +0 -1
- package/dist/integrations/express.d.ts.map +0 -1
- package/dist/integrations/express.js.map +0 -1
- package/dist/integrations/graphql.d.ts.map +0 -1
- package/dist/integrations/graphql.js.map +0 -1
- package/dist/integrations/nestjs.d.ts.map +0 -1
- package/dist/integrations/nestjs.js.map +0 -1
- package/dist/shared/constants/http.constants.d.ts.map +0 -1
- package/dist/shared/constants/http.constants.js.map +0 -1
- package/dist/shared/constants/index.d.ts.map +0 -1
- package/dist/shared/constants/index.js.map +0 -1
- package/dist/shared/constants/rdap.constants.d.ts.map +0 -1
- package/dist/shared/constants/rdap.constants.js.map +0 -1
- package/dist/shared/errors/base.error.d.ts.map +0 -1
- package/dist/shared/errors/base.error.js.map +0 -1
- package/dist/shared/errors/index.d.ts.map +0 -1
- package/dist/shared/errors/index.js.map +0 -1
- package/dist/shared/types/entities.d.ts.map +0 -1
- package/dist/shared/types/entities.js.map +0 -1
- package/dist/shared/types/enums.d.ts.map +0 -1
- package/dist/shared/types/enums.js.map +0 -1
- package/dist/shared/types/errors.d.ts.map +0 -1
- package/dist/shared/types/errors.js.map +0 -1
- package/dist/shared/types/generics.d.ts.map +0 -1
- package/dist/shared/types/generics.js.map +0 -1
- package/dist/shared/types/index.d.ts.map +0 -1
- package/dist/shared/types/index.js.map +0 -1
- package/dist/shared/types/options.d.ts.map +0 -1
- package/dist/shared/types/options.js.map +0 -1
- package/dist/shared/types/responses.d.ts.map +0 -1
- package/dist/shared/types/responses.js +0 -3
- package/dist/shared/types/responses.js.map +0 -1
- package/dist/shared/utils/deprecation.d.ts.map +0 -1
- package/dist/shared/utils/deprecation.js.map +0 -1
- package/dist/shared/utils/enhanced-validators.d.ts.map +0 -1
- package/dist/shared/utils/enhanced-validators.js.map +0 -1
- package/dist/shared/utils/helpers/async.d.ts.map +0 -1
- package/dist/shared/utils/helpers/async.js.map +0 -1
- package/dist/shared/utils/helpers/cache.d.ts.map +0 -1
- package/dist/shared/utils/helpers/cache.js.map +0 -1
- package/dist/shared/utils/helpers/format.d.ts.map +0 -1
- package/dist/shared/utils/helpers/format.js.map +0 -1
- package/dist/shared/utils/helpers/http.d.ts.map +0 -1
- package/dist/shared/utils/helpers/http.js.map +0 -1
- package/dist/shared/utils/helpers/index.d.ts.map +0 -1
- package/dist/shared/utils/helpers/index.js.map +0 -1
- package/dist/shared/utils/helpers/object.d.ts.map +0 -1
- package/dist/shared/utils/helpers/object.js.map +0 -1
- package/dist/shared/utils/helpers/runtime.d.ts.map +0 -1
- package/dist/shared/utils/helpers/runtime.js.map +0 -1
- package/dist/shared/utils/helpers/string.d.ts.map +0 -1
- package/dist/shared/utils/helpers/string.js.map +0 -1
- package/dist/shared/utils/validators/asn.d.ts.map +0 -1
- package/dist/shared/utils/validators/asn.js.map +0 -1
- package/dist/shared/utils/validators/config-validation.d.ts.map +0 -1
- package/dist/shared/utils/validators/config-validation.js.map +0 -1
- package/dist/shared/utils/validators/domain.d.ts.map +0 -1
- package/dist/shared/utils/validators/domain.js.map +0 -1
- package/dist/shared/utils/validators/entity.d.ts.map +0 -1
- package/dist/shared/utils/validators/entity.js.map +0 -1
- package/dist/shared/utils/validators/index.d.ts.map +0 -1
- package/dist/shared/utils/validators/index.js.map +0 -1
- package/dist/shared/utils/validators/ip.d.ts.map +0 -1
- package/dist/shared/utils/validators/ip.js.map +0 -1
- package/dist/shared/utils/validators/nameserver.d.ts.map +0 -1
- package/dist/shared/utils/validators/nameserver.js.map +0 -1
- package/dist/shared/utils/validators/network.d.ts.map +0 -1
- package/dist/shared/utils/validators/network.js.map +0 -1
- /package/dist/{application → types/application}/client/index.d.ts +0 -0
- /package/dist/{application → types/application}/deduplication/QueryDeduplicator.d.ts +0 -0
- /package/dist/{application → types/application}/hooks/MiddlewareHooks.d.ts +0 -0
- /package/dist/{application → types/application}/services/BatchProcessor.d.ts +0 -0
- /package/dist/{application → types/application}/services/QueryOrchestrator.d.ts +0 -0
- /package/dist/{application → types/application}/services/QueryPriority.d.ts +0 -0
- /package/dist/{application → types/application}/services/index.d.ts +0 -0
- /package/dist/{cli → types/cli}/index.d.ts +0 -0
- /package/dist/{core → types/core}/ports/bootstrap.port.d.ts +0 -0
- /package/dist/{core → types/core}/ports/cache.port.d.ts +0 -0
- /package/dist/{core → types/core}/ports/fetcher.port.d.ts +0 -0
- /package/dist/{core → types/core}/ports/index.d.ts +0 -0
- /package/dist/{core → types/core}/ports/normalizer.port.d.ts +0 -0
- /package/dist/{core → types/core}/ports/pii-redactor.port.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/cache/CacheManager.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/cache/InMemoryCache.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/cache/PersistentCache.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/cache/RedisCache.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/cache/index.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/AuthenticationManager.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/BootstrapDiscovery.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/BrowserFetcher.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/BunFetcher.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/CircuitBreaker.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/CloudflareWorkersFetcher.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/CompressionManager.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/ConnectionPool.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/DenoFetcher.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/Normalizer.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/ProxyManager.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/RetryStrategy.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/http/index.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/logging/AuditLogger.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/logging/Logger.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/monitoring/GrafanaDashboard.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/monitoring/MetricsCollector.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/monitoring/PrometheusExporter.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/monitoring/TelemetryExporter.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/native/NativeBackend.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/security/PIIRedactor.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/security/index.d.ts +0 -0
- /package/dist/{infrastructure → types/infrastructure}/validation/ResponseValidator.d.ts +0 -0
- /package/dist/{integrations → types/integrations}/express.d.ts +0 -0
- /package/dist/{integrations → types/integrations}/graphql.d.ts +0 -0
- /package/dist/{integrations → types/integrations}/nestjs.d.ts +0 -0
- /package/dist/{shared → types/shared}/constants/http.constants.d.ts +0 -0
- /package/dist/{shared → types/shared}/constants/index.d.ts +0 -0
- /package/dist/{shared → types/shared}/constants/rdap.constants.d.ts +0 -0
- /package/dist/{shared → types/shared}/errors/index.d.ts +0 -0
- /package/dist/{shared → types/shared}/types/entities.d.ts +0 -0
- /package/dist/{shared → types/shared}/types/errors.d.ts +0 -0
- /package/dist/{shared → types/shared}/types/generics.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/deprecation.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/enhanced-validators.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/async.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/cache.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/format.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/http.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/index.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/object.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/runtime.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/helpers/string.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/asn.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/config-validation.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/domain.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/entity.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/index.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/ip.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/nameserver.d.ts +0 -0
- /package/dist/{shared → types/shared}/utils/validators/network.d.ts +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { ParseError } from '../../shared/errors';
|
|
2
|
+
const RFC7483_STANDARD_FIELDS = new Set([
|
|
3
|
+
'objectClassName', 'handle', 'ldhName', 'unicodeName', 'status', 'entities',
|
|
4
|
+
'events', 'links', 'remarks', 'nameservers', 'secureDNS', 'registrar',
|
|
5
|
+
'ipVersion', 'startAddress', 'endAddress', 'cidr0_cidrs', 'name', 'type',
|
|
6
|
+
'country', 'startAutnum', 'endAutnum', 'port43', 'publicIds', 'network',
|
|
7
|
+
'rdapConformance', 'notices', 'vcardArray', 'roles', 'ipAddresses',
|
|
8
|
+
]);
|
|
9
|
+
function extractExtensions(raw) {
|
|
10
|
+
const extensions = {};
|
|
11
|
+
let hasExtensions = false;
|
|
12
|
+
for (const key of Object.keys(raw)) {
|
|
13
|
+
if (!RFC7483_STANDARD_FIELDS.has(key)) {
|
|
14
|
+
extensions[key] = raw[key];
|
|
15
|
+
hasExtensions = true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return hasExtensions ? extensions : undefined;
|
|
19
|
+
}
|
|
20
|
+
export class Normalizer {
|
|
21
|
+
normalize(raw, query, source, cached = false, includeRaw = false) {
|
|
22
|
+
const objectClass = raw.objectClassName;
|
|
23
|
+
if (!objectClass) {
|
|
24
|
+
throw new ParseError('Missing objectClassName in RDAP response', { raw });
|
|
25
|
+
}
|
|
26
|
+
switch (objectClass) {
|
|
27
|
+
case 'domain':
|
|
28
|
+
return this.normalizeDomain(raw, query, source, cached, includeRaw);
|
|
29
|
+
case 'ip network':
|
|
30
|
+
return this.normalizeIP(raw, query, source, cached, includeRaw);
|
|
31
|
+
case 'autnum':
|
|
32
|
+
return this.normalizeASN(raw, query, source, cached, includeRaw);
|
|
33
|
+
case 'nameserver':
|
|
34
|
+
return this.normalizeNameserver(raw, query, source, cached, includeRaw);
|
|
35
|
+
case 'entity':
|
|
36
|
+
return this.normalizeEntity(raw, query, source, cached, includeRaw);
|
|
37
|
+
default:
|
|
38
|
+
throw new ParseError(`Unsupported object class: ${objectClass}`, { objectClass, raw });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
normalizeDomain(raw, query, source, cached, includeRaw) {
|
|
42
|
+
const response = {
|
|
43
|
+
query,
|
|
44
|
+
objectClass: 'domain',
|
|
45
|
+
handle: raw.handle,
|
|
46
|
+
ldhName: raw['ldhName'],
|
|
47
|
+
unicodeName: raw['unicodeName'],
|
|
48
|
+
status: raw['status'] || [],
|
|
49
|
+
nameservers: this.extractNameservers(raw),
|
|
50
|
+
entities: raw['entities'] || [],
|
|
51
|
+
events: this.normalizeEvents(raw['events'] || []),
|
|
52
|
+
registrar: this.extractRegistrar(raw),
|
|
53
|
+
links: raw['links'] || [],
|
|
54
|
+
remarks: raw['remarks'] || [],
|
|
55
|
+
extensions: extractExtensions(raw),
|
|
56
|
+
metadata: {
|
|
57
|
+
source,
|
|
58
|
+
timestamp: new Date().toISOString(),
|
|
59
|
+
cached,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
if (includeRaw) {
|
|
63
|
+
response.raw = raw;
|
|
64
|
+
}
|
|
65
|
+
return response;
|
|
66
|
+
}
|
|
67
|
+
normalizeIP(raw, query, source, cached, includeRaw) {
|
|
68
|
+
const response = {
|
|
69
|
+
query,
|
|
70
|
+
objectClass: 'ip network',
|
|
71
|
+
handle: raw.handle,
|
|
72
|
+
startAddress: raw['startAddress'],
|
|
73
|
+
endAddress: raw['endAddress'],
|
|
74
|
+
ipVersion: raw['ipVersion'],
|
|
75
|
+
name: raw['name'],
|
|
76
|
+
type: raw['type'],
|
|
77
|
+
country: raw['country'],
|
|
78
|
+
status: raw['status'] || [],
|
|
79
|
+
entities: raw['entities'] || [],
|
|
80
|
+
events: this.normalizeEvents(raw['events'] || []),
|
|
81
|
+
links: raw['links'] || [],
|
|
82
|
+
remarks: raw['remarks'] || [],
|
|
83
|
+
extensions: extractExtensions(raw),
|
|
84
|
+
metadata: {
|
|
85
|
+
source,
|
|
86
|
+
timestamp: new Date().toISOString(),
|
|
87
|
+
cached,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
if (includeRaw) {
|
|
91
|
+
response.raw = raw;
|
|
92
|
+
}
|
|
93
|
+
return response;
|
|
94
|
+
}
|
|
95
|
+
normalizeASN(raw, query, source, cached, includeRaw) {
|
|
96
|
+
const response = {
|
|
97
|
+
query,
|
|
98
|
+
objectClass: 'autnum',
|
|
99
|
+
handle: raw.handle,
|
|
100
|
+
startAutnum: raw['startAutnum'],
|
|
101
|
+
endAutnum: raw['endAutnum'],
|
|
102
|
+
name: raw['name'],
|
|
103
|
+
type: raw['type'],
|
|
104
|
+
country: raw['country'],
|
|
105
|
+
status: raw['status'] || [],
|
|
106
|
+
entities: raw['entities'] || [],
|
|
107
|
+
events: this.normalizeEvents(raw['events'] || []),
|
|
108
|
+
links: raw['links'] || [],
|
|
109
|
+
remarks: raw['remarks'] || [],
|
|
110
|
+
extensions: extractExtensions(raw),
|
|
111
|
+
metadata: {
|
|
112
|
+
source,
|
|
113
|
+
timestamp: new Date().toISOString(),
|
|
114
|
+
cached,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
if (includeRaw) {
|
|
118
|
+
response.raw = raw;
|
|
119
|
+
}
|
|
120
|
+
return response;
|
|
121
|
+
}
|
|
122
|
+
normalizeNameserver(raw, query, source, cached, includeRaw) {
|
|
123
|
+
const ipAddresses = raw['ipAddresses'];
|
|
124
|
+
const response = {
|
|
125
|
+
query,
|
|
126
|
+
objectClass: 'nameserver',
|
|
127
|
+
handle: raw.handle,
|
|
128
|
+
ldhName: raw['ldhName'],
|
|
129
|
+
unicodeName: raw['unicodeName'],
|
|
130
|
+
status: raw['status'] || [],
|
|
131
|
+
ipAddresses: ipAddresses
|
|
132
|
+
? {
|
|
133
|
+
v4: ipAddresses.v4 || [],
|
|
134
|
+
v6: ipAddresses.v6 || [],
|
|
135
|
+
}
|
|
136
|
+
: undefined,
|
|
137
|
+
entities: raw['entities'] || [],
|
|
138
|
+
events: this.normalizeEvents(raw['events'] || []),
|
|
139
|
+
links: raw['links'] || [],
|
|
140
|
+
remarks: raw['remarks'] || [],
|
|
141
|
+
extensions: extractExtensions(raw),
|
|
142
|
+
metadata: {
|
|
143
|
+
source,
|
|
144
|
+
timestamp: new Date().toISOString(),
|
|
145
|
+
cached,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
if (includeRaw) {
|
|
149
|
+
response.raw = raw;
|
|
150
|
+
}
|
|
151
|
+
return response;
|
|
152
|
+
}
|
|
153
|
+
normalizeEntity(raw, query, source, cached, includeRaw) {
|
|
154
|
+
const response = {
|
|
155
|
+
query,
|
|
156
|
+
objectClass: 'entity',
|
|
157
|
+
handle: raw.handle,
|
|
158
|
+
vcardArray: raw['vcardArray'],
|
|
159
|
+
roles: raw['roles'] || [],
|
|
160
|
+
status: raw['status'] || [],
|
|
161
|
+
entities: raw['entities'] || [],
|
|
162
|
+
events: this.normalizeEvents(raw['events'] || []),
|
|
163
|
+
links: raw['links'] || [],
|
|
164
|
+
remarks: raw['remarks'] || [],
|
|
165
|
+
extensions: extractExtensions(raw),
|
|
166
|
+
metadata: {
|
|
167
|
+
source,
|
|
168
|
+
timestamp: new Date().toISOString(),
|
|
169
|
+
cached,
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
if (includeRaw) {
|
|
173
|
+
response.raw = raw;
|
|
174
|
+
}
|
|
175
|
+
return response;
|
|
176
|
+
}
|
|
177
|
+
extractNameservers(raw) {
|
|
178
|
+
const nameservers = raw['nameservers'];
|
|
179
|
+
if (!nameservers || !Array.isArray(nameservers)) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
return nameservers
|
|
183
|
+
.map((ns) => {
|
|
184
|
+
if (!ns || typeof ns !== 'object') {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
return ns.ldhName || ns.unicodeName;
|
|
188
|
+
})
|
|
189
|
+
.filter((name) => name !== undefined && name !== '');
|
|
190
|
+
}
|
|
191
|
+
extractRegistrar(raw) {
|
|
192
|
+
const entities = raw['entities'];
|
|
193
|
+
if (!entities || !Array.isArray(entities)) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
const registrar = entities.find((entity) => entity && typeof entity === 'object' && entity.roles?.includes('registrar'));
|
|
197
|
+
if (!registrar) {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
let name;
|
|
201
|
+
if (registrar.vcardArray && Array.isArray(registrar.vcardArray) && registrar.vcardArray.length >= 2) {
|
|
202
|
+
const vcard = registrar.vcardArray[1];
|
|
203
|
+
if (Array.isArray(vcard)) {
|
|
204
|
+
const fnField = vcard.find((field) => Array.isArray(field) && field[0] === 'fn');
|
|
205
|
+
if (fnField && Array.isArray(fnField) && fnField.length >= 4) {
|
|
206
|
+
name = fnField[3];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
let url;
|
|
211
|
+
if (registrar.links && Array.isArray(registrar.links)) {
|
|
212
|
+
const selfLink = registrar.links.find((link) => link && link.rel === 'self');
|
|
213
|
+
if (selfLink) {
|
|
214
|
+
url = selfLink.href;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
name,
|
|
219
|
+
handle: registrar.handle,
|
|
220
|
+
url,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
normalizeEvents(events) {
|
|
224
|
+
if (!Array.isArray(events)) {
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
return events.map((event) => ({
|
|
228
|
+
type: (event.eventAction || event.type),
|
|
229
|
+
date: event.eventDate || event.date,
|
|
230
|
+
actor: event.eventActor || event.actor,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export class ProxyManager {
|
|
2
|
+
constructor(options) {
|
|
3
|
+
this.protocol = options.protocol || 'http';
|
|
4
|
+
this.host = options.host;
|
|
5
|
+
this.port = options.port;
|
|
6
|
+
this.auth = options.auth;
|
|
7
|
+
this.timeout = options.timeout || 30000;
|
|
8
|
+
this.bypassList = new Set(options.bypassList || []);
|
|
9
|
+
this.validate();
|
|
10
|
+
}
|
|
11
|
+
validate() {
|
|
12
|
+
if (!this.host) {
|
|
13
|
+
throw new Error('Proxy host is required');
|
|
14
|
+
}
|
|
15
|
+
if (!this.port || this.port < 1 || this.port > 65535) {
|
|
16
|
+
throw new Error('Proxy port must be between 1 and 65535');
|
|
17
|
+
}
|
|
18
|
+
if (this.auth && (!this.auth.username || !this.auth.password)) {
|
|
19
|
+
throw new Error('Proxy auth requires both username and password');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getProxyUrl() {
|
|
23
|
+
let url = `${this.protocol}://`;
|
|
24
|
+
if (this.auth) {
|
|
25
|
+
url += `${encodeURIComponent(this.auth.username)}:${encodeURIComponent(this.auth.password)}@`;
|
|
26
|
+
}
|
|
27
|
+
url += `${this.host}:${this.port}`;
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
shouldBypass(url) {
|
|
31
|
+
try {
|
|
32
|
+
const urlObj = new URL(url);
|
|
33
|
+
const hostname = urlObj.hostname;
|
|
34
|
+
if (this.bypassList.has(hostname)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
for (const pattern of this.bypassList) {
|
|
38
|
+
if (pattern.startsWith('*.')) {
|
|
39
|
+
const domain = pattern.slice(2);
|
|
40
|
+
if (hostname.endsWith(domain)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getAgentConfig() {
|
|
52
|
+
const config = {
|
|
53
|
+
host: this.host,
|
|
54
|
+
port: this.port,
|
|
55
|
+
protocol: this.protocol,
|
|
56
|
+
timeout: this.timeout,
|
|
57
|
+
};
|
|
58
|
+
if (this.auth) {
|
|
59
|
+
config.auth = `${this.auth.username}:${this.auth.password}`;
|
|
60
|
+
}
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
63
|
+
getInfo() {
|
|
64
|
+
return {
|
|
65
|
+
protocol: this.protocol,
|
|
66
|
+
host: this.host,
|
|
67
|
+
port: this.port,
|
|
68
|
+
hasAuth: !!this.auth,
|
|
69
|
+
timeout: this.timeout,
|
|
70
|
+
bypassCount: this.bypassList.size,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
addBypass(pattern) {
|
|
74
|
+
this.bypassList.add(pattern);
|
|
75
|
+
}
|
|
76
|
+
removeBypass(pattern) {
|
|
77
|
+
this.bypassList.delete(pattern);
|
|
78
|
+
}
|
|
79
|
+
getBypassList() {
|
|
80
|
+
return Array.from(this.bypassList);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { RateLimitError } from '../../shared/errors';
|
|
2
|
+
export class RateLimiter {
|
|
3
|
+
constructor(options = {}) {
|
|
4
|
+
this.enabled = options.enabled ?? false;
|
|
5
|
+
this.maxRequests = options.maxRequests || 100;
|
|
6
|
+
this.windowMs = options.windowMs || 60000;
|
|
7
|
+
this.requests = new Map();
|
|
8
|
+
if (this.enabled) {
|
|
9
|
+
this.cleanupInterval = setInterval(() => this.cleanup(), 60000);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async checkLimit(key = 'global') {
|
|
13
|
+
if (!this.enabled) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const now = Date.now();
|
|
17
|
+
const records = this.requests.get(key) || [];
|
|
18
|
+
const validRecords = records.filter((r) => now - r.timestamp < this.windowMs);
|
|
19
|
+
const totalRequests = validRecords.reduce((sum, r) => sum + r.count, 0);
|
|
20
|
+
if (totalRequests >= this.maxRequests) {
|
|
21
|
+
const oldestRecord = validRecords[0];
|
|
22
|
+
const retryAfter = oldestRecord
|
|
23
|
+
? this.windowMs - (now - oldestRecord.timestamp)
|
|
24
|
+
: this.windowMs;
|
|
25
|
+
throw new RateLimitError(`Rate limit exceeded: ${totalRequests}/${this.maxRequests} requests in ${this.windowMs}ms`, {
|
|
26
|
+
key,
|
|
27
|
+
limit: this.maxRequests,
|
|
28
|
+
window: this.windowMs,
|
|
29
|
+
current: totalRequests,
|
|
30
|
+
}, retryAfter);
|
|
31
|
+
}
|
|
32
|
+
validRecords.push({ timestamp: now, count: 1 });
|
|
33
|
+
this.requests.set(key, validRecords);
|
|
34
|
+
}
|
|
35
|
+
getUsage(key = 'global') {
|
|
36
|
+
if (!this.enabled) {
|
|
37
|
+
return {
|
|
38
|
+
current: 0,
|
|
39
|
+
limit: this.maxRequests,
|
|
40
|
+
remaining: this.maxRequests,
|
|
41
|
+
resetAt: Date.now() + this.windowMs,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
const records = this.requests.get(key) || [];
|
|
46
|
+
const validRecords = records.filter((r) => now - r.timestamp < this.windowMs);
|
|
47
|
+
const current = validRecords.reduce((sum, r) => sum + r.count, 0);
|
|
48
|
+
const oldestRecord = validRecords[0];
|
|
49
|
+
return {
|
|
50
|
+
current,
|
|
51
|
+
limit: this.maxRequests,
|
|
52
|
+
remaining: Math.max(0, this.maxRequests - current),
|
|
53
|
+
resetAt: oldestRecord ? oldestRecord.timestamp + this.windowMs : now + this.windowMs,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
reset(key = 'global') {
|
|
57
|
+
this.requests.delete(key);
|
|
58
|
+
}
|
|
59
|
+
resetAll() {
|
|
60
|
+
this.requests.clear();
|
|
61
|
+
}
|
|
62
|
+
cleanup() {
|
|
63
|
+
const now = Date.now();
|
|
64
|
+
for (const [key, records] of this.requests.entries()) {
|
|
65
|
+
const validRecords = records.filter((r) => now - r.timestamp < this.windowMs);
|
|
66
|
+
if (validRecords.length === 0) {
|
|
67
|
+
this.requests.delete(key);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.requests.set(key, validRecords);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
destroy() {
|
|
75
|
+
if (this.cleanupInterval) {
|
|
76
|
+
clearInterval(this.cleanupInterval);
|
|
77
|
+
this.cleanupInterval = undefined;
|
|
78
|
+
}
|
|
79
|
+
this.requests.clear();
|
|
80
|
+
}
|
|
81
|
+
isEnabled() {
|
|
82
|
+
return this.enabled;
|
|
83
|
+
}
|
|
84
|
+
getConfig() {
|
|
85
|
+
return { maxRequests: this.maxRequests, windowMs: this.windowMs };
|
|
86
|
+
}
|
|
87
|
+
getStats() {
|
|
88
|
+
const now = Date.now();
|
|
89
|
+
let totalRequests = 0;
|
|
90
|
+
for (const records of this.requests.values()) {
|
|
91
|
+
const validRecords = records.filter((r) => now - r.timestamp < this.windowMs);
|
|
92
|
+
totalRequests += validRecords.reduce((sum, r) => sum + r.count, 0);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
enabled: this.enabled,
|
|
96
|
+
maxRequests: this.maxRequests,
|
|
97
|
+
windowMs: this.windowMs,
|
|
98
|
+
activeKeys: this.requests.size,
|
|
99
|
+
totalRequests,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export class RetryStrategy {
|
|
2
|
+
constructor(options = {}) {
|
|
3
|
+
this.circuitState = 'closed';
|
|
4
|
+
this.failureCount = 0;
|
|
5
|
+
this.lastFailureTime = 0;
|
|
6
|
+
this.halfOpenAttempts = 0;
|
|
7
|
+
this.strategy = options.strategy || 'exponential-jitter';
|
|
8
|
+
this.maxAttempts = options.maxAttempts || 3;
|
|
9
|
+
this.initialDelay = options.initialDelay || 1000;
|
|
10
|
+
this.maxDelay = options.maxDelay || 30000;
|
|
11
|
+
this.factor = options.factor || 2;
|
|
12
|
+
this.jitter = options.jitter ?? true;
|
|
13
|
+
this.retryableErrors = new Set(options.retryableErrors || [
|
|
14
|
+
'ETIMEDOUT',
|
|
15
|
+
'ECONNRESET',
|
|
16
|
+
'ECONNREFUSED',
|
|
17
|
+
'ENOTFOUND',
|
|
18
|
+
'NetworkError',
|
|
19
|
+
'TimeoutError',
|
|
20
|
+
]);
|
|
21
|
+
this.retryableStatusCodes = new Set(options.retryableStatusCodes || [500, 502, 503, 504, 429]);
|
|
22
|
+
const cb = options.circuitBreaker || {};
|
|
23
|
+
this.circuitBreakerEnabled = cb.enabled ?? false;
|
|
24
|
+
this.circuitBreakerThreshold = cb.threshold || 5;
|
|
25
|
+
this.circuitBreakerTimeout = cb.timeout || 60000;
|
|
26
|
+
this.halfOpenRequests = cb.halfOpenRequests || 1;
|
|
27
|
+
}
|
|
28
|
+
shouldRetry(context) {
|
|
29
|
+
if (this.circuitBreakerEnabled) {
|
|
30
|
+
this.updateCircuitState();
|
|
31
|
+
if (this.circuitState === 'open') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (this.circuitState === 'half-open') {
|
|
35
|
+
if (this.halfOpenAttempts >= this.halfOpenRequests) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
this.halfOpenAttempts++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (context.attempt >= this.maxAttempts) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const errorName = context.error.name;
|
|
45
|
+
const errorCode = context.error.code;
|
|
46
|
+
if (this.retryableErrors.has(errorName) || this.retryableErrors.has(errorCode)) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (context.statusCode && this.retryableStatusCodes.has(context.statusCode)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
getDelay(attempt) {
|
|
55
|
+
let delay;
|
|
56
|
+
switch (this.strategy) {
|
|
57
|
+
case 'fixed':
|
|
58
|
+
delay = this.initialDelay;
|
|
59
|
+
break;
|
|
60
|
+
case 'linear':
|
|
61
|
+
delay = this.initialDelay * attempt;
|
|
62
|
+
break;
|
|
63
|
+
case 'exponential':
|
|
64
|
+
case 'exponential-jitter':
|
|
65
|
+
delay = Math.min(this.initialDelay * Math.pow(this.factor, attempt - 1), this.maxDelay);
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
delay = this.initialDelay;
|
|
69
|
+
}
|
|
70
|
+
if (this.jitter || this.strategy === 'exponential-jitter') {
|
|
71
|
+
const jitterAmount = delay * 0.1;
|
|
72
|
+
delay = delay + (Math.random() * jitterAmount * 2 - jitterAmount);
|
|
73
|
+
}
|
|
74
|
+
return Math.min(Math.max(delay, 0), this.maxDelay);
|
|
75
|
+
}
|
|
76
|
+
recordSuccess() {
|
|
77
|
+
if (this.circuitBreakerEnabled) {
|
|
78
|
+
if (this.circuitState === 'half-open') {
|
|
79
|
+
this.circuitState = 'closed';
|
|
80
|
+
this.failureCount = 0;
|
|
81
|
+
this.halfOpenAttempts = 0;
|
|
82
|
+
}
|
|
83
|
+
else if (this.circuitState === 'closed') {
|
|
84
|
+
this.failureCount = Math.max(0, this.failureCount - 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
recordFailure() {
|
|
89
|
+
if (this.circuitBreakerEnabled) {
|
|
90
|
+
this.failureCount++;
|
|
91
|
+
this.lastFailureTime = Date.now();
|
|
92
|
+
if (this.circuitState === 'half-open') {
|
|
93
|
+
this.circuitState = 'open';
|
|
94
|
+
this.halfOpenAttempts = 0;
|
|
95
|
+
}
|
|
96
|
+
else if (this.circuitState === 'closed' &&
|
|
97
|
+
this.failureCount >= this.circuitBreakerThreshold) {
|
|
98
|
+
this.circuitState = 'open';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
updateCircuitState() {
|
|
103
|
+
if (this.circuitState === 'open') {
|
|
104
|
+
const timeSinceLastFailure = Date.now() - this.lastFailureTime;
|
|
105
|
+
if (timeSinceLastFailure >= this.circuitBreakerTimeout) {
|
|
106
|
+
this.circuitState = 'half-open';
|
|
107
|
+
this.halfOpenAttempts = 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
getCircuitState() {
|
|
112
|
+
if (this.circuitBreakerEnabled) {
|
|
113
|
+
this.updateCircuitState();
|
|
114
|
+
return this.circuitState;
|
|
115
|
+
}
|
|
116
|
+
return 'closed';
|
|
117
|
+
}
|
|
118
|
+
getStats() {
|
|
119
|
+
return {
|
|
120
|
+
circuitState: this.getCircuitState(),
|
|
121
|
+
failureCount: this.failureCount,
|
|
122
|
+
enabled: this.circuitBreakerEnabled,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
reset() {
|
|
126
|
+
this.circuitState = 'closed';
|
|
127
|
+
this.failureCount = 0;
|
|
128
|
+
this.lastFailureTime = 0;
|
|
129
|
+
this.halfOpenAttempts = 0;
|
|
130
|
+
}
|
|
131
|
+
}
|