@cleandns/whois-rdap 1.0.55 → 1.0.60

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/dist/index.js CHANGED
@@ -93,9 +93,13 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
93
93
  thinResponse = fixArrays(thinResponse);
94
94
  }
95
95
  const selfRdap = (_b = thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.links) === null || _b === void 0 ? void 0 : _b.find((link) => link.rel === "self");
96
- const thickRdap = ((_d = (_c = thinResponse.links) === null || _c === void 0 ? void 0 : _c.find((link) => link.href !== (selfRdap === null || selfRdap === void 0 ? void 0 : selfRdap.href) &&
96
+ // Find the thick RDAP URL from the thin response's links
97
+ const thickRdapFromLinks = (_d = (_c = thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.links) === null || _c === void 0 ? void 0 : _c.find((link) => link.href !== (selfRdap === null || selfRdap === void 0 ? void 0 : selfRdap.href) &&
97
98
  link.rel === "related" &&
98
- link.type === "application/rdap+json")) === null || _d === void 0 ? void 0 : _d.href.replace("/domain/domain/", "/domain/")) || `${options.server}/domain/${domain}`;
99
+ link.type === "application/rdap+json")) === null || _d === void 0 ? void 0 : _d.href.replace("/domain/domain/", "/domain/");
100
+ // Only use options.server as fallback if it's actually defined
101
+ // This prevents constructing invalid URLs like "undefined/domain/example.com"
102
+ const thickRdap = thickRdapFromLinks || (options.server ? `${options.server}/domain/${domain}` : null);
99
103
  let thickResponse = null;
100
104
  if (!options.thinOnly && thickRdap) {
101
105
  debug("fetching thick RDAP: %s", thickRdap);
@@ -24,13 +24,22 @@ const tldCachePresets = [
24
24
  ["uy.com", "https://rdap.centralnic.com/uy.com"],
25
25
  ["web.com", "https://rdap.centralnic.com/web.com"],
26
26
  ["za.com", "https://rdap.centralnic.com/za.com"],
27
+ // 2026-06-16 click|country|hiv|property|sexy|trust|diy|food|living|lifestyle|vana -> https://rdap.registry.click/rdap
28
+ ["click", "https://rdap.registry.click/rdap"],
29
+ ["country", "https://rdap.registry.click/rdap"],
30
+ ["hiv", "https://rdap.registry.click/rdap"],
31
+ ["property", "https://rdap.registry.click/rdap"],
32
+ ["sexy", "https://rdap.registry.click/rdap"],
33
+ ["trust", "https://rdap.registry.click/rdap"],
34
+ ["diy", "https://rdap.registry.click/rdap"],
35
+ ["food", "https://rdap.registry.click/rdap"],
36
+ ["living", "https://rdap.registry.click/rdap"],
37
+ ["lifestyle", "https://rdap.registry.click/rdap"],
38
+ ["vana", "https://rdap.registry.click/rdap"],
27
39
  ];
28
40
  export async function tldToRdap(domain) {
29
41
  if (tldCache.size === 0) {
30
42
  const tmpCache = new Map([]);
31
- for (const [tld, url] of tldCachePresets) {
32
- tmpCache.set(tld, url);
33
- }
34
43
  // console.warn(`fetching tld-to-rdap`);
35
44
  const response = await fetch(`https://data.iana.org/rdap/dns.json`).then((r) => r.json());
36
45
  for (const [tlds, urls] of response.services) {
@@ -38,6 +47,9 @@ export async function tldToRdap(domain) {
38
47
  tmpCache.set(tld, urls[0].replace(/\/$/, ""));
39
48
  }
40
49
  }
50
+ for (const [tld, url] of tldCachePresets) {
51
+ tmpCache.set(tld, url);
52
+ }
41
53
  tldCache = tmpCache;
42
54
  }
43
55
  const parsed = parseDomain(domain);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
3
  "description": "",
4
- "version": "1.0.55",
4
+ "version": "1.0.60",
5
5
  "author": "",
6
6
  "bugs": {
7
7
  "url": "https://github.com/cleandns-inc/tool-whois/issues"
package/src/index.ts CHANGED
@@ -110,14 +110,19 @@ export async function whois(
110
110
 
111
111
  const selfRdap = thinResponse?.links?.find((link: any) => link.rel === "self");
112
112
 
113
- const thickRdap = thinResponse.links
113
+ // Find the thick RDAP URL from the thin response's links
114
+ const thickRdapFromLinks = thinResponse?.links
114
115
  ?.find(
115
116
  (link: any) =>
116
117
  link.href !== selfRdap?.href &&
117
118
  link.rel === "related" &&
118
119
  link.type === "application/rdap+json"
119
120
  )
120
- ?.href.replace("/domain/domain/", "/domain/") || `${options.server}/domain/${domain}`;
121
+ ?.href.replace("/domain/domain/", "/domain/");
122
+
123
+ // Only use options.server as fallback if it's actually defined
124
+ // This prevents constructing invalid URLs like "undefined/domain/example.com"
125
+ const thickRdap = thickRdapFromLinks || (options.server ? `${options.server}/domain/${domain}` : null);
121
126
 
122
127
  let thickResponse: any = null;
123
128
 
@@ -26,6 +26,19 @@ const tldCachePresets: [string, string | null][] = [
26
26
  ["uy.com", "https://rdap.centralnic.com/uy.com"],
27
27
  ["web.com", "https://rdap.centralnic.com/web.com"],
28
28
  ["za.com", "https://rdap.centralnic.com/za.com"],
29
+
30
+ // 2026-06-16 click|country|hiv|property|sexy|trust|diy|food|living|lifestyle|vana -> https://rdap.registry.click/rdap
31
+ ["click", "https://rdap.registry.click/rdap"],
32
+ ["country", "https://rdap.registry.click/rdap"],
33
+ ["hiv", "https://rdap.registry.click/rdap"],
34
+ ["property", "https://rdap.registry.click/rdap"],
35
+ ["sexy", "https://rdap.registry.click/rdap"],
36
+ ["trust", "https://rdap.registry.click/rdap"],
37
+ ["diy", "https://rdap.registry.click/rdap"],
38
+ ["food", "https://rdap.registry.click/rdap"],
39
+ ["living", "https://rdap.registry.click/rdap"],
40
+ ["lifestyle", "https://rdap.registry.click/rdap"],
41
+ ["vana", "https://rdap.registry.click/rdap"],
29
42
  ];
30
43
 
31
44
  export async function tldToRdap(
@@ -33,9 +46,6 @@ export async function tldToRdap(
33
46
  ): Promise<[string, string | null]> {
34
47
  if (tldCache.size === 0) {
35
48
  const tmpCache = new Map<string, string | null>([]);
36
- for (const [tld, url] of tldCachePresets) {
37
- tmpCache.set(tld, url);
38
- }
39
49
 
40
50
  // console.warn(`fetching tld-to-rdap`);
41
51
  const response: { services: TldToRdap[] } = await fetch(
@@ -47,6 +57,11 @@ export async function tldToRdap(
47
57
  tmpCache.set(tld, urls[0].replace(/\/$/, ""));
48
58
  }
49
59
  }
60
+
61
+ for (const [tld, url] of tldCachePresets) {
62
+ tmpCache.set(tld, url);
63
+ }
64
+
50
65
  tldCache = tmpCache;
51
66
  }
52
67