@cleandns/whois-rdap 1.0.8 → 1.0.10

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
@@ -8,6 +8,7 @@ const eventMap = new Map([
8
8
  ["registration", "created"],
9
9
  ["last changed", "updated"],
10
10
  ["expiration", "expires"],
11
+ ["expiration date", "expires"],
11
12
  ]);
12
13
  export async function whois(domain, options = { fetch: fetch }) {
13
14
  var _a, _b, _c, _d, _e, _f;
@@ -125,7 +126,7 @@ export async function whois(domain, options = { fetch: fetch }) {
125
126
  // nameservers
126
127
  response.nameservers = findNameservers((thickResponse === null || thickResponse === void 0 ? void 0 : thickResponse.nameservers) || (thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.nameservers) || []);
127
128
  // ts
128
- response.ts = findTimestamps((thickResponse === null || thickResponse === void 0 ? void 0 : thickResponse.events) || (thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.events) || []);
129
+ response.ts = findTimestamps([...((thickResponse === null || thickResponse === void 0 ? void 0 : thickResponse.events) || []), ...((thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.events) || [])]);
129
130
  return response;
130
131
  }
131
132
  function findStatus(statuses, domain) {
@@ -165,7 +166,7 @@ function findTimestamps(values) {
165
166
  events = Object.values(values);
166
167
  }
167
168
  for (const [event, field] of eventMap) {
168
- const date = events.find((ev) => ev.eventAction === event);
169
+ const date = events.find((ev) => ev.eventAction.toLocaleLowerCase() === event);
169
170
  if (date === null || date === void 0 ? void 0 : date.eventDate) {
170
171
  ts[field] = new Date(date.eventDate.toString().replace(/\+0000Z$/, 'Z'));
171
172
  }
@@ -173,5 +174,5 @@ function findTimestamps(values) {
173
174
  return ts;
174
175
  }
175
176
  // await whois(process.argv[2]).then((r) =>
176
- // console.log(JSON.stringify(r, null, 2))
177
+ // console.log(JSON.stringify(r, undefined, 2))
177
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;
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)) &&
@@ -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,12 +1,12 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
- "publish": "npm run build && npm version patch && npm publish"
9
+ "upload": "npm run build && npm version patch && npm publish"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ const eventMap = new Map<string, WhoisTimestampFields>([
10
10
  ["registration", "created"],
11
11
  ["last changed", "updated"],
12
12
  ["expiration", "expires"],
13
+ ["expiration date", "expires"],
13
14
  ]);
14
15
 
15
16
  export async function whois(domain: string, options: WhoisOptions = { fetch: fetch }): Promise<WhoisResponse> {
@@ -182,7 +183,7 @@ export async function whois(domain: string, options: WhoisOptions = { fetch: fet
182
183
 
183
184
  // ts
184
185
  response.ts = findTimestamps(
185
- thickResponse?.events || thinResponse?.events || []
186
+ [ ...(thickResponse?.events || []), ...(thinResponse?.events || []) ]
186
187
  );
187
188
 
188
189
  return response;
@@ -231,7 +232,7 @@ function findTimestamps(values: any[]) {
231
232
  }
232
233
 
233
234
  for (const [event, field] of eventMap) {
234
- const date = events.find((ev: any) => ev.eventAction === event);
235
+ const date = events.find((ev: any) => ev.eventAction.toLocaleLowerCase() === event);
235
236
  if (date?.eventDate) {
236
237
  ts[field] = new Date(date.eventDate.toString().replace(/\+0000Z$/, 'Z'));
237
238
  }
@@ -241,5 +242,5 @@ function findTimestamps(values: any[]) {
241
242
  }
242
243
 
243
244
  // await whois(process.argv[2]).then((r) =>
244
- // console.log(JSON.stringify(r, null, 2))
245
+ // console.log(JSON.stringify(r, undefined, 2))
245
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 &&
@@ -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",