@cleandns/whois-rdap 1.0.7 → 1.0.9

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(BSON.EJSON.stringify(r, undefined, 2))
177
178
  // );
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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(BSON.EJSON.stringify(r, undefined, 2))
245
246
  // );