@cleandns/whois-rdap 1.0.20 → 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 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
@@ -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.21",
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(
@@ -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
  };