@cleandns/whois-rdap 1.0.19 → 1.0.21
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 +15 -4
- package/dist/whoisStatus.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +16 -7
- package/src/whoisStatus.ts +1 -1
- package/whois.d.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const eventMap = new Map([
|
|
|
12
12
|
]);
|
|
13
13
|
export async function whois(origDomain, options = { fetch: fetch, thinOnly: false }) {
|
|
14
14
|
var _a, _b, _c, _d, _e, _f;
|
|
15
|
-
const
|
|
15
|
+
const _fetch = options.fetch || fetch;
|
|
16
16
|
let domain = origDomain;
|
|
17
17
|
let url = null;
|
|
18
18
|
[domain, url] = await tldToRdap(origDomain);
|
|
@@ -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
|
};
|
|
@@ -32,7 +33,7 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
|
|
|
32
33
|
}
|
|
33
34
|
const thinRdap = `${url}/domain/${domain}`;
|
|
34
35
|
// console.log(`fetching thin RDAP: ${thinRdap}`);
|
|
35
|
-
let thinResponse = await
|
|
36
|
+
let thinResponse = await _fetch(thinRdap)
|
|
36
37
|
.then((r) => r.json())
|
|
37
38
|
.catch(() => null);
|
|
38
39
|
if (thinResponse && !thinResponse.errorCode) {
|
|
@@ -50,7 +51,7 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
|
|
|
50
51
|
let thickResponse = null;
|
|
51
52
|
if (!options.thinOnly && thickRdap) {
|
|
52
53
|
// console.log(`fetching thick RDAP: ${thickRdap}`);
|
|
53
|
-
thickResponse = await
|
|
54
|
+
thickResponse = await _fetch(thickRdap)
|
|
54
55
|
.then((r) => r.json())
|
|
55
56
|
.catch(() => null);
|
|
56
57
|
if (thickResponse && !thickResponse.errorCode && !thickResponse.error) {
|
|
@@ -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
|
-
|
|
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
|
package/dist/whoisStatus.js
CHANGED
|
@@ -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
|
-
'
|
|
31
|
+
'updateprohibited': 'client update prohibited',
|
|
32
32
|
};
|
|
33
33
|
export function normalizeWhoisStatus(status) {
|
|
34
34
|
status = (status || "").toLocaleLowerCase();
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ export async function whois(
|
|
|
17
17
|
origDomain: string,
|
|
18
18
|
options: WhoisOptions = { fetch: fetch, thinOnly: false }
|
|
19
19
|
): Promise<WhoisResponse> {
|
|
20
|
-
const
|
|
20
|
+
const _fetch = options.fetch || fetch;
|
|
21
21
|
|
|
22
22
|
let domain = origDomain;
|
|
23
23
|
let url: string | null = null;
|
|
@@ -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
|
};
|
|
@@ -43,7 +44,7 @@ export async function whois(
|
|
|
43
44
|
const thinRdap = `${url}/domain/${domain}`;
|
|
44
45
|
// console.log(`fetching thin RDAP: ${thinRdap}`);
|
|
45
46
|
|
|
46
|
-
let thinResponse = await
|
|
47
|
+
let thinResponse = await _fetch(thinRdap)
|
|
47
48
|
.then((r) => r.json() as any)
|
|
48
49
|
.catch(() => null);
|
|
49
50
|
if (thinResponse && !thinResponse.errorCode) {
|
|
@@ -69,7 +70,7 @@ export async function whois(
|
|
|
69
70
|
|
|
70
71
|
if (!options.thinOnly && thickRdap) {
|
|
71
72
|
// console.log(`fetching thick RDAP: ${thickRdap}`);
|
|
72
|
-
thickResponse = await
|
|
73
|
+
thickResponse = await _fetch(thickRdap)
|
|
73
74
|
.then((r) => r.json() as any)
|
|
74
75
|
.catch(() => null);
|
|
75
76
|
if (thickResponse && !thickResponse.errorCode && !thickResponse.error) {
|
|
@@ -229,10 +230,18 @@ export async function whois(
|
|
|
229
230
|
response.reseller = reseller;
|
|
230
231
|
|
|
231
232
|
// status
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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(
|
package/src/whoisStatus.ts
CHANGED
|
@@ -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
|
-
'
|
|
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
|
};
|