diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index dcf2e51..c85724e 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartwhois', - version: '1.0.5', + version: '1.0.6', description: 'a package for dealing with whois requests' } diff --git a/ts/index.ts b/ts/index.ts index a6d30e6..8473c41 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -2,6 +2,22 @@ import * as plugins from './smartwhois.plugins.js'; export interface IWhoisInfo { domain: string; + isRegistered: boolean; + domainStatus: Array< + | 'clientTransferProhibited' + | 'clientUpdateProhibited' + | 'clientDeleteProhibited' + | 'clientHold' + | 'serverTransferProhibited' + | 'serverUpdateProhibited' + | 'serverDeleteProhibited' + | 'serverHold' + | 'inactive' + | 'pendingDelete' + | 'pendingRenew' + | 'pendingTransfer' + | 'pendingUpdate' + | 'ok'>; domainWithoutSuffix: string; hostname: string; isIcann: boolean; @@ -9,7 +25,6 @@ export interface IWhoisInfo { isPrivate: boolean; publicSuffix: string; subdomain: string; - isRegistered: boolean; dnsSec: 'signedDelegation' | 'unsigned'; originalWhoisInfo: { [key: string]: any; @@ -22,9 +37,8 @@ export interface IWhoisInfo { expiryDate: string; } - export class SmartWhois { - public async getWhoisForDomain(domainArg: string) { + public async getWhoisForDomain(domainArg: string): Promise { const whoisInfo = await plugins.whoiser.domain(domainArg); const whoisServers = Object.keys(whoisInfo); const selectedWhoisInfo: any = whoisInfo[whoisServers[0]]; @@ -39,6 +53,7 @@ export class SmartWhois { return { ...tldtsData, isRegistered: true, + domainStatus: selectedWhoisInfo['Domain Status'].map((statusArg: string) => statusArg.split(' ')[0]), dnsSec: selectedWhoisInfo['DNSSEC'], originalWhoisInfo: whoisInfo, whoisServers,