diff --git a/package.json b/package.json index 3686676..5b14108 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@types/node": "^18.15.11" }, "dependencies": { + "tldts": "^6.0.3", "whoiser": "^1.16.0" }, "browserslist": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5a364da..88357ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,6 +1,9 @@ lockfileVersion: '6.0' dependencies: + tldts: + specifier: ^6.0.3 + version: 6.0.3 whoiser: specifier: ^1.16.0 version: 1.16.0 @@ -4177,6 +4180,17 @@ packages: esm: 3.2.25 dev: true + /tldts-core@6.0.3: + resolution: {integrity: sha512-PLiEM2aCkfGifyr8npbd93eWIW4isFRB44vTiup5DRie6e2Qy3+9quwHb252v12JyoM+RmF1cxtDgwD2PVBOjA==} + dev: false + + /tldts@6.0.3: + resolution: {integrity: sha512-rcdUIwrcGuMWe5+fg5FFBrmWTYdbfpHwkk1AjBKoSDbpsdAsYqJYKoZOVOHn8MQCYatADKGAx/SU+jpSKxSYNw==} + hasBin: true + dependencies: + tldts-core: 6.0.3 + dev: false + /to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 93a82fb..dcf2e51 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.4', + version: '1.0.5', description: 'a package for dealing with whois requests' } diff --git a/ts/index.ts b/ts/index.ts index 90e0989..a6d30e6 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,5 +1,28 @@ import * as plugins from './smartwhois.plugins.js'; +export interface IWhoisInfo { + domain: string; + domainWithoutSuffix: string; + hostname: string; + isIcann: boolean; + isIp: boolean; + isPrivate: boolean; + publicSuffix: string; + subdomain: string; + isRegistered: boolean; + dnsSec: 'signedDelegation' | 'unsigned'; + originalWhoisInfo: { + [key: string]: any; + }; + whoisServers: string[]; + registrar: string; + registrarUrl: string; + createdDate: string; + updatedDate: string; + expiryDate: string; +} + + export class SmartWhois { public async getWhoisForDomain(domainArg: string) { const whoisInfo = await plugins.whoiser.domain(domainArg); @@ -10,7 +33,13 @@ export class SmartWhois { const createdDate = selectedWhoisInfo['Created Date']; const updatedDate = selectedWhoisInfo['Updated Date']; const expiryDate = selectedWhoisInfo['Expiry Date']; + + const tldtsData = plugins.tldts.parse(domainArg); + return { + ...tldtsData, + isRegistered: true, + dnsSec: selectedWhoisInfo['DNSSEC'], originalWhoisInfo: whoisInfo, whoisServers, registrar, diff --git a/ts/smartwhois.plugins.ts b/ts/smartwhois.plugins.ts index ea83077..778936b 100644 --- a/ts/smartwhois.plugins.ts +++ b/ts/smartwhois.plugins.ts @@ -1,6 +1,8 @@ // third party import * as whoiser from 'whoiser'; +import tldts from 'tldts'; export { - whoiser + whoiser, + tldts, }