fix(core): update

This commit is contained in:
Philipp Kunz 2023-04-10 14:42:24 +02:00
parent d928a62b5e
commit ffbf56625e
2 changed files with 19 additions and 4 deletions

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartwhois', name: '@pushrocks/smartwhois',
version: '1.0.5', version: '1.0.6',
description: 'a package for dealing with whois requests' description: 'a package for dealing with whois requests'
} }

View File

@ -2,6 +2,22 @@ import * as plugins from './smartwhois.plugins.js';
export interface IWhoisInfo { export interface IWhoisInfo {
domain: string; domain: string;
isRegistered: boolean;
domainStatus: Array<
| 'clientTransferProhibited'
| 'clientUpdateProhibited'
| 'clientDeleteProhibited'
| 'clientHold'
| 'serverTransferProhibited'
| 'serverUpdateProhibited'
| 'serverDeleteProhibited'
| 'serverHold'
| 'inactive'
| 'pendingDelete'
| 'pendingRenew'
| 'pendingTransfer'
| 'pendingUpdate'
| 'ok'>;
domainWithoutSuffix: string; domainWithoutSuffix: string;
hostname: string; hostname: string;
isIcann: boolean; isIcann: boolean;
@ -9,7 +25,6 @@ export interface IWhoisInfo {
isPrivate: boolean; isPrivate: boolean;
publicSuffix: string; publicSuffix: string;
subdomain: string; subdomain: string;
isRegistered: boolean;
dnsSec: 'signedDelegation' | 'unsigned'; dnsSec: 'signedDelegation' | 'unsigned';
originalWhoisInfo: { originalWhoisInfo: {
[key: string]: any; [key: string]: any;
@ -22,9 +37,8 @@ export interface IWhoisInfo {
expiryDate: string; expiryDate: string;
} }
export class SmartWhois { export class SmartWhois {
public async getWhoisForDomain(domainArg: string) { public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> {
const whoisInfo = await plugins.whoiser.domain(domainArg); const whoisInfo = await plugins.whoiser.domain(domainArg);
const whoisServers = Object.keys(whoisInfo); const whoisServers = Object.keys(whoisInfo);
const selectedWhoisInfo: any = whoisInfo[whoisServers[0]]; const selectedWhoisInfo: any = whoisInfo[whoisServers[0]];
@ -39,6 +53,7 @@ export class SmartWhois {
return { return {
...tldtsData, ...tldtsData,
isRegistered: true, isRegistered: true,
domainStatus: selectedWhoisInfo['Domain Status'].map((statusArg: string) => statusArg.split(' ')[0]),
dnsSec: selectedWhoisInfo['DNSSEC'], dnsSec: selectedWhoisInfo['DNSSEC'],
originalWhoisInfo: whoisInfo, originalWhoisInfo: whoisInfo,
whoisServers, whoisServers,