@cleandns/whois-rdap 1.0.20 → 1.0.23

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
@@ -21,6 +21,7 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
21
21
  registrar: { id: 0, name: null },
22
22
  reseller: null,
23
23
  status: [],
24
+ statusDelta: [],
24
25
  nameservers: [],
25
26
  ts: { created: null, updated: null, expires: null },
26
27
  };
@@ -145,7 +146,17 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
145
146
  const reseller = ((_f = resellers[0]) === null || _f === void 0 ? void 0 : _f.name) || "";
146
147
  response.reseller = reseller;
147
148
  // status
148
- response.status = findStatus((thickResponse === null || thickResponse === void 0 ? void 0 : thickResponse.status) || (thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.status) || [], domain);
149
+ const statusThin = findStatus((thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.status) || [], domain);
150
+ const statusThick = findStatus((thickResponse === null || thickResponse === void 0 ? void 0 : thickResponse.status) || [], domain);
151
+ response.status = [...new Set([...statusThin, ...statusThick])];
152
+ response.statusDelta = [];
153
+ for (const status of response.status) {
154
+ const thin = statusThin.includes(status) || statusThin.includes(status.replace(/^client/, "server")) || statusThin.includes(status.replace(/^server/, "client"));
155
+ const thick = statusThick.includes(status) || statusThick.includes(status.replace(/^client/, "server")) || statusThick.includes(status.replace(/^server/, "client"));
156
+ if (thin !== thick) {
157
+ response.statusDelta.push({ status, thin, thick });
158
+ }
159
+ }
149
160
  // nameservers
150
161
  response.nameservers = findNameservers((thickResponse === null || thickResponse === void 0 ? void 0 : thickResponse.nameservers) || (thinResponse === null || thinResponse === void 0 ? void 0 : thinResponse.nameservers) || []);
151
162
  // ts
@@ -199,6 +210,3 @@ function findTimestamps(values) {
199
210
  }
200
211
  return ts;
201
212
  }
202
- // await whois(process.argv[2]).then((r) =>
203
- // console.log(JSON.stringify(r, undefined, 2))
204
- // );
package/dist/port43.js CHANGED
@@ -66,7 +66,7 @@ export async function port43(actor) {
66
66
  if (!response.found) {
67
67
  return response;
68
68
  }
69
- if (port43response.match(/^%*\s+(NOT FOUND|No match|NO OBJECT FOUND|No entries found|No Data Found|No information available|Status: free)\b/im)) {
69
+ if (port43response.match(/^%*\s+(NOT FOUND|No match|NO OBJECT FOUND|No entries found|No Data Found|Domain is available for registration|No information available|Status: free)\b/im)) {
70
70
  response.found = false;
71
71
  return response;
72
72
  }
@@ -53,6 +53,23 @@ export const port43parsers = {
53
53
  (m = response.match(/^Expiration Date\s*: (\d\d\d\d). (\d\d). (\d\d)/m)) &&
54
54
  (record.ts.expires = new Date(`${m[1]}-${m[2]}-${m[3]}`));
55
55
  },
56
+ lk(response, record) {
57
+ var _a;
58
+ const json = JSON.parse(response);
59
+ let m;
60
+ // const response = {
61
+ // "ExpireDate" : "Expiration Date - Saturday, 30th November, 2024",
62
+ // "Message" : "Domain is REGISTERED for - Global Business Process Outsourcing (Pvt) Ltd - Category - Budget ",
63
+ // "Required" : {
64
+ // "Available" : 0,
65
+ // "DomainName" : "globalbpo",
66
+ // "DomainTypeName" : "com.lk",
67
+ // }
68
+ // }
69
+ (m = json.ExpireDate.match(/, (\d+)(?:st|nd|rd|th) (\w+), (\d+)/)) &&
70
+ (record.ts.expires = new Date(`${m[2]} ${m[1]}, ${m[3]}`));
71
+ (record.found = !((_a = json.Required) === null || _a === void 0 ? void 0 : _a.Available));
72
+ },
56
73
  tr(response, record) {
57
74
  let m;
58
75
  (m = response.match(/^Organization Name\s*: (.+)/m)) &&
@@ -147,6 +164,12 @@ export const port43servers = {
147
164
  "uy.com": "whois.centralnic.net",
148
165
  "web.com": "whois.centralnic.net",
149
166
  "za.com": "whois.centralnic.net",
167
+ lk: {
168
+ url: `https://www.domains.lk/wp-content/themes/bridge-child/getDomainData.php?domainname=%%domain%%`,
169
+ },
170
+ "*.lk": {
171
+ url: `https://www.domains.lk/wp-content/themes/bridge-child/getDomainData.php?domainname=%%domain%%`,
172
+ },
150
173
  "it.com": {
151
174
  url: `https://engine.itcomdomains.com/api/v1/domain/%%domain%%/whois_info`,
152
175
  },
@@ -718,7 +741,6 @@ export const port43servers = {
718
741
  lb: null,
719
742
  lc: "whois.afilias-grs.info",
720
743
  li: "whois.nic.li",
721
- lk: "whois.nic.lk",
722
744
  lr: null,
723
745
  ls: "whois.nic.ls",
724
746
  lt: "whois.domreg.lt",
package/dist/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/test.js ADDED
@@ -0,0 +1,2 @@
1
+ import { whois } from "./index.js";
2
+ whois(process.argv[2]).then((r) => console.log(JSON.stringify(r, undefined, 2)));
@@ -28,7 +28,7 @@ const statusMap = {
28
28
  'deleteprohibited': 'client delete prohibited',
29
29
  'renewprohibited': 'client renew prohibited',
30
30
  'transferprohibited': 'client transfer prohibited',
31
- 'updatedprohibited': 'client update prohibited',
31
+ 'updateprohibited': 'client update prohibited',
32
32
  };
33
33
  export function normalizeWhoisStatus(status) {
34
34
  status = (status || "").toLocaleLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
- "version": "1.0.20",
3
+ "version": "1.0.23",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -29,6 +29,7 @@ export async function whois(
29
29
  registrar: { id: 0, name: null },
30
30
  reseller: null,
31
31
  status: [],
32
+ statusDelta: [],
32
33
  nameservers: [],
33
34
  ts: { created: null, updated: null, expires: null },
34
35
  };
@@ -229,10 +230,18 @@ export async function whois(
229
230
  response.reseller = reseller;
230
231
 
231
232
  // status
232
- response.status = findStatus(
233
- thickResponse?.status || thinResponse?.status || [],
234
- domain
235
- );
233
+ const statusThin = findStatus(thinResponse?.status || [], domain);
234
+ const statusThick = findStatus(thickResponse?.status || [], domain);
235
+ response.status = [...new Set ([...statusThin, ...statusThick])];
236
+
237
+ response.statusDelta = [];
238
+ for (const status of response.status) {
239
+ const thin = statusThin.includes(status) || statusThin.includes(status.replace(/^client/, "server")) || statusThin.includes(status.replace(/^server/, "client"));
240
+ const thick = statusThick.includes(status) || statusThick.includes(status.replace(/^client/, "server")) || statusThick.includes(status.replace(/^server/, "client"));
241
+ if (thin !== thick) {
242
+ response.statusDelta.push({ status, thin, thick });
243
+ }
244
+ }
236
245
 
237
246
  // nameservers
238
247
  response.nameservers = findNameservers(
@@ -301,7 +310,3 @@ function findTimestamps(values: any[]) {
301
310
 
302
311
  return ts;
303
312
  }
304
-
305
- // await whois(process.argv[2]).then((r) =>
306
- // console.log(JSON.stringify(r, undefined, 2))
307
- // );
package/src/port43.ts CHANGED
@@ -79,7 +79,7 @@ export async function port43(actor: string): Promise<WhoisResponse> {
79
79
 
80
80
  if (
81
81
  port43response.match(
82
- /^%*\s+(NOT FOUND|No match|NO OBJECT FOUND|No entries found|No Data Found|No information available|Status: free)\b/im
82
+ /^%*\s+(NOT FOUND|No match|NO OBJECT FOUND|No entries found|No Data Found|Domain is available for registration|No information available|Status: free)\b/im
83
83
  )
84
84
  ) {
85
85
  response.found = false;
@@ -78,6 +78,23 @@ export const port43parsers: Record<
78
78
  (record.ts.expires = new Date(`${m[1]}-${m[2]}-${m[3]}`));
79
79
  },
80
80
 
81
+ lk(response, record) {
82
+ const json = JSON.parse(response);
83
+ let m;
84
+ // const response = {
85
+ // "ExpireDate" : "Expiration Date - Saturday, 30th November, 2024",
86
+ // "Message" : "Domain is REGISTERED for - Global Business Process Outsourcing (Pvt) Ltd - Category - Budget ",
87
+ // "Required" : {
88
+ // "Available" : 0,
89
+ // "DomainName" : "globalbpo",
90
+ // "DomainTypeName" : "com.lk",
91
+ // }
92
+ // }
93
+ (m = json.ExpireDate.match(/, (\d+)(?:st|nd|rd|th) (\w+), (\d+)/)) &&
94
+ (record.ts.expires = new Date(`${m[2]} ${m[1]}, ${m[3]}`));
95
+ (record.found = !json.Required?.Available);
96
+ },
97
+
81
98
  tr(response, record) {
82
99
  let m;
83
100
 
@@ -155,11 +172,11 @@ export const port43parsers: Record<
155
172
  let m;
156
173
 
157
174
  (m = response.match(/^registered:\s+(\d\d)\.(\d\d)\.(\d\d\d\d) (\d\d:\d\d:\d\d)/m)) &&
158
- (record.ts.created = new Date (`${m[3]}-${m[2]}-${m[1]}T${m[4]}Z`));
175
+ (record.ts.created = new Date(`${m[3]}-${m[2]}-${m[1]}T${m[4]}Z`));
159
176
  (m = response.match(/^changed:\s+(\d\d)\.(\d\d)\.(\d\d\d\d) (\d\d:\d\d:\d\d)/m)) &&
160
- (record.ts.updated = new Date (`${m[3]}-${m[2]}-${m[1]}T${m[4]}Z`));
177
+ (record.ts.updated = new Date(`${m[3]}-${m[2]}-${m[1]}T${m[4]}Z`));
161
178
  (m = response.match(/^expire:\s+(\d\d)\.(\d\d)\.(\d\d\d\d)(?: (\d\d:\d\d:\d\d))?/m)) &&
162
- (record.ts.expires = new Date (`${m[3]}-${m[2]}-${m[1]}T${m[4] || '00:00:00'}Z`));
179
+ (record.ts.expires = new Date(`${m[3]}-${m[2]}-${m[1]}T${m[4] || '00:00:00'}Z`));
163
180
  }
164
181
 
165
182
  };
@@ -188,9 +205,17 @@ export const port43servers: Record<string, any> = {
188
205
  "web.com": "whois.centralnic.net",
189
206
  "za.com": "whois.centralnic.net",
190
207
 
208
+ lk: {
209
+ url: `https://www.domains.lk/wp-content/themes/bridge-child/getDomainData.php?domainname=%%domain%%`,
210
+ },
211
+
212
+ "*.lk": {
213
+ url: `https://www.domains.lk/wp-content/themes/bridge-child/getDomainData.php?domainname=%%domain%%`,
214
+ },
215
+
191
216
  "it.com": {
192
217
  url: `https://engine.itcomdomains.com/api/v1/domain/%%domain%%/whois_info`,
193
- },
218
+ },
194
219
 
195
220
  com: {
196
221
  host: "whois.verisign-grs.com",
@@ -767,7 +792,6 @@ export const port43servers: Record<string, any> = {
767
792
  lb: null,
768
793
  lc: "whois.afilias-grs.info",
769
794
  li: "whois.nic.li",
770
- lk: "whois.nic.lk",
771
795
  lr: null,
772
796
  ls: "whois.nic.ls",
773
797
  lt: "whois.domreg.lt",
package/src/test.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { whois } from "./index.js";
2
+
3
+ whois(process.argv[2]).then((r) =>
4
+ console.log(JSON.stringify(r, undefined, 2))
5
+ );
@@ -34,7 +34,7 @@ const statusMap: Record<string,string> = {
34
34
  'deleteprohibited': 'client delete prohibited',
35
35
  'renewprohibited': 'client renew prohibited',
36
36
  'transferprohibited': 'client transfer prohibited',
37
- 'updatedprohibited': 'client update prohibited',
37
+ 'updateprohibited': 'client update prohibited',
38
38
  };
39
39
 
40
40
  export function normalizeWhoisStatus(status: string) {
package/whois.d.ts CHANGED
@@ -14,10 +14,11 @@ export type WhoisResponse = {
14
14
  };
15
15
  reseller: string | null;
16
16
  status: string[];
17
+ statusDelta?: { status: string; thin: boolean; thick: boolean }[];
17
18
  nameservers: string[];
18
19
  ts: {
19
20
  created: Date | null;
20
21
  updated: Date | null;
21
22
  expires: Date | null;
22
- }
23
+ };
23
24
  };