rdapify 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +151 -93
  2. package/README.md +168 -146
  3. package/dist/application/client/RDAPClient.d.ts +4 -1
  4. package/dist/application/client/RDAPClient.d.ts.map +1 -1
  5. package/dist/application/client/RDAPClient.js +22 -0
  6. package/dist/application/client/RDAPClient.js.map +1 -1
  7. package/dist/application/hooks/MiddlewareHooks.d.ts +1 -1
  8. package/dist/application/hooks/MiddlewareHooks.d.ts.map +1 -1
  9. package/dist/application/services/BatchProcessor.d.ts +1 -0
  10. package/dist/application/services/BatchProcessor.d.ts.map +1 -1
  11. package/dist/application/services/BatchProcessor.js +9 -0
  12. package/dist/application/services/BatchProcessor.js.map +1 -1
  13. package/dist/application/services/QueryOrchestrator.d.ts +3 -1
  14. package/dist/application/services/QueryOrchestrator.d.ts.map +1 -1
  15. package/dist/application/services/QueryOrchestrator.js +192 -0
  16. package/dist/application/services/QueryOrchestrator.js.map +1 -1
  17. package/dist/cli/index.js +78 -5
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/index.d.ts +5 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +16 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/http/BootstrapDiscovery.d.ts +1 -0
  24. package/dist/infrastructure/http/BootstrapDiscovery.d.ts.map +1 -1
  25. package/dist/infrastructure/http/BootstrapDiscovery.js +19 -0
  26. package/dist/infrastructure/http/BootstrapDiscovery.js.map +1 -1
  27. package/dist/infrastructure/http/Fetcher.js +1 -1
  28. package/dist/infrastructure/http/Normalizer.d.ts +2 -0
  29. package/dist/infrastructure/http/Normalizer.d.ts.map +1 -1
  30. package/dist/infrastructure/http/Normalizer.js +57 -0
  31. package/dist/infrastructure/http/Normalizer.js.map +1 -1
  32. package/dist/infrastructure/logging/AuditLogger.d.ts +7 -7
  33. package/dist/infrastructure/logging/AuditLogger.d.ts.map +1 -1
  34. package/dist/infrastructure/logging/AuditLogger.js.map +1 -1
  35. package/dist/infrastructure/monitoring/MetricsCollector.d.ts +3 -3
  36. package/dist/infrastructure/monitoring/MetricsCollector.d.ts.map +1 -1
  37. package/dist/infrastructure/monitoring/MetricsCollector.js.map +1 -1
  38. package/dist/infrastructure/native/NativeBackend.d.ts +13 -0
  39. package/dist/infrastructure/native/NativeBackend.d.ts.map +1 -0
  40. package/dist/infrastructure/native/NativeBackend.js +92 -0
  41. package/dist/infrastructure/native/NativeBackend.js.map +1 -0
  42. package/dist/shared/constants/rdap.constants.d.ts +1 -1
  43. package/dist/shared/constants/rdap.constants.js +1 -1
  44. package/dist/shared/types/generics.d.ts +6 -3
  45. package/dist/shared/types/generics.d.ts.map +1 -1
  46. package/dist/shared/types/index.d.ts +1 -1
  47. package/dist/shared/types/index.d.ts.map +1 -1
  48. package/dist/shared/types/options.d.ts +1 -0
  49. package/dist/shared/types/options.d.ts.map +1 -1
  50. package/dist/shared/types/options.js +2 -1
  51. package/dist/shared/types/options.js.map +1 -1
  52. package/dist/shared/types/responses.d.ts +42 -2
  53. package/dist/shared/types/responses.d.ts.map +1 -1
  54. package/dist/shared/utils/validators/entity.d.ts +3 -0
  55. package/dist/shared/utils/validators/entity.d.ts.map +1 -0
  56. package/dist/shared/utils/validators/entity.js +27 -0
  57. package/dist/shared/utils/validators/entity.js.map +1 -0
  58. package/dist/shared/utils/validators/index.d.ts +2 -0
  59. package/dist/shared/utils/validators/index.d.ts.map +1 -1
  60. package/dist/shared/utils/validators/index.js +7 -1
  61. package/dist/shared/utils/validators/index.js.map +1 -1
  62. package/dist/shared/utils/validators/nameserver.d.ts +3 -0
  63. package/dist/shared/utils/validators/nameserver.d.ts.map +1 -0
  64. package/dist/shared/utils/validators/nameserver.js +49 -0
  65. package/dist/shared/utils/validators/nameserver.js.map +1 -0
  66. package/package.json +14 -10
package/CHANGELOG.md CHANGED
@@ -7,6 +7,105 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Planned
11
+ - **Domain Availability**: `client.checkAvailability(domain)` — check if a domain is available via RDAP (404 = available, active = registered)
12
+ - **Bulk Availability**: `client.checkAvailabilityBatch(domains[])` — check multiple domains in parallel
13
+ - **Live Integration Tests**: opt-in via `LIVE_TESTS=1` environment variable
14
+ - **Advanced Bootstrap Config**: custom bootstrap servers, TTL overrides, redundancy/fallback support
15
+
16
+ ## [0.1.8] - 2026-03-21
17
+
18
+ ### Added
19
+
20
+ - **Rust native backend** — when `@rdapify/core` (optional peer dependency) is installed, the five core query methods (`domain`, `ip`, `asn`, `nameserver`, `entity`) are executed by a compiled Rust binary, reducing latency significantly for high-throughput scenarios
21
+ - **`backend` option** on `RDAPClientOptions`: `'auto'` (default — uses native if available, falls back to TypeScript silently), `'native'` (requires `@rdapify/core`, throws at construction if missing), `'typescript'` (always uses TypeScript pipeline regardless of installation)
22
+ - **`isNativeAvailable()`** utility — detect at runtime whether `@rdapify/core` is installed and loadable
23
+
24
+ ### Notes
25
+
26
+ - The native backend bypasses TypeScript-layer features (middleware hooks, rate limiting, audit logging, deduplication); best suited for simple high-throughput scenarios
27
+ - Response shapes are fully compatible: the adapter normalises `meta` → `metadata`, `queried_at` → `timestamp`, and injects `objectClass` to match TypeScript interfaces exactly
28
+
29
+ ## [0.1.7] - 2026-03-19
30
+
31
+ ### Fixed
32
+
33
+ - **Playground deployment**: `website/static/playground-app/app.js` was out of sync with `playground/public/app.js`; domains returning HTTP 404 now correctly show "Domain Available" instead of an error
34
+ - **Jest forceExit**: Added `forceExit: true` to `jest.config.js` to prevent CI hangs caused by open Redis async handles
35
+ - **redis-cache tests**: Updated tests to match `scanAll()`/`keys()` implementation instead of the removed `dbSize()`/`flushDb()` approach
36
+
37
+ ### Added
38
+
39
+ - **Nameserver queries**: New `client.nameserver(hostname)` method for querying nameserver RDAP data
40
+ - Automatic server discovery via IANA DNS TLD bootstrap
41
+ - Returns `NameserverResponse` with `ldhName`, `ipAddresses`, `status`, `entities`, `events`
42
+ - Full support for caching, middleware hooks, metrics, deduplication, and PII redaction
43
+ - **Entity queries**: New `client.entity(handle, serverUrl)` method for querying RDAP entity data
44
+ - Returns `EntityResponse` with `handle`, `vcardArray`, `roles`, `status`, `entities`, `events`
45
+ - Requires explicit `serverUrl` (no global IANA bootstrap exists for entities)
46
+ - Full support for caching, middleware hooks, metrics, and deduplication
47
+ - **CLI commands extended**:
48
+ - `rdapify nameserver <hostname>` — query nameserver RDAP data
49
+ - `rdapify entity <handle> --server <url>` — query entity RDAP data
50
+ - New `--server <url>` flag for specifying RDAP server URL
51
+ - **New response types**: `NameserverResponse` and `EntityResponse` exported from main entry point
52
+ - **New validators exported**: `validateNameserver`, `normalizeNameserver`, `validateEntityHandle`, `normalizeEntityHandle`
53
+ - **Normalizer extended**: Handles `nameserver` and `entity` objectClassName values from raw RDAP responses
54
+ - **BootstrapDiscovery extended**: New `discoverNameserver()` method using DNS TLD bootstrap
55
+
56
+ ## [0.1.6] - 2026-03-17
57
+
58
+ ### Added
59
+
60
+ - **isCloudflareWorkers()**: New runtime detection function for Cloudflare Workers environment
61
+ - **CLI Tool**: New `rdapify` CLI command with zero external dependencies
62
+ - `rdapify domain <name>` — query domain RDAP data
63
+ - `rdapify ip <addr>` — query IP RDAP data
64
+ - `rdapify asn <num>` — query ASN RDAP data
65
+ - Flags: `--json`, `--no-cache`, `--timeout`
66
+
67
+ ### Fixed
68
+
69
+ - **RedisCache.clear() (Critical)**: Previously called `flushDb()` which wiped the entire Redis database; now only deletes keys matching the configured prefix using SCAN
70
+ - **RedisCache.size() (Critical)**: Previously used `dbSize()` returning total DB size; now counts only prefixed keys accurately
71
+ - **RedisCache SCAN (Performance)**: Replaced blocking `KEYS` command with non-blocking `SCAN` iteration; added `scanAll()` private helper; added optional `scan?()` to `RedisClientLike` interface; removed unused `flushDb?()` and `dbSize?()` from interface
72
+ - **runtime.ts (Compatibility)**: `isNode()` wrapped with `typeof process !== 'undefined'` guard to prevent `ReferenceError` in Cloudflare Workers
73
+
74
+ ## [0.1.5] - 2026-03-14
75
+
76
+ ### Added
77
+
78
+ - **RedisCache**: Redis adapter with peer-dependency pattern, compatible with ioredis and node-redis v4+
79
+ - **AuthenticationManager**: Support for Bearer tokens, API keys, Basic auth, and OAuth2
80
+ - **ProxyManager**: HTTP/HTTPS/SOCKS proxy support for RDAP requests
81
+ - **CompressionManager**: gzip/deflate/brotli compression for requests/responses
82
+ - **PersistentCache**: File-system backed cache that survives process restarts
83
+ - **MiddlewareManager**: Full lifecycle hooks — `beforeQuery`, `afterQuery`, `onError`, `onCacheHit`
84
+ - **QueryDeduplicator**: Collapses in-flight duplicate queries into a single upstream request
85
+ - **AuditLogger**: GDPR/SOC2-compliant audit trail with `InMemoryAuditAdapter` and `FileAuditAdapter`
86
+ - **ResponseValidator**: RFC 7483 response validation with strict and lenient modes
87
+ - All new classes exported from main entry point
88
+
89
+ ## [0.1.4] - 2026-03-13
90
+
91
+ ### Added
92
+
93
+ - **MiddlewareHooks**: Middleware hooks system (`src/application/hooks/MiddlewareHooks.ts`)
94
+ - **QueryDeduplicator**: Initial implementation (`src/application/deduplication/QueryDeduplicator.ts`)
95
+ - **AuditLogger**: Initial implementation (`src/infrastructure/logging/AuditLogger.ts`)
96
+ - **ResponseValidator**: RFC 7483 compliance validation (`src/infrastructure/validation/ResponseValidator.ts`)
97
+
98
+ ### Changed
99
+
100
+ - **TypeScript strict mode**: Enabled and enforced strict mode improvements across the codebase
101
+ - **Generic types**: Enhanced type safety in `src/shared/types/generics.ts`
102
+ - **QueryPriority**: Improved type safety in `src/application/services/QueryPriority.ts`
103
+ - **BatchProcessor**: Improved type safety in `src/application/services/BatchProcessor.ts`
104
+
105
+ ### Testing
106
+
107
+ - Additional test coverage for edge cases across existing and new modules
108
+
10
109
  ## [0.1.3] - 2026-03-12
11
110
 
12
111
  ### Fixed
@@ -77,17 +176,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
176
  - Multiple package manager support (npm, yarn, pnpm)
78
177
  - Integrated into website navigation
79
178
  - Production-ready documentation and testing guides
179
+ - **Connection Pooling**: HTTP connection reuse for 30-40% performance improvement
180
+ - Configurable max connections per host
181
+ - Automatic idle connection cleanup
182
+ - Keep-alive support for persistent connections
183
+ - **Metrics & Monitoring**: Comprehensive query metrics tracking
184
+ - Success/failure rates and response times
185
+ - Cache hit/miss statistics
186
+ - Query type distribution (domain/IP/ASN)
187
+ - Error type tracking
188
+ - Time-based filtering and analysis
189
+ - **Request/Response Logging**: Detailed logging system with multiple levels
190
+ - Configurable log levels (debug, info, warn, error)
191
+ - Request/response logging with timing
192
+ - Cache operation logging
193
+ - Performance metrics logging
194
+ - JSON and text output formats
195
+ - Log filtering and export capabilities
196
+ - **Client API Extensions**: New methods for monitoring and debugging
197
+ - `getMetrics()`: Get query metrics summary
198
+ - `getConnectionPoolStats()`: Get connection pool statistics
199
+ - `getLogger()`: Access logger instance
200
+ - `getLogs()`: Retrieve recent logs
201
+ - `clearAll()`: Clear all caches, metrics, and logs
202
+ - `destroy()`: Clean up resources
80
203
 
81
204
  ### Changed
82
205
  - Updated website navigation to include Playground link
83
206
  - Enhanced documentation for production deployment
207
+ - **QueryOrchestrator**: Integrated logging and metrics collection into all query methods
208
+ - **RDAPClient**: Added connection pool, metrics collector, and logger initialization
84
209
 
85
210
  ### Fixed
86
211
  - ESLint errors in Logger.ts and enhanced-validators.ts (6 issues resolved)
87
212
 
213
+ ### Tests
214
+ - Added comprehensive test suites for new features:
215
+ - `connection-pool.test.ts`: 9 tests covering connection management
216
+ - `metrics-collector.test.ts`: 11 tests covering metrics tracking
217
+ - `logger.test.ts`: 18 tests covering logging functionality
218
+
88
219
  ## [0.1.1] - 2026-01-25
89
220
 
90
- ### Added - Phase 3 Improvements
221
+ ### Added
91
222
  - **Authentication Support**: Multiple authentication methods for RDAP servers
92
223
  - Basic Authentication (username/password)
93
224
  - Bearer Token authentication
@@ -105,8 +236,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
105
236
  - Automatic response decompression
106
237
  - Compression statistics and ratio calculation
107
238
  - Configurable compression threshold
108
-
109
- ### Added - Phase 2 Improvements
110
239
  - **Retry Strategies**: Advanced retry logic with circuit breaker pattern
111
240
  - Exponential, linear, and fixed backoff strategies
112
241
  - Exponential backoff with jitter to prevent thundering herd
@@ -130,85 +259,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
130
259
  - TTL and max size enforcement
131
260
  - LRU eviction policy
132
261
  - Cache statistics and cleanup
133
-
134
- ### Changed
135
- - **Exports**: Added new exports for Phase 2 features in index.ts
136
-
137
- ### Tests
138
- - Added comprehensive test suites for Phase 3 features:
139
- - `authentication-manager.test.ts`: 17 tests covering all auth methods
140
- - `proxy-manager.test.ts`: 16 tests covering proxy configuration
141
- - `compression-manager.test.ts`: 19 tests covering compression/decompression
142
- - Added comprehensive test suites for Phase 2 features:
143
- - `retry-strategy.test.ts`: 13 tests covering retry logic and circuit breaker
144
- - `query-priority.test.ts`: 8 tests covering priority queue functionality
145
- - `enhanced-validators.test.ts`: 21 tests covering validation enhancements
146
- - `persistent-cache.test.ts`: 13 tests covering persistent storage
147
-
148
- ### Performance
149
- - **Retry Strategies**: Intelligent retry reduces failed requests
150
- - **Query Prioritization**: Critical queries execute first
151
- - **Persistent Cache**: Faster startup with pre-loaded cache
152
-
153
- ## [0.1.2] - 2026-01-26
154
-
155
- ### Added - Phase 1 Improvements
156
- - **Connection Pooling**: HTTP connection reuse for 30-40% performance improvement
157
- - Configurable max connections per host
158
- - Automatic idle connection cleanup
159
- - Keep-alive support for persistent connections
160
- - **Metrics & Monitoring**: Comprehensive query metrics tracking
161
- - Success/failure rates and response times
162
- - Cache hit/miss statistics
163
- - Query type distribution (domain/IP/ASN)
164
- - Error type tracking
165
- - Time-based filtering and analysis
166
- - **Request/Response Logging**: Detailed logging system with multiple levels
167
- - Configurable log levels (debug, info, warn, error)
168
- - Request/response logging with timing
169
- - Cache operation logging
170
- - Performance metrics logging
171
- - JSON and text output formats
172
- - Log filtering and export capabilities
173
- - **Client API Extensions**: New methods for monitoring and debugging
174
- - `getMetrics()`: Get query metrics summary
175
- - `getConnectionPoolStats()`: Get connection pool statistics
176
- - `getLogger()`: Access logger instance
177
- - `getLogs()`: Retrieve recent logs
178
- - `clearAll()`: Clear all caches, metrics, and logs
179
- - `destroy()`: Clean up resources
180
-
181
- ### Changed
182
- - **QueryOrchestrator**: Integrated logging and metrics collection into all query methods
183
- - **RDAPClient**: Added connection pool, metrics collector, and logger initialization
184
-
185
- ### Tests
186
- - Added comprehensive test suites for new features:
187
- - `connection-pool.test.ts`: 9 tests covering connection management
188
- - `metrics-collector.test.ts`: 11 tests covering metrics tracking
189
- - `logger.test.ts`: 18 tests covering logging functionality
190
-
191
- ## [0.1.1] - 2026-01-25
192
-
193
- ### Added
194
262
  - **Rate Limiting**: Token bucket rate limiter with multi-key support and auto-cleanup
195
263
  - **Batch Processing**: Efficient concurrent processing of multiple RDAP queries
196
264
  - **Enhanced Error Handling**: Errors now include suggestions, timestamps, and user-friendly messages
197
265
  - **Generic Types**: Type-safe query functions with automatic result type inference
198
266
  - **Tree Shaking Support**: Modular exports for smaller bundle sizes
199
- - **Comprehensive Tests**: Added 37+ new tests for PIIRedactor, CacheManager, and RateLimiter
200
267
 
201
268
  ### Changed
269
+ - **Exports**: Added new exports for all Phase 1–3 features in index.ts
202
270
  - **Error Classes**: All errors now include `suggestion`, `timestamp`, and `getUserMessage()` method
203
271
  - **RateLimitError**: Added `retryAfter` field to indicate when to retry
204
272
  - **Package Exports**: Added modular exports for errors, types, and validators
205
273
  - **TypeScript Config**: Optimized for better tree shaking and smaller output
206
-
207
- ### Improved
208
- - **Test Coverage**: Increased from 76.74% to ~85-90% (estimated)
209
- - **Type Safety**: Better generic types for query operations
210
- - **Developer Experience**: More helpful error messages and suggestions
211
- - **Performance**: Batch processing with configurable concurrency
274
+ - Standardized Node.js version to v20 across all GitHub Actions workflows
275
+ - Updated all workflows to use `node-version-file: .nvmrc` for consistency
276
+ - Improved npm caching in CI/CD workflows for faster builds
277
+ - Added `NODE_ENV: production` to website build workflow
212
278
 
213
279
  ### Fixed
214
280
  - Fixed prism-react-renderer theme import in Docusaurus configuration
@@ -219,19 +285,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
219
285
  - Fixed missing sidebars.js configuration
220
286
  - Removed empty pages causing build failures
221
287
 
222
- ### Changed
223
- - Standardized Node.js version to v20 across all GitHub Actions workflows
224
- - Updated all workflows to use `node-version-file: .nvmrc` for consistency
225
- - Improved npm caching in CI/CD workflows for faster builds
226
- - Added `NODE_ENV: production` to website build workflow
227
- - Added `onBrokenMarkdownImages: 'warn'` to Docusaurus config
228
- - Enhanced release workflow with better error handling
288
+ ### Tests
289
+ - Added comprehensive test suites:
290
+ - `authentication-manager.test.ts`: 17 tests covering all auth methods
291
+ - `proxy-manager.test.ts`: 16 tests covering proxy configuration
292
+ - `compression-manager.test.ts`: 19 tests covering compression/decompression
293
+ - `retry-strategy.test.ts`: 13 tests covering retry logic and circuit breaker
294
+ - `query-priority.test.ts`: 8 tests covering priority queue functionality
295
+ - `enhanced-validators.test.ts`: 21 tests covering validation enhancements
296
+ - `persistent-cache.test.ts`: 13 tests covering persistent storage
297
+ - PIIRedactor, CacheManager, and RateLimiter: 37+ new tests
229
298
 
230
- ### Added
231
- - Created SVG placeholder icons for homepage features (typescript, performance, security, multi-env, unified, privacy)
232
- - Added examples validation workflow
233
- - Added fork check for Snyk security scans to prevent token exposure
234
- - Added comprehensive CI/CD fixes documentation
299
+ ### Performance
300
+ - **Retry Strategies**: Intelligent retry reduces failed requests
301
+ - **Query Prioritization**: Critical queries execute first
302
+ - **Persistent Cache**: Faster startup with pre-loaded cache
235
303
 
236
304
  ## [0.1.0] - 2025-01-25
237
305
 
@@ -361,16 +429,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
361
429
  - ESLint for code quality
362
430
  - Prettier for code formatting
363
431
 
364
- ## [Unreleased]
365
-
366
- ### Planned for v0.2.0
367
- - Redis cache implementation
368
- - CLI tool for quick queries
369
- - Live integration tests
370
- - Improved error messages
371
- - Performance benchmarks
372
- - Additional runtime support (Bun, Deno)
373
-
374
432
  ---
375
433
 
376
434
  [0.1.0-alpha.1]: https://github.com/rdapify/rdapify/releases/tag/v0.1.0-alpha.1