rdapper 0.1.0 → 0.2.0

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.md CHANGED
@@ -7,7 +7,7 @@ RDAP‑first domain registration lookups with WHOIS fallback. Produces a single,
7
7
  - Normalized output: registrar, contacts, nameservers, statuses, dates, DNSSEC, source metadata
8
8
  - TypeScript types included; ESM‑only; no external HTTP client (uses global `fetch`)
9
9
 
10
- Requirements: Node >= 18.17 (global `fetch`). WHOIS uses TCP port 43.
10
+ ### [🦉 See it in action on hoot.sh!](https://hoot.sh)
11
11
 
12
12
  ## Install
13
13
 
@@ -155,9 +155,11 @@ Timeouts are enforced per request using a simple race against `timeoutMs` (defau
155
155
  ## Development
156
156
 
157
157
  - Build: `npm run build`
158
- - Test: `npm test`
158
+ - Test: `npm test` (Vitest)
159
159
  - By default, tests are offline/deterministic.
160
- - Smoke tests that hit the network are gated by `SMOKE=1`, e.g. `SMOKE=1 npm test`.
160
+ - Watch mode: `npm run test:watch`
161
+ - Coverage: `npm run test:coverage`
162
+ - Smoke tests that hit the network are gated by `SMOKE=1`, e.g. `SMOKE=1 npm run test:smoke`.
161
163
  - Lint/format: `npm run lint` (Biome)
162
164
 
163
165
  Project layout:
package/dist/index.d.ts CHANGED
@@ -1,13 +1,99 @@
1
- import type { LookupOptions, LookupResult } from "./types.js";
1
+ //#region src/types.d.ts
2
+ type LookupSource = "rdap" | "whois";
3
+ interface RegistrarInfo {
4
+ name?: string;
5
+ ianaId?: string;
6
+ url?: string;
7
+ email?: string;
8
+ phone?: string;
9
+ }
10
+ interface Contact {
11
+ type: "registrant" | "admin" | "tech" | "billing" | "abuse" | "registrar" | "reseller" | "unknown";
12
+ name?: string;
13
+ organization?: string;
14
+ email?: string | string[];
15
+ phone?: string | string[];
16
+ fax?: string | string[];
17
+ street?: string[];
18
+ city?: string;
19
+ state?: string;
20
+ postalCode?: string;
21
+ country?: string;
22
+ countryCode?: string;
23
+ }
24
+ interface Nameserver {
25
+ host: string;
26
+ ipv4?: string[];
27
+ ipv6?: string[];
28
+ }
29
+ interface StatusEvent {
30
+ status: string;
31
+ description?: string;
32
+ raw?: string;
33
+ }
34
+ interface DomainRecord {
35
+ domain: string;
36
+ tld: string;
37
+ isRegistered: boolean;
38
+ isIDN?: boolean;
39
+ unicodeName?: string;
40
+ punycodeName?: string;
41
+ registry?: string;
42
+ registrar?: RegistrarInfo;
43
+ reseller?: string;
44
+ statuses?: StatusEvent[];
45
+ creationDate?: string;
46
+ updatedDate?: string;
47
+ expirationDate?: string;
48
+ deletionDate?: string;
49
+ transferLock?: boolean;
50
+ dnssec?: {
51
+ enabled: boolean;
52
+ dsRecords?: Array<{
53
+ keyTag?: number;
54
+ algorithm?: number;
55
+ digestType?: number;
56
+ digest?: string;
57
+ }>;
58
+ };
59
+ nameservers?: Nameserver[];
60
+ contacts?: Contact[];
61
+ whoisServer?: string;
62
+ rdapServers?: string[];
63
+ rawRdap?: unknown;
64
+ rawWhois?: string;
65
+ source: LookupSource;
66
+ fetchedAt: string;
67
+ warnings?: string[];
68
+ }
69
+ interface LookupOptions {
70
+ timeoutMs?: number;
71
+ rdapOnly?: boolean;
72
+ whoisOnly?: boolean;
73
+ followWhoisReferral?: boolean;
74
+ customBootstrapUrl?: string;
75
+ whoisHints?: Record<string, string>;
76
+ includeRaw?: boolean;
77
+ signal?: AbortSignal;
78
+ }
79
+ interface LookupResult {
80
+ ok: boolean;
81
+ record?: DomainRecord;
82
+ error?: string;
83
+ }
84
+ type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
85
+ //#endregion
86
+ //#region src/index.d.ts
2
87
  /**
3
88
  * High-level lookup that prefers RDAP and falls back to WHOIS.
4
89
  * Ensures a standardized DomainRecord, independent of the source.
5
90
  */
6
- export declare function lookupDomain(domain: string, opts?: LookupOptions): Promise<LookupResult>;
91
+ declare function lookupDomain(domain: string, opts?: LookupOptions): Promise<LookupResult>;
7
92
  /** Determine if a domain appears available (not registered).
8
93
  * Performs a lookup and resolves to a boolean. Rejects on lookup error. */
9
- export declare function isAvailable(domain: string, opts?: LookupOptions): Promise<boolean>;
94
+ declare function isAvailable(domain: string, opts?: LookupOptions): Promise<boolean>;
10
95
  /** Determine if a domain appears registered.
11
96
  * Performs a lookup and resolves to a boolean. Rejects on lookup error. */
12
- export declare function isRegistered(domain: string, opts?: LookupOptions): Promise<boolean>;
13
- export type * from "./types.js";
97
+ declare function isRegistered(domain: string, opts?: LookupOptions): Promise<boolean>;
98
+ //#endregion
99
+ export { Contact, DomainRecord, FetchLike, LookupOptions, LookupResult, LookupSource, Nameserver, RegistrarInfo, StatusEvent, isAvailable, isRegistered, lookupDomain };