mirror of
https://github.com/jakejarvis/rdapper.git
synced 2026-09-23 01:25:31 -04:00
Add includeRaw option to CLI and API: enable inclusion of raw RDAP/WHOIS data in results
This commit is contained in:
@@ -43,6 +43,7 @@ export async function lookupDomain(
|
||||
json,
|
||||
tried,
|
||||
now,
|
||||
!!opts?.includeRaw,
|
||||
);
|
||||
return { ok: true, record };
|
||||
} catch {
|
||||
@@ -105,6 +106,7 @@ export async function lookupDomain(
|
||||
res.text,
|
||||
res.serverQueried,
|
||||
now,
|
||||
!!opts?.includeRaw,
|
||||
);
|
||||
return { ok: true, record };
|
||||
} catch (err: unknown) {
|
||||
|
||||
@@ -19,6 +19,7 @@ export function normalizeRdap(
|
||||
rdap: unknown,
|
||||
rdapServersTried: string[],
|
||||
fetchedAtISO: string,
|
||||
includeRaw = false,
|
||||
): DomainRecord {
|
||||
const doc = (rdap ?? {}) as RdapDoc;
|
||||
// Safe helpers for optional fields
|
||||
@@ -146,7 +147,7 @@ export function normalizeRdap(
|
||||
contacts,
|
||||
whoisServer,
|
||||
rdapServers: rdapServersTried,
|
||||
rawRdap: rdap,
|
||||
rawRdap: includeRaw ? rdap : undefined,
|
||||
rawWhois: undefined,
|
||||
source: "rdap",
|
||||
fetchedAt: fetchedAtISO,
|
||||
|
||||
@@ -87,6 +87,7 @@ export interface LookupOptions {
|
||||
customBootstrapUrl?: string; // override IANA bootstrap
|
||||
// WHOIS discovery and query tuning
|
||||
whoisHints?: Record<string, string>; // override/add authoritative WHOIS per TLD
|
||||
includeRaw?: boolean; // include rawRdap/rawWhois in results (default false)
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ export function normalizeWhois(
|
||||
whoisText: string,
|
||||
whoisServer: string | undefined,
|
||||
fetchedAtISO: string,
|
||||
includeRaw = false,
|
||||
): DomainRecord {
|
||||
const map = parseKeyValueLines(whoisText);
|
||||
|
||||
@@ -151,7 +152,7 @@ export function normalizeWhois(
|
||||
whoisServer,
|
||||
rdapServers: undefined,
|
||||
rawRdap: undefined,
|
||||
rawWhois: whoisText,
|
||||
rawWhois: includeRaw ? whoisText : undefined,
|
||||
source: "whois",
|
||||
fetchedAt: fetchedAtISO,
|
||||
warnings: undefined,
|
||||
|
||||
Reference in New Issue
Block a user