rdapify 0.1.7 → 0.1.9
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/CHANGELOG.md +135 -6
- package/README.md +50 -31
- package/dist/application/client/RDAPClient.d.ts +7 -1
- package/dist/application/client/RDAPClient.d.ts.map +1 -1
- package/dist/application/client/RDAPClient.js +101 -24
- package/dist/application/client/RDAPClient.js.map +1 -1
- package/dist/application/hooks/MiddlewareHooks.d.ts +4 -2
- package/dist/application/hooks/MiddlewareHooks.d.ts.map +1 -1
- package/dist/application/hooks/MiddlewareHooks.js +41 -3
- package/dist/application/hooks/MiddlewareHooks.js.map +1 -1
- package/dist/application/services/BatchProcessor.d.ts +6 -0
- package/dist/application/services/BatchProcessor.d.ts.map +1 -1
- package/dist/application/services/BatchProcessor.js +54 -2
- package/dist/application/services/BatchProcessor.js.map +1 -1
- package/dist/application/services/QueryOrchestrator.d.ts +3 -2
- package/dist/application/services/QueryOrchestrator.d.ts.map +1 -1
- package/dist/application/services/QueryOrchestrator.js +16 -5
- package/dist/application/services/QueryOrchestrator.js.map +1 -1
- package/dist/index.d.ts +28 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/cache/RedisCache.d.ts +10 -0
- package/dist/infrastructure/cache/RedisCache.d.ts.map +1 -1
- package/dist/infrastructure/cache/RedisCache.js +37 -1
- package/dist/infrastructure/cache/RedisCache.js.map +1 -1
- package/dist/infrastructure/http/BootstrapDiscovery.d.ts +6 -3
- package/dist/infrastructure/http/BootstrapDiscovery.d.ts.map +1 -1
- package/dist/infrastructure/http/BootstrapDiscovery.js +55 -12
- package/dist/infrastructure/http/BootstrapDiscovery.js.map +1 -1
- package/dist/infrastructure/http/BrowserFetcher.d.ts +16 -0
- package/dist/infrastructure/http/BrowserFetcher.d.ts.map +1 -0
- package/dist/infrastructure/http/BrowserFetcher.js +47 -0
- package/dist/infrastructure/http/BrowserFetcher.js.map +1 -0
- package/dist/infrastructure/http/BunFetcher.d.ts +19 -0
- package/dist/infrastructure/http/BunFetcher.d.ts.map +1 -0
- package/dist/infrastructure/http/BunFetcher.js +51 -0
- package/dist/infrastructure/http/BunFetcher.js.map +1 -0
- package/dist/infrastructure/http/CircuitBreaker.d.ts +33 -0
- package/dist/infrastructure/http/CircuitBreaker.d.ts.map +1 -0
- package/dist/infrastructure/http/CircuitBreaker.js +104 -0
- package/dist/infrastructure/http/CircuitBreaker.js.map +1 -0
- package/dist/infrastructure/http/CloudflareWorkersFetcher.d.ts +18 -0
- package/dist/infrastructure/http/CloudflareWorkersFetcher.d.ts.map +1 -0
- package/dist/infrastructure/http/CloudflareWorkersFetcher.js +44 -0
- package/dist/infrastructure/http/CloudflareWorkersFetcher.js.map +1 -0
- package/dist/infrastructure/http/DenoFetcher.d.ts +18 -0
- package/dist/infrastructure/http/DenoFetcher.d.ts.map +1 -0
- package/dist/infrastructure/http/DenoFetcher.js +43 -0
- package/dist/infrastructure/http/DenoFetcher.js.map +1 -0
- package/dist/infrastructure/http/Fetcher.d.ts +2 -0
- package/dist/infrastructure/http/Fetcher.d.ts.map +1 -1
- package/dist/infrastructure/http/Fetcher.js +5 -0
- package/dist/infrastructure/http/Fetcher.js.map +1 -1
- package/dist/infrastructure/monitoring/GrafanaDashboard.d.ts +571 -0
- package/dist/infrastructure/monitoring/GrafanaDashboard.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/GrafanaDashboard.js +119 -0
- package/dist/infrastructure/monitoring/GrafanaDashboard.js.map +1 -0
- package/dist/infrastructure/monitoring/PrometheusExporter.d.ts +20 -0
- package/dist/infrastructure/monitoring/PrometheusExporter.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/PrometheusExporter.js +77 -0
- package/dist/infrastructure/monitoring/PrometheusExporter.js.map +1 -0
- package/dist/infrastructure/monitoring/TelemetryExporter.d.ts +42 -0
- package/dist/infrastructure/monitoring/TelemetryExporter.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/TelemetryExporter.js +117 -0
- package/dist/infrastructure/monitoring/TelemetryExporter.js.map +1 -0
- package/dist/infrastructure/native/NativeBackend.d.ts +13 -0
- package/dist/infrastructure/native/NativeBackend.d.ts.map +1 -0
- package/dist/infrastructure/native/NativeBackend.js +92 -0
- package/dist/infrastructure/native/NativeBackend.js.map +1 -0
- package/dist/integrations/express.d.ts +23 -0
- package/dist/integrations/express.d.ts.map +1 -0
- package/dist/integrations/express.js +49 -0
- package/dist/integrations/express.js.map +1 -0
- package/dist/integrations/graphql.d.ts +20 -0
- package/dist/integrations/graphql.d.ts.map +1 -0
- package/dist/integrations/graphql.js +85 -0
- package/dist/integrations/graphql.js.map +1 -0
- package/dist/integrations/nestjs.d.ts +18 -0
- package/dist/integrations/nestjs.d.ts.map +1 -0
- package/dist/integrations/nestjs.js +29 -0
- package/dist/integrations/nestjs.js.map +1 -0
- package/dist/shared/errors/base.error.d.ts +3 -0
- package/dist/shared/errors/base.error.d.ts.map +1 -1
- package/dist/shared/errors/base.error.js +7 -1
- package/dist/shared/errors/base.error.js.map +1 -1
- package/dist/shared/types/index.d.ts +1 -1
- package/dist/shared/types/index.d.ts.map +1 -1
- package/dist/shared/types/options.d.ts +20 -0
- package/dist/shared/types/options.d.ts.map +1 -1
- package/dist/shared/types/options.js +11 -1
- package/dist/shared/types/options.js.map +1 -1
- package/dist/shared/types/responses.d.ts +5 -0
- package/dist/shared/types/responses.d.ts.map +1 -1
- package/dist/shared/utils/deprecation.d.ts +3 -0
- package/dist/shared/utils/deprecation.d.ts.map +1 -0
- package/dist/shared/utils/deprecation.js +25 -0
- package/dist/shared/utils/deprecation.js.map +1 -0
- package/package.json +23 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,13 +5,142 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [Unreleased]
|
|
8
|
+
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
## [1.0.0] - planned February 2027
|
|
11
|
+
|
|
12
|
+
### Summary
|
|
13
|
+
API freeze release. `RDAPClient` interface is stable and guaranteed not to
|
|
14
|
+
have breaking changes in subsequent 1.x releases. All 83 public exports are
|
|
15
|
+
classified in `API_STABILITY_ANALYSIS.md`.
|
|
16
|
+
|
|
17
|
+
### Highlights
|
|
18
|
+
- **Branch coverage**: ≥ 90% (1066 tests).
|
|
19
|
+
- **API freeze**: 83 exports locked; all deprecated APIs removed.
|
|
20
|
+
- **Runtime support**: Node.js (confirmed), Bun/Deno/Cloudflare Workers (verified externally).
|
|
21
|
+
- **Security Audit**: all critical/high findings resolved (requires external audit completion).
|
|
22
|
+
- **Documentation**: complete Arabic and English docs at rdapify.com.
|
|
23
|
+
|
|
24
|
+
### Breaking Changes (from 0.3.1)
|
|
25
|
+
All APIs marked `@deprecated` in v0.3.1 are removed in v1.0.0.
|
|
26
|
+
See `MIGRATION_1_0.md` (to be published with release).
|
|
27
|
+
|
|
28
|
+
## [0.3.1] - unreleased
|
|
29
|
+
|
|
30
|
+
### Deprecated
|
|
31
|
+
|
|
32
|
+
The following APIs are deprecated as of v0.3.1 and will be removed or changed in v1.0.0.
|
|
33
|
+
Migration paths are listed. Warnings are emitted via `process.emitWarning` (Node.js)
|
|
34
|
+
or `console.warn` (other runtimes) at most once per process lifetime.
|
|
35
|
+
|
|
36
|
+
| API | Deprecation Code | Migration |
|
|
37
|
+
|-----|-----------------|-----------|
|
|
38
|
+
| `client.getBatchProcessor()` | `DEP_RDAPIFY_0001` | Use `client.streamBatch()` for streaming results, or call `processBatch()` via the batch processor. In v1.0.0, `processBatch()` will be a direct method on `RDAPClient`. |
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- **API Stability Analysis** — `API_STABILITY_ANALYSIS.md` in the internal planning directory classifies all 83 public exports as Stable / Evolving / Deprecated for the v1.0.0 API freeze; details migration paths for each deprecated API
|
|
43
|
+
- **`BrowserFetcher`** — browser-compatible RDAP fetcher that routes requests through a developer-supplied CORS-enabled reverse proxy; uses only Web-standard APIs (`fetch`, `AbortSignal`, `URLSearchParams`); enables rdapify in React, Vue, Angular, and vanilla browser environments
|
|
44
|
+
- **`BrowserFetcherOptions`** type — `{ proxyUrl: string; timeout?: number; headers?: Record<string, string> }`
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- `BatchProcessor` class JSDoc updated to reflect its evolving status; direct class imports should prefer `client.streamBatch()` or the convenience methods added in v1.0.0
|
|
49
|
+
- Fixed unhandled promise rejection in `BatchProcessor.processBatch()` when `continueOnError: false` — `.finally()` on the inner promise was creating a dangling rejected promise; replaced with `.then(cleanup, cleanup)` to safely remove completed items from the in-progress list
|
|
50
|
+
|
|
51
|
+
### Coverage
|
|
52
|
+
|
|
53
|
+
- Branch coverage increased to **80.25%** (above the 80% jest threshold) by adding targeted tests for previously uncovered branches across `Logger`, `MetricsCollector`, `nestjs.ts`, `nameserver.ts`, `express.ts`, `BatchProcessor`, and `QueryPriority` modules
|
|
54
|
+
|
|
55
|
+
## [0.3.0] - unreleased
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- **Streaming batch API** — `client.streamBatch(requests, options?)` is an async generator that yields `BatchQueryResult` items as each query completes; processes queries in concurrency-bounded chunks so at most `concurrency` (default 5) requests are ever in-flight simultaneously; suitable for 1000+ query sets with no memory overflow; `continueOnError: true` by default isolates per-query failures; exports new `StreamBatchOptions` type
|
|
60
|
+
- **Prometheus exporter** — `PrometheusExporter` converts internal `MetricsCollector` data to the [Prometheus text-based exposition format v0.0.4](https://prometheus.io/docs/instrumenting/exposition_formats/); supports custom metric prefix, constant labels, and `createHttpHandler()` which returns a request handler compatible with Node.js, Express, and Fastify; `PrometheusExporter.CONTENT_TYPE` constant provides the correct `Content-Type` header value
|
|
61
|
+
- **Grafana dashboard template** — `RDAPIFY_GRAFANA_DASHBOARD` is a ready-to-import Grafana dashboard JSON with panels for total queries, success rate, cache hit rate, average response time, P50/P90/P99 latency percentiles, queries by type, and error breakdown by error type
|
|
62
|
+
- **OpenTelemetry OTLP trace exporter** — `TelemetryExporter` ships RDAP query spans to any OTLP/HTTP JSON endpoint (Jaeger, Grafana Tempo, Honeycomb, etc.); zero `@opentelemetry/sdk-node` dependency — uses Web-standard `fetch`; `client.startSpan()` / `client.endSpan()` API; enabled via `ClientConfig.telemetry.endpoint`; errors silently swallowed to avoid disrupting query path
|
|
63
|
+
- **Multi-region bootstrap** — `BootstrapOptions.regions?: Array<'us' | 'eu' | 'ap'>` configures preferred regional IANA bootstrap mirror order; `BootstrapDiscovery` tries each regional URL in order and falls back to the primary IANA endpoint on network failure; duplicate URLs (same region mapping) are de-duplicated automatically
|
|
64
|
+
- **Deprecation warning utility** — `deprecated(name, alternative?, code?)` emits a Node.js `DeprecationWarning` via `process.emitWarning` (or `console.warn` in Deno/Bun/CF Workers); each unique `code` is emitted at most once per process lifetime; `_resetDeprecationState()` available for tests
|
|
65
|
+
- **`TelemetryOptions` type exported** — new configuration interface in `RDAPClientOptions.telemetry`
|
|
66
|
+
- **42 new unit tests**: streaming batch (10), Prometheus exporter (10), TelemetryExporter (9), deprecation (7), multi-region bootstrap (5)
|
|
67
|
+
- **API snapshot updated** — 82 exported symbols
|
|
68
|
+
|
|
69
|
+
## [0.2.3] - unreleased
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
|
|
73
|
+
- **GraphQL integration** — `createRdapifySchema(client)` returns a `{ typeDefs, resolvers }` object compatible with graphql-yoga, Apollo Server, and any standards-compliant GraphQL runtime; no `graphql` peer dependency required at import time; exports `RDAPIFY_TYPE_DEFS` (SDL string) and `RdapifyResolvers` type
|
|
74
|
+
- `Query.domain(name: String!)` — resolves `ldhName`, `registrar` (flattened to name string), `status`, `expiresAt`, `createdAt`, `updatedAt` (dates extracted from `events[]`)
|
|
75
|
+
- `Query.ip(address: String!)` — resolves `country`, `name`, `startAddress`, `endAddress`, `status`
|
|
76
|
+
- `Query.asn(number: String!)` — resolves `name`, `status`, `startAutnum`, `endAutnum`
|
|
77
|
+
- **Express.js integration** — `rdapifyExpress(client, router?)` registers `GET /domain/:name`, `GET /ip/:address`, `GET /asn/:number` routes on any Express-compatible router; when no router is provided, creates a `MinimalRouter` (duck-typed; no `express` peer dependency required); errors are returned as `{ error: string }` with status 500
|
|
78
|
+
- **NestJS integration** — `RdapifyModule.forRoot(options?)` returns a NestJS-compatible `DynamicModule` that provides `RDAPClient` via the `RDAPIFY_CLIENT_TOKEN` symbol; `@InjectRdapClient()` is a `ParameterDecorator` factory that marks constructor parameters for injection; zero `@nestjs/common` dependency
|
|
79
|
+
- **24 new unit tests**: GraphQL schema (9), Express routes (8), NestJS module + decorator (7)
|
|
80
|
+
- **7 new public exports**: `createRdapifySchema`, `RDAPIFY_TYPE_DEFS`, `RdapifyResolvers` (type), `rdapifyExpress`, `MinimalRouter`, `RouterLike` (type), `RequestLike` (type), `ResponseLike` (type), `RdapifyModule`, `InjectRdapClient`, `RDAPIFY_CLIENT_TOKEN`, `RdapifyModuleOptions` (type), `RdapifyDynamicModule` (type)
|
|
81
|
+
- **API snapshot updated** — 78 exported symbols
|
|
82
|
+
|
|
83
|
+
## [0.2.2] - unreleased
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
87
|
+
- **Deno Support** — `DenoFetcher` implements `IFetcherPort` using the Web-standard `fetch` built into Deno; `RDAPClient` auto-selects `DenoFetcher` when `isDeno()` is true; uses no Node.js-specific APIs
|
|
88
|
+
- **Cloudflare Workers Support** — `CloudflareWorkersFetcher` implements `IFetcherPort` for the Edge runtime; zero Node.js-specific code (`require`, `process`, `Buffer`, `fs` are absent from the implementation); `RDAPClient` auto-selects it when `isCloudflareWorkers()` is true
|
|
89
|
+
- **Subpath exports** — `package.json` now exports `./node`, `./deno`, and `./worker` subpath conditions; all currently point to the main bundle (auto-detection handles runtime selection internally)
|
|
90
|
+
- **Priority order** — fetcher auto-selection order: Cloudflare Workers → Deno → Bun → Node.js (standard `Fetcher`)
|
|
91
|
+
- **22 new unit tests**: DenoFetcher (9 tests), CloudflareWorkersFetcher (13 tests)
|
|
92
|
+
|
|
93
|
+
## [0.2.1] - unreleased
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
97
|
+
- **Bun Runtime Support** — `BunFetcher` implements `IFetcherPort` using `Bun.fetch` when running under the Bun runtime; `RDAPClient` auto-detects Bun via `isBun()` and selects `BunFetcher` automatically — no configuration needed
|
|
98
|
+
- **`BunFetcher` exported** — available for direct instantiation when custom Bun-specific setups are required; accepts `timeout`, `userAgent`, `headers`, and `ssrfProtection` options
|
|
99
|
+
- **CI Bun job** — `.github/workflows/ci.yml` now includes a `test-bun` job that installs dependencies with `bun install` and runs the unit test suite under Bun
|
|
100
|
+
- **14 unit tests** for `BunFetcher`: `resolveFetch()` detection (Bun present / absent / non-function), successful fetch, header forwarding, custom headers, 4xx/5xx → `RDAPServerError`, timeout → `TimeoutError`, generic error → `NetworkError`, SSRF protection integration, Bun.fetch preference over global fetch
|
|
101
|
+
|
|
102
|
+
## [0.2.0] - unreleased
|
|
103
|
+
|
|
104
|
+
### Added
|
|
105
|
+
|
|
106
|
+
- **Circuit Breaker** — `CircuitBreaker` class with full state machine: `closed → open → half-open → closed/open`; configurable `failureThreshold`, `successThreshold`, `halfOpenTimeout`, `window`; exported as `CircuitBreaker`, `CircuitOpenError`, `CircuitState`, `CircuitBreakerOptions`
|
|
107
|
+
- **Middleware abort** — `ctx.abort()` in any `beforeQuery` hook now stops the query pipeline; `MiddlewareManager.runBeforeQuery()` returns `Promise<boolean>` (true = aborted); aborted queries throw `QueryAbortedError`
|
|
108
|
+
- **Middleware priority ordering** — `manager.use(hooks, priority)` registers hooks at a specific priority level (lower number = runs first); multiple hooks for the same lifecycle event run in priority order; hooks registered without a priority use the existing merge/override behaviour
|
|
109
|
+
- **Redis key compression** — `RedisCacheOptions.keyMaxLength` (default 200); keys longer than the threshold are hashed to a SHA-256 hex digest before being stored in Redis; prevents oversized key errors
|
|
110
|
+
- **Redis pipeline** — `RedisCache.getMany(keys)` batch-retrieves multiple responses using `mget` when available, falling back to individual `get` calls; `RedisCache.setMany(entries)` batch-stores multiple responses
|
|
111
|
+
- **HTTP/2 opt-in** — `RDAPClientOptions.http2: boolean` (default `false`); when `true`, the fetcher sets `Upgrade: h2c` and `HTTP2-Settings` headers to signal HTTP/2 preference to supporting registries
|
|
112
|
+
- **`QueryAbortedError`** exported from public API
|
|
113
|
+
- **63 new unit tests**: circuit breaker state transitions (14), middleware abort + priority (14), Redis key compression + pipeline (17), HTTP/2 (5), middleware hooks compatibility fix (2)
|
|
114
|
+
|
|
115
|
+
## [0.1.9] - unreleased
|
|
116
|
+
|
|
117
|
+
### Added
|
|
118
|
+
|
|
119
|
+
- **Domain Availability Check** — `client.checkAvailability(domain): Promise<AvailabilityResult>` parses the RDAP response to determine if a domain is registered; returns `available: true` when the registry responds with HTTP 404, and extracts `expiresAt` from the RDAP expiration event when available
|
|
120
|
+
- **Batch Availability Check** — `client.checkAvailabilityBatch(domains[]): Promise<Map<string, AvailabilityResult>>` checks multiple domains in parallel and returns a Map keyed by domain name
|
|
121
|
+
- **`AvailabilityResult` type** exported from the public API: `{ domain: string; available: boolean; expiresAt?: Date }`
|
|
122
|
+
- **Live Integration Tests** — `npm run test:live` (requires `LIVE_TESTS=1`); tests Verisign (.com/.net), ARIN (IPv4), RIPE (European IPv4), and ASN 15169; excluded from regular `npm test`; `.github/workflows/live-tests.yml` runs weekly on Sunday
|
|
123
|
+
- **Advanced Bootstrap Configuration** — new `bootstrap` option on `RDAPClientOptions`:
|
|
124
|
+
- `bootstrap.customServers: { tld: string; url: string }[]` — custom RDAP endpoints per TLD; take priority over IANA, no network call needed
|
|
125
|
+
- `bootstrap.ttl: number` — override the default 24-hour bootstrap cache TTL (in seconds)
|
|
126
|
+
- `bootstrap.fallback: boolean` — set to `false` to disable IANA lookup entirely (useful for private registries); default `true`
|
|
127
|
+
- **`BootstrapOptions` type** exported from the public API
|
|
128
|
+
- 17 unit tests for the new features (8 availability + 9 bootstrap advanced)
|
|
129
|
+
|
|
130
|
+
## [0.1.8] - 2026-03-21
|
|
131
|
+
|
|
132
|
+
### Added
|
|
133
|
+
|
|
134
|
+
- **Rust native backend** — when `rdapify-nd` (optional peer dependency) is installed, the five core query methods (`domain`, `ip`, `asn`, `nameserver`, `entity`) are dispatched to a compiled Rust binary, reducing per-call overhead for high-throughput scenarios
|
|
135
|
+
- **`backend` option** on `RDAPClientOptions`: `'auto'` (default — uses native if available, falls back to TypeScript silently), `'native'` (requires `rdapify-nd`, throws at construction if absent), `'typescript'` (always uses the TypeScript pipeline regardless of what is installed)
|
|
136
|
+
- **`isNativeAvailable()`** utility — runtime detection of whether `rdapify-nd` is installed and loadable
|
|
137
|
+
- **`NativeBackend`** class exported for advanced use cases (direct access to the adapter)
|
|
138
|
+
- **28 unit tests** added for the NativeBackend adapter: field mapping (`meta`→`metadata`, `queried_at`→`timestamp`), `objectClass` injection, numeric ASN coercion, and module-absent fallback
|
|
139
|
+
|
|
140
|
+
### Notes
|
|
141
|
+
|
|
142
|
+
- The native backend bypasses the TypeScript pipeline (middleware hooks, rate limiting, audit logging, deduplication); best suited for latency-sensitive, high-throughput scenarios where those features are not required
|
|
143
|
+
- Response shapes are fully compatible: the adapter normalises Rust snake_case fields to match TypeScript interfaces exactly
|
|
15
144
|
|
|
16
145
|
## [0.1.7] - 2026-03-19
|
|
17
146
|
|
package/README.md
CHANGED
|
@@ -79,8 +79,8 @@ console.log({
|
|
|
79
79
|
registrar: result.registrar?.name,
|
|
80
80
|
status: result.status,
|
|
81
81
|
nameservers: result.nameservers,
|
|
82
|
-
created: result.events.find((e) => e.
|
|
83
|
-
expires: result.events.find((e) => e.
|
|
82
|
+
created: result.events.find((e) => e.eventAction === 'registration')?.eventDate,
|
|
83
|
+
expires: result.events.find((e) => e.eventAction === 'expiration')?.eventDate,
|
|
84
84
|
});
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -91,10 +91,9 @@ import { RDAPClient } from 'rdapify';
|
|
|
91
91
|
|
|
92
92
|
// Create a secure client with optimized defaults
|
|
93
93
|
const client = new RDAPClient({
|
|
94
|
-
cache: true,
|
|
95
|
-
|
|
94
|
+
cache: true, // In-memory LRU cache (1 hour TTL)
|
|
95
|
+
privacy: true, // Automatic PII redaction (GDPR/CCPA)
|
|
96
96
|
retry: {
|
|
97
|
-
// Smart retries for transient failures
|
|
98
97
|
maxAttempts: 3,
|
|
99
98
|
backoff: 'exponential',
|
|
100
99
|
},
|
|
@@ -112,7 +111,7 @@ const entity = await client.entity('ARIN-HN-1', 'https://rdap.arin.net/registry'
|
|
|
112
111
|
|
|
113
112
|
```json
|
|
114
113
|
{
|
|
115
|
-
"
|
|
114
|
+
"query": "example.com",
|
|
116
115
|
"registrar": "Internet Assigned Numbers Authority",
|
|
117
116
|
"status": ["clientDeleteProhibited", "clientTransferProhibited", "clientUpdateProhibited"],
|
|
118
117
|
"nameservers": ["a.iana-servers.net", "b.iana-servers.net"],
|
|
@@ -339,7 +338,7 @@ We don't treat security as an add-on feature — it's fundamental to our design.
|
|
|
339
338
|
| MitM | Mandatory HTTPS, certificate validation | 🟠 Important |
|
|
340
339
|
| Data Injection | Schema validation, strict parsing | 🟠 Important |
|
|
341
340
|
|
|
342
|
-
Read our [Security Whitepaper](security/whitepaper.md) for deeper technical details and advanced scenarios.
|
|
341
|
+
Read our [Security Whitepaper](docs/security/whitepaper.md) for deeper technical details and advanced scenarios.
|
|
343
342
|
|
|
344
343
|
## 📚 Documentation
|
|
345
344
|
|
|
@@ -352,7 +351,7 @@ RDAPify provides comprehensive documentation in the repository:
|
|
|
352
351
|
- **[Guides](docs/guides/)** - Error handling, caching strategies, and performance optimization
|
|
353
352
|
- **[Examples](examples/)** - Real-world code examples and use cases
|
|
354
353
|
|
|
355
|
-
> **
|
|
354
|
+
> **Tip**: Full API and guide documentation is available in the [`docs/`](docs/) directory.
|
|
356
355
|
|
|
357
356
|
## 🌐 Interactive Playground
|
|
358
357
|
|
|
@@ -360,7 +359,22 @@ Try RDAPify directly in your browser — no installation required: **[rdapify.co
|
|
|
360
359
|
|
|
361
360
|
## 📊 Performance Benchmarks
|
|
362
361
|
|
|
363
|
-
|
|
362
|
+
Measured on the **native backend** (`rdapify-nd`, `cargo bench`, Criterion, Linux x86-64, mock HTTP server). TypeScript pipeline benchmarks are ~10-20× higher latency:
|
|
363
|
+
|
|
364
|
+
| Scenario | Latency |
|
|
365
|
+
|----------|---------|
|
|
366
|
+
| Query — no cache (bootstrap + fetch + normalise) | ~180 µs |
|
|
367
|
+
| Query — **cache hit** | **~2.3 µs** (~80× faster) |
|
|
368
|
+
| Cache read (DashMap, fresh TTL) | ~124 ns |
|
|
369
|
+
| SSRF URL validation | ~141–295 ns |
|
|
370
|
+
|
|
371
|
+
> **With the native backend** (`npm install rdapify-nd`), the five core query methods
|
|
372
|
+
> run inside compiled Rust rather than the TypeScript pipeline — lower per-call
|
|
373
|
+
> overhead for high-throughput scenarios.
|
|
374
|
+
>
|
|
375
|
+
> ```ts
|
|
376
|
+
> const client = new RDAPClient({ backend: 'auto' }); // uses rdapify-nd if installed
|
|
377
|
+
> ```
|
|
364
378
|
|
|
365
379
|
## 👥 Community & Support
|
|
366
380
|
|
|
@@ -381,21 +395,9 @@ RDAPify is an open source project. Get help or contribute:
|
|
|
381
395
|
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines
|
|
382
396
|
- **[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)** - Community standards
|
|
383
397
|
|
|
384
|
-
|
|
385
|
-
## 🤝 Contributing
|
|
386
|
-
|
|
387
|
-
We welcome contributions! Whether you're a:
|
|
388
|
-
|
|
389
|
-
- Developer wanting to fix bugs or add features
|
|
390
|
-
- Writer improving documentation
|
|
391
|
-
- Tester reporting issues
|
|
392
|
-
- Security engineer reviewing code
|
|
393
|
-
|
|
394
|
-
Start by reading our [Contribution Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
395
|
-
|
|
396
398
|
## 🚧 Project Status
|
|
397
399
|
|
|
398
|
-
**Current Release**: v0.1.
|
|
400
|
+
**Current Release**: v0.1.8 (Alpha)
|
|
399
401
|
|
|
400
402
|
### 🎉 What's New in v0.1.7
|
|
401
403
|
|
|
@@ -436,7 +438,7 @@ Start by reading our [Contribution Guide](CONTRIBUTING.md) and [Code of Conduct]
|
|
|
436
438
|
|
|
437
439
|
See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
438
440
|
|
|
439
|
-
### ✅ Full Feature Set (v0.1.
|
|
441
|
+
### ✅ Full Feature Set (v0.1.8)
|
|
440
442
|
|
|
441
443
|
- ✅ **RDAP Client**: Domain, IP, ASN, Nameserver, and Entity queries with automatic IANA bootstrap discovery
|
|
442
444
|
- ✅ **CLI Tool**: Command-line interface with human-readable and JSON output (`domain`, `ip`, `asn`, `nameserver`, `entity`)
|
|
@@ -459,11 +461,30 @@ See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
|
|
|
459
461
|
- ✅ **Authentication**: Basic, Bearer, API Key, OAuth2
|
|
460
462
|
- ✅ **Proxy Support**: HTTP/HTTPS/SOCKS4/SOCKS5 with bypass patterns
|
|
461
463
|
- ✅ **Response Compression**: gzip, brotli, deflate (60-80% bandwidth reduction)
|
|
464
|
+
- ✅ **Rust Native Backend**: optional `rdapify-nd` for lower-latency queries via compiled Rust (`backend: 'auto' | 'native' | 'typescript'`)
|
|
462
465
|
- ✅ **Multi-runtime**: Node.js 20+, Bun, Deno, Cloudflare Workers
|
|
463
466
|
- ✅ **TypeScript Strict**: Full type definitions with strict mode
|
|
464
467
|
- ✅ **Test Coverage**: 34 test files, 620+ tests (unit + integration)
|
|
465
468
|
|
|
466
|
-
###
|
|
469
|
+
### 🎉 What's New in v0.1.8
|
|
470
|
+
|
|
471
|
+
**Rust Native Backend (`rdapify-nd`)**
|
|
472
|
+
- ✅ **Optional native backend**: install `rdapify-nd` alongside `rdapify` for lower-latency queries powered by compiled Rust
|
|
473
|
+
- ✅ **`backend` option**: `'auto'` (default, uses native if available), `'native'` (require native), `'typescript'` (always use TS pipeline)
|
|
474
|
+
- ✅ **`isNativeAvailable()`**: runtime detection utility to check if native binary is loaded
|
|
475
|
+
- ✅ **Transparent fallback**: when `rdapify-nd` is absent, all existing behaviour is preserved with zero configuration change
|
|
476
|
+
|
|
477
|
+
```ts
|
|
478
|
+
import { RDAPClient, isNativeAvailable } from 'rdapify';
|
|
479
|
+
|
|
480
|
+
console.log(isNativeAvailable()); // true if rdapify-nd is installed
|
|
481
|
+
|
|
482
|
+
const client = new RDAPClient({ backend: 'auto' }); // transparent
|
|
483
|
+
const client2 = new RDAPClient({ backend: 'native' }); // throws if not installed
|
|
484
|
+
const client3 = new RDAPClient({ backend: 'typescript' }); // always TS pipeline
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### 🔜 Coming in v0.1.9
|
|
467
488
|
|
|
468
489
|
- ⏳ **Domain Availability**: `client.checkAvailability('example.com')` — instant availability check via RDAP
|
|
469
490
|
- ⏳ **Bulk Availability**: `client.checkAvailabilityBatch(['a.com', 'b.com'])` — check multiple domains at once
|
|
@@ -551,13 +572,11 @@ src/
|
|
|
551
572
|
|
|
552
573
|
## 📚 Additional Documentation
|
|
553
574
|
|
|
554
|
-
- **[
|
|
555
|
-
- **[
|
|
556
|
-
- **[
|
|
557
|
-
- **[
|
|
558
|
-
- **[
|
|
559
|
-
- **[CHANGELOG.md](./CHANGELOG.md)** - Detailed version history
|
|
560
|
-
- **[ADDITIONAL_IMPROVEMENTS.md](./ADDITIONAL_IMPROVEMENTS.md)** - Implementation status
|
|
575
|
+
- **[Getting Started](./docs/getting-started/)** — Installation, quick start, first query
|
|
576
|
+
- **[API Reference](./docs/api-reference/)** — Full TypeScript API documentation
|
|
577
|
+
- **[Guides](./docs/guides/)** — Caching, error handling, performance, observability
|
|
578
|
+
- **[Security](./docs/security/)** — SSRF protection, PII redaction, threat model
|
|
579
|
+
- **[CHANGELOG.md](./CHANGELOG.md)** — Detailed version history
|
|
561
580
|
|
|
562
581
|
## 🔍 Version Verification
|
|
563
582
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RateLimiter } from '../../infrastructure/http/RateLimiter';
|
|
2
2
|
import { Logger } from '../../infrastructure/logging/Logger';
|
|
3
|
-
import type { DomainResponse, IPResponse, ASNResponse, NameserverResponse, EntityResponse } from '../../shared/types';
|
|
3
|
+
import type { DomainResponse, IPResponse, ASNResponse, NameserverResponse, EntityResponse, AvailabilityResult } from '../../shared/types';
|
|
4
4
|
import type { RDAPClientOptions } from '../../shared/types/options';
|
|
5
5
|
import { BatchProcessor } from '../services/BatchProcessor';
|
|
6
|
+
import type { BatchQueryRequest, StreamBatchOptions } from '../services/BatchProcessor';
|
|
7
|
+
import type { QueryTypeLiteral, BatchQueryResult } from '../../shared/types/generics';
|
|
6
8
|
import { MiddlewareManager } from '../hooks/MiddlewareHooks';
|
|
7
9
|
import type { MiddlewareOptions } from '../hooks/MiddlewareHooks';
|
|
8
10
|
export declare class RDAPClient {
|
|
@@ -23,12 +25,15 @@ export declare class RDAPClient {
|
|
|
23
25
|
private readonly queryDeduplicator;
|
|
24
26
|
private readonly debugEnabled;
|
|
25
27
|
private readonly debugLogger?;
|
|
28
|
+
private readonly nativeBackend;
|
|
26
29
|
constructor(options?: RDAPClientOptions);
|
|
27
30
|
domain(domain: string): Promise<DomainResponse>;
|
|
28
31
|
ip(ip: string): Promise<IPResponse>;
|
|
29
32
|
asn(asn: string | number): Promise<ASNResponse>;
|
|
30
33
|
nameserver(nameserver: string): Promise<NameserverResponse>;
|
|
31
34
|
entity(handle: string, serverUrl: string): Promise<EntityResponse>;
|
|
35
|
+
checkAvailability(domain: string): Promise<AvailabilityResult>;
|
|
36
|
+
checkAvailabilityBatch(domains: string[]): Promise<Map<string, AvailabilityResult>>;
|
|
32
37
|
private fetchWithRetry;
|
|
33
38
|
private normalizeOptions;
|
|
34
39
|
clearCache(): Promise<void>;
|
|
@@ -46,6 +51,7 @@ export declare class RDAPClient {
|
|
|
46
51
|
getConfig(): Required<RDAPClientOptions>;
|
|
47
52
|
getRateLimiter(): RateLimiter;
|
|
48
53
|
getBatchProcessor(): BatchProcessor;
|
|
54
|
+
streamBatch<T extends QueryTypeLiteral>(requests: BatchQueryRequest<T>[], options?: StreamBatchOptions): AsyncGenerator<BatchQueryResult<T>, void, unknown>;
|
|
49
55
|
getMetrics(since?: number): import("../../infrastructure/monitoring/MetricsCollector").MetricsSummary;
|
|
50
56
|
getConnectionPoolStats(): {
|
|
51
57
|
totalConnections: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RDAPClient.d.ts","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RDAPClient.d.ts","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAKpE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG1I,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;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I,CAAC;IAU/B,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RDAPClient = void 0;
|
|
4
4
|
const cache_1 = require("../../infrastructure/cache");
|
|
5
5
|
const http_1 = require("../../infrastructure/http");
|
|
6
|
+
const BunFetcher_1 = require("../../infrastructure/http/BunFetcher");
|
|
7
|
+
const DenoFetcher_1 = require("../../infrastructure/http/DenoFetcher");
|
|
8
|
+
const CloudflareWorkersFetcher_1 = require("../../infrastructure/http/CloudflareWorkersFetcher");
|
|
6
9
|
const RateLimiter_1 = require("../../infrastructure/http/RateLimiter");
|
|
7
10
|
const ConnectionPool_1 = require("../../infrastructure/http/ConnectionPool");
|
|
11
|
+
const runtime_1 = require("../../shared/utils/helpers/runtime");
|
|
8
12
|
const security_1 = require("../../infrastructure/security");
|
|
9
13
|
const MetricsCollector_1 = require("../../infrastructure/monitoring/MetricsCollector");
|
|
10
14
|
const Logger_1 = require("../../infrastructure/logging/Logger");
|
|
@@ -15,6 +19,7 @@ const services_1 = require("../services");
|
|
|
15
19
|
const BatchProcessor_1 = require("../services/BatchProcessor");
|
|
16
20
|
const MiddlewareHooks_1 = require("../hooks/MiddlewareHooks");
|
|
17
21
|
const QueryDeduplicator_1 = require("../deduplication/QueryDeduplicator");
|
|
22
|
+
const NativeBackend_1 = require("../../infrastructure/native/NativeBackend");
|
|
18
23
|
class RDAPClient {
|
|
19
24
|
constructor(options = {}) {
|
|
20
25
|
this.options = this.normalizeOptions(options);
|
|
@@ -22,30 +27,63 @@ class RDAPClient {
|
|
|
22
27
|
? { enabled: this.options.ssrfProtection }
|
|
23
28
|
: this.options.ssrfProtection;
|
|
24
29
|
this.ssrfProtection = new security_1.SSRFProtection(ssrfOptions);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
: this.options.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
30
|
+
const timeoutMs = typeof this.options.timeout === 'number'
|
|
31
|
+
? this.options.timeout
|
|
32
|
+
: this.options.timeout?.request ?? 10000;
|
|
33
|
+
if ((0, runtime_1.isCloudflareWorkers)()) {
|
|
34
|
+
this.fetcher = new CloudflareWorkersFetcher_1.CloudflareWorkersFetcher({
|
|
35
|
+
timeout: timeoutMs,
|
|
36
|
+
userAgent: this.options.userAgent,
|
|
37
|
+
headers: this.options.headers,
|
|
38
|
+
ssrfProtection: this.ssrfProtection,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else if ((0, runtime_1.isDeno)()) {
|
|
42
|
+
this.fetcher = new DenoFetcher_1.DenoFetcher({
|
|
43
|
+
timeout: timeoutMs,
|
|
44
|
+
userAgent: this.options.userAgent,
|
|
45
|
+
headers: this.options.headers,
|
|
46
|
+
ssrfProtection: this.ssrfProtection,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else if ((0, runtime_1.isBun)()) {
|
|
50
|
+
this.fetcher = new BunFetcher_1.BunFetcher({
|
|
51
|
+
timeout: timeoutMs,
|
|
52
|
+
userAgent: this.options.userAgent,
|
|
53
|
+
headers: this.options.headers,
|
|
54
|
+
ssrfProtection: this.ssrfProtection,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.fetcher = new http_1.Fetcher({
|
|
59
|
+
timeout: typeof this.options.timeout === 'number'
|
|
60
|
+
? {
|
|
61
|
+
request: this.options.timeout,
|
|
62
|
+
connect: this.options.timeout,
|
|
63
|
+
dns: this.options.timeout,
|
|
64
|
+
}
|
|
65
|
+
: this.options.timeout,
|
|
66
|
+
userAgent: this.options.userAgent,
|
|
67
|
+
headers: this.options.headers,
|
|
68
|
+
followRedirects: this.options.followRedirects,
|
|
69
|
+
maxRedirects: this.options.maxRedirects,
|
|
70
|
+
ssrfProtection: this.ssrfProtection,
|
|
71
|
+
http2: this.options.http2,
|
|
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 http_1.BootstrapDiscovery(this.options.bootstrapUrl, this.fetcher, bootstrapOpts);
|
|
49
87
|
const cacheOptions = typeof this.options.cache === 'boolean'
|
|
50
88
|
? this.options.cache
|
|
51
89
|
? options_1.DEFAULT_OPTIONS.cache
|
|
@@ -108,22 +146,58 @@ class RDAPClient {
|
|
|
108
146
|
middleware: this.middlewareManager,
|
|
109
147
|
deduplicator: this.queryDeduplicator,
|
|
110
148
|
});
|
|
149
|
+
const backendMode = this.options.backend;
|
|
150
|
+
this.nativeBackend =
|
|
151
|
+
backendMode === 'typescript'
|
|
152
|
+
? null
|
|
153
|
+
: NativeBackend_1.NativeBackend.create(backendMode === 'native' ? 'native' : 'auto');
|
|
111
154
|
}
|
|
112
155
|
async domain(domain) {
|
|
156
|
+
if (this.nativeBackend)
|
|
157
|
+
return this.nativeBackend.domain(domain);
|
|
113
158
|
return this.orchestrator.queryDomain(domain);
|
|
114
159
|
}
|
|
115
160
|
async ip(ip) {
|
|
161
|
+
if (this.nativeBackend)
|
|
162
|
+
return this.nativeBackend.ip(ip);
|
|
116
163
|
return this.orchestrator.queryIP(ip);
|
|
117
164
|
}
|
|
118
165
|
async asn(asn) {
|
|
166
|
+
if (this.nativeBackend)
|
|
167
|
+
return this.nativeBackend.asn(asn);
|
|
119
168
|
return this.orchestrator.queryASN(asn);
|
|
120
169
|
}
|
|
121
170
|
async nameserver(nameserver) {
|
|
171
|
+
if (this.nativeBackend)
|
|
172
|
+
return this.nativeBackend.nameserver(nameserver);
|
|
122
173
|
return this.orchestrator.queryNameserver(nameserver);
|
|
123
174
|
}
|
|
124
175
|
async entity(handle, serverUrl) {
|
|
176
|
+
if (this.nativeBackend)
|
|
177
|
+
return this.nativeBackend.entity(handle, serverUrl);
|
|
125
178
|
return this.orchestrator.queryEntity(handle, serverUrl);
|
|
126
179
|
}
|
|
180
|
+
async checkAvailability(domain) {
|
|
181
|
+
try {
|
|
182
|
+
const response = await this.domain(domain);
|
|
183
|
+
const expirationEvent = response.events?.find(e => e.type === 'expiration');
|
|
184
|
+
const expiresAt = expirationEvent ? new Date(expirationEvent.date) : undefined;
|
|
185
|
+
return { domain: response.query, available: false, expiresAt };
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (error instanceof errors_1.RDAPServerError && error.statusCode === 404) {
|
|
189
|
+
return { domain, available: true };
|
|
190
|
+
}
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async checkAvailabilityBatch(domains) {
|
|
195
|
+
const entries = await Promise.all(domains.map(async (domain) => {
|
|
196
|
+
const result = await this.checkAvailability(domain);
|
|
197
|
+
return [domain, result];
|
|
198
|
+
}));
|
|
199
|
+
return new Map(entries);
|
|
200
|
+
}
|
|
127
201
|
async fetchWithRetry(url) {
|
|
128
202
|
const retryOptions = typeof this.options.retry === 'boolean'
|
|
129
203
|
? this.options.retry
|
|
@@ -171,6 +245,9 @@ class RDAPClient {
|
|
|
171
245
|
getBatchProcessor() {
|
|
172
246
|
return this.batchProcessor;
|
|
173
247
|
}
|
|
248
|
+
streamBatch(requests, options) {
|
|
249
|
+
return this.batchProcessor.streamBatch(requests, options);
|
|
250
|
+
}
|
|
174
251
|
getMetrics(since) {
|
|
175
252
|
return this.metricsCollector.getSummary(since);
|
|
176
253
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RDAPClient.js","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":";;;AAKA,sDAA0D;AAC1D,oDAAoF;AACpF,uEAAoE;AACpE,6EAA0E;AAC1E,4DAA4E;AAC5E,uFAAoF;AACpF,gEAA6D;AAG7D,
|
|
1
|
+
{"version":3,"file":"RDAPClient.js","sourceRoot":"","sources":["../../../src/application/client/RDAPClient.ts"],"names":[],"mappings":";;;AAKA,sDAA0D;AAC1D,oDAAoF;AACpF,qEAAkE;AAClE,uEAAoE;AACpE,iGAA8F;AAE9F,uEAAoE;AACpE,6EAA0E;AAC1E,gEAAwF;AACxF,4DAA4E;AAC5E,uFAAoF;AACpF,gEAA6D;AAG7D,gDAAuE;AACvE,wDAA6D;AAO7D,wDAAgF;AAChF,0CAAgD;AAChD,+DAA4D;AAG5D,8DAA6D;AAE7D,0EAAuE;AACvE,6EAA0E;AAwC1E,MAAa,UAAU;IAyBrB,YAAY,UAA6B,EAAE;QAEzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAG9C,MAAM,WAAW,GACf,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,SAAS;YAC9C,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YAC1C,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,CAAC,WAAW,CAAC,CAAC;QAGtD,MAAM,SAAS,GACb,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ;YACtC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OA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nC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAKD,oBAAoB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAKD,oBAAoB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;IAKD,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAKD,OAAO,CAAC,KAAc;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAKD,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAKD,OAAO;QACL,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF;AAniBD,gCAmiBC"}
|
|
@@ -7,6 +7,7 @@ export interface QueryContext {
|
|
|
7
7
|
cached?: boolean;
|
|
8
8
|
serverUrl?: string;
|
|
9
9
|
attempt?: number;
|
|
10
|
+
abort?: () => void;
|
|
10
11
|
}
|
|
11
12
|
export interface QueryResultContext extends QueryContext {
|
|
12
13
|
duration: number;
|
|
@@ -30,9 +31,10 @@ export interface MiddlewareOptions {
|
|
|
30
31
|
}
|
|
31
32
|
export declare class MiddlewareManager {
|
|
32
33
|
private hooks;
|
|
34
|
+
private priorityEntries;
|
|
33
35
|
constructor(hooks?: MiddlewareOptions);
|
|
34
36
|
private safeRun;
|
|
35
|
-
runBeforeQuery(ctx: QueryContext): Promise<
|
|
37
|
+
runBeforeQuery(ctx: QueryContext): Promise<boolean>;
|
|
36
38
|
runAfterQuery(ctx: QueryResultContext): Promise<void>;
|
|
37
39
|
runOnError(ctx: QueryResultContext): Promise<void>;
|
|
38
40
|
runOnCacheHit(ctx: QueryContext): Promise<void>;
|
|
@@ -41,7 +43,7 @@ export declare class MiddlewareManager {
|
|
|
41
43
|
attempt: number;
|
|
42
44
|
delay: number;
|
|
43
45
|
}): Promise<void>;
|
|
44
|
-
use(hooks: Partial<MiddlewareOptions
|
|
46
|
+
use(hooks: Partial<MiddlewareOptions>, priority?: number): void;
|
|
45
47
|
clear(): void;
|
|
46
48
|
getRegisteredHooks(): string[];
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiddlewareHooks.d.ts","sourceRoot":"","sources":["../../../src/application/hooks/MiddlewareHooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAKjE,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"MiddlewareHooks.d.ts","sourceRoot":"","sources":["../../../src/application/hooks/MiddlewareHooks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAKjE,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,QAAQ,GAAG,IAAI,GAAG,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;I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