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
|
@@ -24,4 +24,3 @@ Object.defineProperty(exports, "isLocalhost", { enumerable: true, get: function
|
|
|
24
24
|
Object.defineProperty(exports, "isLinkLocal", { enumerable: true, get: function () { return network_1.isLinkLocal; } });
|
|
25
25
|
var config_validation_1 = require("./config-validation");
|
|
26
26
|
Object.defineProperty(exports, "validateClientOptions", { enumerable: true, get: function () { return config_validation_1.validateClientOptions; } });
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { CacheManager } from '../../infrastructure/cache';
|
|
2
|
+
import { BootstrapDiscovery, Fetcher, Normalizer } from '../../infrastructure/http';
|
|
3
|
+
import { BunFetcher } from '../../infrastructure/http/BunFetcher';
|
|
4
|
+
import { DenoFetcher } from '../../infrastructure/http/DenoFetcher';
|
|
5
|
+
import { CloudflareWorkersFetcher } from '../../infrastructure/http/CloudflareWorkersFetcher';
|
|
6
|
+
import { RateLimiter } from '../../infrastructure/http/RateLimiter';
|
|
7
|
+
import { ConnectionPool } from '../../infrastructure/http/ConnectionPool';
|
|
8
|
+
import { isBun, isDeno, isCloudflareWorkers } from '../../shared/utils/helpers/runtime';
|
|
9
|
+
import { SSRFProtection, PIIRedactor } from '../../infrastructure/security';
|
|
10
|
+
import { MetricsCollector } from '../../infrastructure/monitoring/MetricsCollector';
|
|
11
|
+
import { Logger } from '../../infrastructure/logging/Logger';
|
|
12
|
+
import { ValidationError, RDAPServerError, SearchNotSupportedError } from '../../shared/errors';
|
|
13
|
+
import { UsageTelemetry } from '../../infrastructure/telemetry/UsageTelemetry';
|
|
14
|
+
import { validateDomain as _validateDomainFn, validateIP as _validateIPFn, validateASN as _validateASNFn } from '../../shared/utils/validators';
|
|
15
|
+
import { DEFAULT_OPTIONS } from '../../shared/types/options';
|
|
16
|
+
import { deepMerge, calculateBackoff, sleep } from '../../shared/utils/helpers';
|
|
17
|
+
import { QueryOrchestrator } from '../services';
|
|
18
|
+
import { BatchProcessor } from '../services/BatchProcessor';
|
|
19
|
+
import { MiddlewareManager } from '../hooks/MiddlewareHooks';
|
|
20
|
+
import { QueryDeduplicator } from '../deduplication/QueryDeduplicator';
|
|
21
|
+
import { NativeBackend } from '../../infrastructure/native/NativeBackend';
|
|
22
|
+
export class RDAPClient {
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.options = this.normalizeOptions(options);
|
|
25
|
+
const ssrfOptions = typeof this.options.ssrfProtection === 'boolean'
|
|
26
|
+
? { enabled: this.options.ssrfProtection }
|
|
27
|
+
: this.options.ssrfProtection;
|
|
28
|
+
this.ssrfProtection = new SSRFProtection(ssrfOptions);
|
|
29
|
+
const timeoutMs = typeof this.options.timeout === 'number'
|
|
30
|
+
? this.options.timeout
|
|
31
|
+
: this.options.timeout?.request ?? 10000;
|
|
32
|
+
if (isCloudflareWorkers()) {
|
|
33
|
+
this.fetcher = new CloudflareWorkersFetcher({
|
|
34
|
+
timeout: timeoutMs,
|
|
35
|
+
userAgent: this.options.userAgent,
|
|
36
|
+
headers: this.options.headers,
|
|
37
|
+
ssrfProtection: this.ssrfProtection,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else if (isDeno()) {
|
|
41
|
+
this.fetcher = new DenoFetcher({
|
|
42
|
+
timeout: timeoutMs,
|
|
43
|
+
userAgent: this.options.userAgent,
|
|
44
|
+
headers: this.options.headers,
|
|
45
|
+
ssrfProtection: this.ssrfProtection,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
else if (isBun()) {
|
|
49
|
+
this.fetcher = new BunFetcher({
|
|
50
|
+
timeout: timeoutMs,
|
|
51
|
+
userAgent: this.options.userAgent,
|
|
52
|
+
headers: this.options.headers,
|
|
53
|
+
ssrfProtection: this.ssrfProtection,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.fetcher = new Fetcher({
|
|
58
|
+
timeout: typeof this.options.timeout === 'number'
|
|
59
|
+
? {
|
|
60
|
+
request: this.options.timeout,
|
|
61
|
+
connect: this.options.timeout,
|
|
62
|
+
dns: this.options.timeout,
|
|
63
|
+
}
|
|
64
|
+
: this.options.timeout,
|
|
65
|
+
userAgent: this.options.userAgent,
|
|
66
|
+
headers: this.options.headers,
|
|
67
|
+
followRedirects: this.options.followRedirects,
|
|
68
|
+
maxRedirects: this.options.maxRedirects,
|
|
69
|
+
ssrfProtection: this.ssrfProtection,
|
|
70
|
+
http2: this.options.http2,
|
|
71
|
+
signal: this.options.signal,
|
|
72
|
+
logRedirect: (fromUrl, toUrl) => {
|
|
73
|
+
this.logger?.warn(`Redirect: ${fromUrl} → ${toUrl}`);
|
|
74
|
+
if (this.debugEnabled && this.debugLogger) {
|
|
75
|
+
this.debugLogger.debug('Redirect occurred', {
|
|
76
|
+
fromUrl,
|
|
77
|
+
toUrl,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const bootstrapOpts = this.options.bootstrap && typeof this.options.bootstrap === 'object'
|
|
84
|
+
? this.options.bootstrap
|
|
85
|
+
: undefined;
|
|
86
|
+
this.bootstrap = new BootstrapDiscovery(this.options.bootstrapUrl, this.fetcher, bootstrapOpts);
|
|
87
|
+
const cacheOptions = typeof this.options.cache === 'boolean'
|
|
88
|
+
? this.options.cache
|
|
89
|
+
? DEFAULT_OPTIONS.cache
|
|
90
|
+
: { strategy: 'none' }
|
|
91
|
+
: this.options.cache;
|
|
92
|
+
this.cache = new CacheManager(cacheOptions);
|
|
93
|
+
this.normalizer = new Normalizer();
|
|
94
|
+
const privacyOptions = typeof this.options.privacy === 'boolean'
|
|
95
|
+
? { redactPII: this.options.privacy }
|
|
96
|
+
: this.options.privacy;
|
|
97
|
+
this.piiRedactor = new PIIRedactor(privacyOptions);
|
|
98
|
+
const rateLimitOptions = typeof this.options.rateLimit === 'boolean'
|
|
99
|
+
? this.options.rateLimit
|
|
100
|
+
? DEFAULT_OPTIONS.rateLimit
|
|
101
|
+
: { enabled: false }
|
|
102
|
+
: this.options.rateLimit;
|
|
103
|
+
this.rateLimiter = new RateLimiter(rateLimitOptions);
|
|
104
|
+
this.connectionPool = new ConnectionPool({
|
|
105
|
+
maxConnections: 10,
|
|
106
|
+
keepAlive: true,
|
|
107
|
+
});
|
|
108
|
+
this.metricsCollector = new MetricsCollector({
|
|
109
|
+
enabled: true,
|
|
110
|
+
maxMetrics: 10000,
|
|
111
|
+
});
|
|
112
|
+
const validLogLevels = ['debug', 'info', 'warn', 'error'];
|
|
113
|
+
const configuredLevel = this.options.logging?.level;
|
|
114
|
+
const logLevel = configuredLevel && validLogLevels.includes(configuredLevel)
|
|
115
|
+
? configuredLevel
|
|
116
|
+
: 'info';
|
|
117
|
+
this.logger = new Logger({
|
|
118
|
+
level: logLevel,
|
|
119
|
+
enabled: true,
|
|
120
|
+
logRequests: true,
|
|
121
|
+
logResponses: true,
|
|
122
|
+
});
|
|
123
|
+
const debugOptions = this.options.debug;
|
|
124
|
+
this.debugEnabled = typeof debugOptions === 'boolean' ? debugOptions : debugOptions?.enabled ?? false;
|
|
125
|
+
this.debugLogger = typeof debugOptions === 'object' && debugOptions?.logger ? debugOptions.logger : undefined;
|
|
126
|
+
const middlewareOpts = this.options.middleware;
|
|
127
|
+
this.middlewareManager = new MiddlewareManager(middlewareOpts);
|
|
128
|
+
const dedupOpts = this.options.deduplication;
|
|
129
|
+
this.queryDeduplicator = new QueryDeduplicator(typeof dedupOpts === 'boolean'
|
|
130
|
+
? { enabled: dedupOpts }
|
|
131
|
+
: dedupOpts);
|
|
132
|
+
this.batchProcessor = new BatchProcessor(this);
|
|
133
|
+
this.orchestrator = new QueryOrchestrator({
|
|
134
|
+
cache: this.cache,
|
|
135
|
+
bootstrap: this.bootstrap,
|
|
136
|
+
fetcher: this.fetcher,
|
|
137
|
+
normalizer: this.normalizer,
|
|
138
|
+
piiRedactor: this.piiRedactor,
|
|
139
|
+
includeRaw: this.options.includeRaw,
|
|
140
|
+
fetchWithRetry: this.fetchWithRetry.bind(this),
|
|
141
|
+
rateLimiter: this.rateLimiter,
|
|
142
|
+
metricsCollector: this.metricsCollector,
|
|
143
|
+
logger: this.logger,
|
|
144
|
+
debugEnabled: this.debugEnabled,
|
|
145
|
+
debugLogger: this.debugLogger,
|
|
146
|
+
middleware: this.middlewareManager,
|
|
147
|
+
deduplicator: this.queryDeduplicator,
|
|
148
|
+
});
|
|
149
|
+
const backendMode = this.options.backend;
|
|
150
|
+
this.nativeBackend =
|
|
151
|
+
backendMode === 'typescript'
|
|
152
|
+
? null
|
|
153
|
+
: NativeBackend.create(backendMode === 'native' ? 'native' : 'auto');
|
|
154
|
+
}
|
|
155
|
+
async domain(domain) {
|
|
156
|
+
if (this.nativeBackend)
|
|
157
|
+
return this.nativeBackend.domain(domain);
|
|
158
|
+
const result = await this.orchestrator.queryDomain(domain);
|
|
159
|
+
this.pingTelemetry('domain');
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
async ip(ip) {
|
|
163
|
+
if (this.nativeBackend)
|
|
164
|
+
return this.nativeBackend.ip(ip);
|
|
165
|
+
const result = await this.orchestrator.queryIP(ip);
|
|
166
|
+
this.pingTelemetry('ip');
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
async asn(asn) {
|
|
170
|
+
if (this.nativeBackend)
|
|
171
|
+
return this.nativeBackend.asn(asn);
|
|
172
|
+
const result = await this.orchestrator.queryASN(asn);
|
|
173
|
+
this.pingTelemetry('asn');
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
async nameserver(nameserver) {
|
|
177
|
+
if (this.nativeBackend)
|
|
178
|
+
return this.nativeBackend.nameserver(nameserver);
|
|
179
|
+
const result = await this.orchestrator.queryNameserver(nameserver);
|
|
180
|
+
this.pingTelemetry('nameserver');
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
async entity(handle, serverUrl) {
|
|
184
|
+
if (this.nativeBackend)
|
|
185
|
+
return this.nativeBackend.entity(handle, serverUrl);
|
|
186
|
+
const result = await this.orchestrator.queryEntity(handle, serverUrl);
|
|
187
|
+
this.pingTelemetry('entity');
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
async checkAvailability(domain) {
|
|
191
|
+
try {
|
|
192
|
+
const response = await this.domain(domain);
|
|
193
|
+
const expirationEvent = response.events?.find(e => e.type === 'expiration');
|
|
194
|
+
const expiresAt = expirationEvent ? new Date(expirationEvent.date) : undefined;
|
|
195
|
+
return { domain: response.query, available: false, expiresAt };
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
if (error instanceof RDAPServerError && error.statusCode === 404) {
|
|
199
|
+
return { domain, available: true };
|
|
200
|
+
}
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async checkAvailabilityBatch(domains) {
|
|
205
|
+
const entries = await Promise.all(domains.map(async (domain) => {
|
|
206
|
+
const result = await this.checkAvailability(domain);
|
|
207
|
+
return [domain, result];
|
|
208
|
+
}));
|
|
209
|
+
return new Map(entries);
|
|
210
|
+
}
|
|
211
|
+
async searchDomains(pattern, serverUrl) {
|
|
212
|
+
const server = serverUrl ?? (await this.bootstrap.discoverDomain('example.com'));
|
|
213
|
+
const url = `${server}/domains?name=${encodeURIComponent(pattern)}`;
|
|
214
|
+
let raw;
|
|
215
|
+
try {
|
|
216
|
+
raw = await this.fetchWithRetry(url);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
if (error instanceof RDAPServerError &&
|
|
220
|
+
(error.statusCode === 404 || error.statusCode === 501)) {
|
|
221
|
+
throw new SearchNotSupportedError(`RDAP server does not support domain search: ${server}`, { pattern, serverUrl: server });
|
|
222
|
+
}
|
|
223
|
+
throw error;
|
|
224
|
+
}
|
|
225
|
+
const domainSearchResults = raw['domainSearchResults'] ?? [];
|
|
226
|
+
const results = domainSearchResults.map((item) => this.normalizer.normalize(item, pattern, server, false, this.options.includeRaw));
|
|
227
|
+
return { results, totalCount: results.length, query: pattern };
|
|
228
|
+
}
|
|
229
|
+
async searchEntities(pattern, serverUrl) {
|
|
230
|
+
if (!serverUrl) {
|
|
231
|
+
throw new SearchNotSupportedError('searchEntities requires an explicit serverUrl — there is no global bootstrap for entities', { pattern });
|
|
232
|
+
}
|
|
233
|
+
const url = `${serverUrl}/entities?fn=${encodeURIComponent(pattern)}`;
|
|
234
|
+
let raw;
|
|
235
|
+
try {
|
|
236
|
+
raw = await this.fetchWithRetry(url);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
if (error instanceof RDAPServerError &&
|
|
240
|
+
(error.statusCode === 404 || error.statusCode === 501)) {
|
|
241
|
+
throw new SearchNotSupportedError(`RDAP server does not support entity search: ${serverUrl}`, { pattern, serverUrl });
|
|
242
|
+
}
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
const entitySearchResults = raw['entitySearchResults'] ?? [];
|
|
246
|
+
const results = entitySearchResults.map((item) => this.normalizer.normalize(item, pattern, serverUrl, false, this.options.includeRaw));
|
|
247
|
+
return { results, totalCount: results.length, query: pattern };
|
|
248
|
+
}
|
|
249
|
+
async explain(query) {
|
|
250
|
+
const startTime = Date.now();
|
|
251
|
+
let queryType = 'domain';
|
|
252
|
+
let detectedType = 'unknown';
|
|
253
|
+
try {
|
|
254
|
+
if (/^\d+$/.test(query) || /^AS\d+$/i.test(query)) {
|
|
255
|
+
_validateASNFn(query);
|
|
256
|
+
queryType = 'asn';
|
|
257
|
+
detectedType = 'asn';
|
|
258
|
+
}
|
|
259
|
+
else if (query.includes('.') && /^\d/.test(query)) {
|
|
260
|
+
_validateIPFn(query);
|
|
261
|
+
queryType = 'ip';
|
|
262
|
+
detectedType = 'ipv4';
|
|
263
|
+
}
|
|
264
|
+
else if (query.includes(':')) {
|
|
265
|
+
_validateIPFn(query);
|
|
266
|
+
queryType = 'ip';
|
|
267
|
+
detectedType = 'ipv6';
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
_validateDomainFn(query);
|
|
271
|
+
queryType = 'domain';
|
|
272
|
+
detectedType = 'domain';
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
queryType = 'domain';
|
|
277
|
+
detectedType = 'unknown';
|
|
278
|
+
}
|
|
279
|
+
const cacheEnabled = this.options.cache !== false;
|
|
280
|
+
let cacheStatus = cacheEnabled ? 'miss' : 'disabled';
|
|
281
|
+
if (cacheEnabled) {
|
|
282
|
+
const { generateCacheKey } = await import('../../shared/utils/helpers');
|
|
283
|
+
const cacheKey = generateCacheKey(queryType, query.toLowerCase());
|
|
284
|
+
const cached = await this.cache.get(cacheKey);
|
|
285
|
+
if (cached)
|
|
286
|
+
cacheStatus = 'hit';
|
|
287
|
+
}
|
|
288
|
+
let bootstrapServer = null;
|
|
289
|
+
let builtUrl = null;
|
|
290
|
+
let error;
|
|
291
|
+
try {
|
|
292
|
+
if (queryType === 'domain') {
|
|
293
|
+
bootstrapServer = await this.bootstrap.discoverDomain(query.toLowerCase());
|
|
294
|
+
builtUrl = `${bootstrapServer}/domain/${query.toLowerCase()}`;
|
|
295
|
+
}
|
|
296
|
+
else if (queryType === 'ip') {
|
|
297
|
+
const version = _validateIPFn(query);
|
|
298
|
+
bootstrapServer =
|
|
299
|
+
version === 'v4'
|
|
300
|
+
? await this.bootstrap.discoverIPv4(query)
|
|
301
|
+
: await this.bootstrap.discoverIPv6(query);
|
|
302
|
+
builtUrl = `${bootstrapServer}/ip/${query}`;
|
|
303
|
+
}
|
|
304
|
+
else if (queryType === 'asn') {
|
|
305
|
+
const asnNum = _validateASNFn(query);
|
|
306
|
+
bootstrapServer = await this.bootstrap.discoverASN(asnNum);
|
|
307
|
+
builtUrl = `${bootstrapServer}/autnum/${asnNum}`;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
catch (err) {
|
|
311
|
+
error = err instanceof Error ? err.message : String(err);
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
query,
|
|
315
|
+
queryType,
|
|
316
|
+
detectedType,
|
|
317
|
+
bootstrapServer,
|
|
318
|
+
builtUrl,
|
|
319
|
+
cacheStatus,
|
|
320
|
+
latencyMs: Date.now() - startTime,
|
|
321
|
+
error,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
pingTelemetry(queryType) {
|
|
325
|
+
const telemetryOpts = this.options.usageTelemetry;
|
|
326
|
+
if (telemetryOpts?.enabled === true) {
|
|
327
|
+
UsageTelemetry.ping(queryType, telemetryOpts.endpoint);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async fetchWithRetry(url) {
|
|
331
|
+
const retryOptions = typeof this.options.retry === 'boolean'
|
|
332
|
+
? this.options.retry
|
|
333
|
+
? DEFAULT_OPTIONS.retry
|
|
334
|
+
: { maxAttempts: 1 }
|
|
335
|
+
: this.options.retry;
|
|
336
|
+
let lastError;
|
|
337
|
+
for (let attempt = 1; attempt <= (retryOptions.maxAttempts || 1); attempt++) {
|
|
338
|
+
try {
|
|
339
|
+
return await this.fetcher.fetch(url);
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
lastError = error;
|
|
343
|
+
if (error instanceof ValidationError) {
|
|
344
|
+
throw error;
|
|
345
|
+
}
|
|
346
|
+
if (attempt < (retryOptions.maxAttempts || 1)) {
|
|
347
|
+
const delay = calculateBackoff(attempt, retryOptions.backoff || 'exponential', retryOptions.initialDelay || 1000, retryOptions.maxDelay || 10000);
|
|
348
|
+
await sleep(delay);
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
throw lastError;
|
|
354
|
+
}
|
|
355
|
+
normalizeOptions(options) {
|
|
356
|
+
return deepMerge(DEFAULT_OPTIONS, options);
|
|
357
|
+
}
|
|
358
|
+
async validate() {
|
|
359
|
+
const errors = [];
|
|
360
|
+
const warnings = [];
|
|
361
|
+
const bootstrapUrl = this.options.bootstrapUrl;
|
|
362
|
+
if (bootstrapUrl && bootstrapUrl !== 'https://data.iana.org/rdap') {
|
|
363
|
+
try {
|
|
364
|
+
await this.fetcher.fetch(`${bootstrapUrl}/dns.json`);
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
errors.push(`Bootstrap URL unreachable: ${bootstrapUrl}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const cacheOpts = this.options.cache;
|
|
371
|
+
if (cacheOpts?.strategy === 'redis' && cacheOpts?.redisClient) {
|
|
372
|
+
try {
|
|
373
|
+
await cacheOpts.redisClient.ping();
|
|
374
|
+
}
|
|
375
|
+
catch {
|
|
376
|
+
errors.push('Redis connection failed');
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
const ssrfOpts = this.options.ssrfProtection;
|
|
380
|
+
if (ssrfOpts?.enabled === false) {
|
|
381
|
+
warnings.push('SSRF protection disabled — not safe for production');
|
|
382
|
+
}
|
|
383
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
384
|
+
}
|
|
385
|
+
async clearCache() {
|
|
386
|
+
await this.cache.clear();
|
|
387
|
+
this.bootstrap.clearCache();
|
|
388
|
+
}
|
|
389
|
+
async getStats() {
|
|
390
|
+
return {
|
|
391
|
+
cache: await this.cache.getStats(),
|
|
392
|
+
bootstrap: this.bootstrap.getCacheStats(),
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
getConfig() {
|
|
396
|
+
return { ...this.options };
|
|
397
|
+
}
|
|
398
|
+
getRateLimiter() {
|
|
399
|
+
return this.rateLimiter;
|
|
400
|
+
}
|
|
401
|
+
getBatchProcessor() {
|
|
402
|
+
return this.batchProcessor;
|
|
403
|
+
}
|
|
404
|
+
streamBatch(requests, options) {
|
|
405
|
+
return this.batchProcessor.streamBatch(requests, options);
|
|
406
|
+
}
|
|
407
|
+
getMetrics(since) {
|
|
408
|
+
return this.metricsCollector.getSummary(since);
|
|
409
|
+
}
|
|
410
|
+
getConnectionPoolStats() {
|
|
411
|
+
return this.connectionPool.getStats();
|
|
412
|
+
}
|
|
413
|
+
use(hooks) {
|
|
414
|
+
this.middlewareManager.use(hooks);
|
|
415
|
+
return this;
|
|
416
|
+
}
|
|
417
|
+
getMiddlewareManager() {
|
|
418
|
+
return this.middlewareManager;
|
|
419
|
+
}
|
|
420
|
+
getDeduplicatorStats() {
|
|
421
|
+
return this.queryDeduplicator.getStats();
|
|
422
|
+
}
|
|
423
|
+
getLogger() {
|
|
424
|
+
return this.logger;
|
|
425
|
+
}
|
|
426
|
+
getLogs(count) {
|
|
427
|
+
return this.logger.getLogs(count);
|
|
428
|
+
}
|
|
429
|
+
async clearAll() {
|
|
430
|
+
await this.cache.clear();
|
|
431
|
+
this.bootstrap.clearCache();
|
|
432
|
+
this.metricsCollector.clear();
|
|
433
|
+
this.logger.clear();
|
|
434
|
+
}
|
|
435
|
+
destroy() {
|
|
436
|
+
this.rateLimiter.destroy();
|
|
437
|
+
this.connectionPool.destroy();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RDAPClient } from './RDAPClient';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export class QueryDeduplicator {
|
|
2
|
+
constructor(options) {
|
|
3
|
+
this.inflight = new Map();
|
|
4
|
+
this.windowMs = options?.windowMs ?? 100;
|
|
5
|
+
this.enabled = options?.enabled ?? true;
|
|
6
|
+
}
|
|
7
|
+
deduplicate(key, fn) {
|
|
8
|
+
if (!this.enabled) {
|
|
9
|
+
return fn();
|
|
10
|
+
}
|
|
11
|
+
const existing = this.inflight.get(key);
|
|
12
|
+
if (existing !== undefined) {
|
|
13
|
+
return existing;
|
|
14
|
+
}
|
|
15
|
+
const promise = fn().finally(() => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
if (this.inflight.get(key) === promise) {
|
|
18
|
+
this.inflight.delete(key);
|
|
19
|
+
}
|
|
20
|
+
}, this.windowMs);
|
|
21
|
+
});
|
|
22
|
+
this.inflight.set(key, promise);
|
|
23
|
+
return promise;
|
|
24
|
+
}
|
|
25
|
+
getInflightCount() {
|
|
26
|
+
return this.inflight.size;
|
|
27
|
+
}
|
|
28
|
+
getInflightKeys() {
|
|
29
|
+
return Array.from(this.inflight.keys());
|
|
30
|
+
}
|
|
31
|
+
clear() {
|
|
32
|
+
this.inflight.clear();
|
|
33
|
+
}
|
|
34
|
+
getStats() {
|
|
35
|
+
return {
|
|
36
|
+
enabled: this.enabled,
|
|
37
|
+
inflight: this.inflight.size,
|
|
38
|
+
windowMs: this.windowMs,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export class MiddlewareManager {
|
|
2
|
+
constructor(hooks) {
|
|
3
|
+
this.priorityEntries = [];
|
|
4
|
+
this.hooks = hooks ?? {};
|
|
5
|
+
}
|
|
6
|
+
async safeRun(fn, ctx) {
|
|
7
|
+
if (!fn)
|
|
8
|
+
return;
|
|
9
|
+
try {
|
|
10
|
+
await fn(ctx);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async runBeforeQuery(ctx) {
|
|
16
|
+
let aborted = false;
|
|
17
|
+
const enrichedCtx = {
|
|
18
|
+
...ctx,
|
|
19
|
+
abort: () => {
|
|
20
|
+
aborted = true;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
for (const entry of this.priorityEntries) {
|
|
24
|
+
if (entry.hooks.beforeQuery) {
|
|
25
|
+
await this.safeRun(entry.hooks.beforeQuery, enrichedCtx);
|
|
26
|
+
if (aborted)
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
await this.safeRun(this.hooks.beforeQuery, enrichedCtx);
|
|
31
|
+
return aborted;
|
|
32
|
+
}
|
|
33
|
+
async runAfterQuery(ctx) {
|
|
34
|
+
for (const entry of this.priorityEntries) {
|
|
35
|
+
await this.safeRun(entry.hooks.afterQuery, ctx);
|
|
36
|
+
}
|
|
37
|
+
await this.safeRun(this.hooks.afterQuery, ctx);
|
|
38
|
+
}
|
|
39
|
+
async runOnError(ctx) {
|
|
40
|
+
for (const entry of this.priorityEntries) {
|
|
41
|
+
await this.safeRun(entry.hooks.onError, ctx);
|
|
42
|
+
}
|
|
43
|
+
await this.safeRun(this.hooks.onError, ctx);
|
|
44
|
+
}
|
|
45
|
+
async runOnCacheHit(ctx) {
|
|
46
|
+
for (const entry of this.priorityEntries) {
|
|
47
|
+
await this.safeRun(entry.hooks.onCacheHit, ctx);
|
|
48
|
+
}
|
|
49
|
+
await this.safeRun(this.hooks.onCacheHit, ctx);
|
|
50
|
+
}
|
|
51
|
+
async runOnCacheMiss(ctx) {
|
|
52
|
+
for (const entry of this.priorityEntries) {
|
|
53
|
+
await this.safeRun(entry.hooks.onCacheMiss, ctx);
|
|
54
|
+
}
|
|
55
|
+
await this.safeRun(this.hooks.onCacheMiss, ctx);
|
|
56
|
+
}
|
|
57
|
+
async runOnRetry(ctx) {
|
|
58
|
+
for (const entry of this.priorityEntries) {
|
|
59
|
+
await this.safeRun(entry.hooks.onRetry, ctx);
|
|
60
|
+
}
|
|
61
|
+
await this.safeRun(this.hooks.onRetry, ctx);
|
|
62
|
+
}
|
|
63
|
+
use(hooks, priority) {
|
|
64
|
+
if (priority !== undefined) {
|
|
65
|
+
this.priorityEntries.push({ priority, hooks });
|
|
66
|
+
this.priorityEntries.sort((a, b) => a.priority - b.priority);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.hooks = { ...this.hooks, ...hooks };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
clear() {
|
|
73
|
+
this.hooks = {};
|
|
74
|
+
this.priorityEntries = [];
|
|
75
|
+
}
|
|
76
|
+
getRegisteredHooks() {
|
|
77
|
+
return Object.keys(this.hooks).filter((k) => this.hooks[k] !== undefined);
|
|
78
|
+
}
|
|
79
|
+
}
|