@cleandns/whois-rdap 1.0.9 → 1.0.11

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
@@ -174,5 +174,5 @@ function findTimestamps(values) {
174
174
  return ts;
175
175
  }
176
176
  // await whois(process.argv[2]).then((r) =>
177
- // console.log(BSON.EJSON.stringify(r, undefined, 2))
177
+ // console.log(JSON.stringify(r, undefined, 2))
178
178
  // );
package/dist/port43.js CHANGED
@@ -8,19 +8,20 @@ export function determinePort43Domain(actor) {
8
8
  const parsed = parseDomain(actor);
9
9
  if (parsed.type === ParseResultType.Listed) {
10
10
  let tld = parsed.topLevelDomains.join(".");
11
- if (port43servers[tld]) {
11
+ if (port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]) {
12
12
  const domain = parsed.domain + "." + tld;
13
- return [domain, tld, port43servers[tld]];
13
+ return [domain, tld, port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]];
14
14
  }
15
15
  tld = parsed.icann.topLevelDomains.join(".");
16
- if (port43servers[tld]) {
16
+ if (port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]) {
17
17
  const domain = parsed.icann.domain + "." + tld;
18
- return [domain, tld, port43servers[tld]];
18
+ return [domain, tld, port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]];
19
19
  }
20
20
  }
21
21
  return [actor, "", null];
22
22
  }
23
23
  export async function port43(actor) {
24
+ var _a, _b, _c;
24
25
  const [domain, tld, whoisServer] = determinePort43Domain(actor);
25
26
  const opts = whoisServer;
26
27
  const server = (opts === null || opts === void 0 ? void 0 : opts.host) || opts || null;
@@ -62,8 +63,9 @@ export async function port43(actor) {
62
63
  return response;
63
64
  }
64
65
  let m;
65
- if (port43parsers[tld]) {
66
- port43parsers[tld](port43response, response);
66
+ const parser = port43parsers[tld] || ((_a = Object.entries(port43parsers).find(([t]) => tld.endsWith('.' + t))) === null || _a === void 0 ? void 0 : _a[1]);
67
+ if (parser) {
68
+ await parser(port43response, response);
67
69
  }
68
70
  !response.registrar.name &&
69
71
  (m = port43response.match(/^(?:Registrar(?: Name)?|registrar_name|registrar):[ \t]*(\S.+)/m)) &&
@@ -83,12 +85,12 @@ export async function port43(actor) {
83
85
  !response.ts.expires &&
84
86
  (m = port43response.match(/^(?:(?:Registry )?Expiry Date):[ \t]*(\S.+)/m)) &&
85
87
  (response.ts.expires = new Date(m[1]) || null);
86
- (m = port43response.match(/^(?:Status|Domain Status|status):.*/gm)) &&
88
+ !((_b = response.status) === null || _b === void 0 ? void 0 : _b.length) && (m = port43response.match(/^(?:Status|Domain Status|status):.*/gm)) &&
87
89
  m.forEach((s) => {
88
90
  let m;
89
91
  (m = s.match(/^(?:Status|Domain Status|status):[ \t]*(?:<a[^>]*>)?(\S+)/m)) && response.status.push(normalizeWhoisStatus(m[1]));
90
92
  });
91
- (m = port43response.match(/^(?:Name Server|ns_name_\d+|namserver|nserver):.*/gm)) &&
93
+ !((_c = response.nameservers) === null || _c === void 0 ? void 0 : _c.length) && (m = port43response.match(/^(?:Name Server|ns_name_\d+|namserver|nserver):.*/gm)) &&
92
94
  m.forEach((s) => {
93
95
  let m;
94
96
  (m = s.match(/^(?:Name Server|ns_name_\d+|namserver|nserver):[ \t]*(.*)/m)) && response.nameservers.push(m[1].toLowerCase());
@@ -101,7 +101,7 @@ export const port43parsers = {
101
101
  (m = response.matchAll(/^Nserver: (\S+)/gm)) &&
102
102
  (record.nameservers = [...m].map((t) => t[1]));
103
103
  // (m = response.match(/^Creation Date:\s*(\d\d\d\d-\d\d-\d\d)/m)) && (record.ts.created = new Date (m[1]));
104
- (m = response.match(/^Changed: (\d\d\d\d-\d\d-\d\d\S)/m)) &&
104
+ (m = response.match(/^Changed: (\d\d\d\d-\d\d-\d\d(?:T\d\d:\d\d:\d\d(?:[+-]\d\d:\d\d)?)?)/m)) &&
105
105
  (record.ts.updated = new Date(m[1]));
106
106
  // (m = response.match(/^Expiration Date:\s*(\d\d\d\d-\d\d-\d\d)/m)) && (record.ts.expires = new Date (m[1]));
107
107
  },
@@ -572,6 +572,7 @@ export const port43servers = {
572
572
  as: "whois.nic.as",
573
573
  "priv.at": "whois.nic.priv.at",
574
574
  at: "whois.nic.at",
575
+ "*.au": "whois.auda.org.au",
575
576
  au: "whois.auda.org.au",
576
577
  aw: "whois.nic.aw",
577
578
  ax: "whois.ax",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -242,5 +242,5 @@ function findTimestamps(values: any[]) {
242
242
  }
243
243
 
244
244
  // await whois(process.argv[2]).then((r) =>
245
- // console.log(BSON.EJSON.stringify(r, undefined, 2))
245
+ // console.log(JSON.stringify(r, undefined, 2))
246
246
  // );
package/src/port43.ts CHANGED
@@ -11,15 +11,15 @@ export function determinePort43Domain(actor: string) {
11
11
 
12
12
  if (parsed.type === ParseResultType.Listed) {
13
13
  let tld = parsed.topLevelDomains.join(".");
14
- if (port43servers[tld]) {
14
+ if (port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]) {
15
15
  const domain = parsed.domain + "." + tld;
16
- return [domain, tld, port43servers[tld]];
16
+ return [domain, tld, port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]];
17
17
  }
18
18
 
19
19
  tld = parsed.icann.topLevelDomains.join(".");
20
- if (port43servers[tld]) {
20
+ if (port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]) {
21
21
  const domain = parsed.icann.domain + "." + tld;
22
- return [domain, tld, port43servers[tld]];
22
+ return [domain, tld, port43servers[tld] || port43servers[tld.replace(/^[^.]+\./, "*.")]];
23
23
  }
24
24
  }
25
25
 
@@ -80,8 +80,10 @@ export async function port43(actor: string): Promise<WhoisResponse> {
80
80
 
81
81
  let m;
82
82
 
83
- if (port43parsers[tld]) {
84
- port43parsers[tld](port43response, response);
83
+ const parser = port43parsers[tld] || Object.entries(port43parsers).find(([t]) => tld.endsWith('.' + t))?.[1];
84
+
85
+ if (parser) {
86
+ await parser(port43response, response);
85
87
  }
86
88
 
87
89
  !response.registrar.name &&
@@ -112,14 +114,14 @@ export async function port43(actor: string): Promise<WhoisResponse> {
112
114
  /^(?:(?:Registry )?Expiry Date):[ \t]*(\S.+)/m
113
115
  )) &&
114
116
  (response.ts.expires = new Date(m[1]) || null);
115
- (m = port43response.match(/^(?:Status|Domain Status|status):.*/gm)) &&
117
+ !response.status?.length && (m = port43response.match(/^(?:Status|Domain Status|status):.*/gm)) &&
116
118
  m.forEach((s) => {
117
119
  let m;
118
120
  (m = s.match(
119
121
  /^(?:Status|Domain Status|status):[ \t]*(?:<a[^>]*>)?(\S+)/m
120
122
  )) && response.status.push(normalizeWhoisStatus(m[1]));
121
123
  });
122
- (m = port43response.match(
124
+ !response.nameservers?.length && (m = port43response.match(
123
125
  /^(?:Name Server|ns_name_\d+|namserver|nserver):.*/gm
124
126
  )) &&
125
127
  m.forEach((s) => {
@@ -135,7 +135,7 @@ export const port43parsers: Record<
135
135
  (m = response.matchAll(/^Nserver: (\S+)/gm)) &&
136
136
  (record.nameservers = [...m].map((t) => t[1]));
137
137
  // (m = response.match(/^Creation Date:\s*(\d\d\d\d-\d\d-\d\d)/m)) && (record.ts.created = new Date (m[1]));
138
- (m = response.match(/^Changed: (\d\d\d\d-\d\d-\d\d\S)/m)) &&
138
+ (m = response.match(/^Changed: (\d\d\d\d-\d\d-\d\d(?:T\d\d:\d\d:\d\d(?:[+-]\d\d:\d\d)?)?)/m)) &&
139
139
  (record.ts.updated = new Date(m[1]));
140
140
  // (m = response.match(/^Expiration Date:\s*(\d\d\d\d-\d\d-\d\d)/m)) && (record.ts.expires = new Date (m[1]));
141
141
  },
@@ -616,6 +616,7 @@ export const port43servers: Record<string, any> = {
616
616
  as: "whois.nic.as",
617
617
  "priv.at": "whois.nic.priv.at",
618
618
  at: "whois.nic.at",
619
+ "*.au": "whois.auda.org.au",
619
620
  au: "whois.auda.org.au",
620
621
  aw: "whois.nic.aw",
621
622
  ax: "whois.ax",