diff --git a/package.json b/package.json index 58085df..df10c7b 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "dependencies": { "@pushrocks/smartrequest": "^2.0.15", "@pushrocks/smarturl": "^3.0.6", + "@tsclass/tsclass": "^4.0.38", "tldts": "^6.0.3", "whoiser": "^1.16.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4819b8d..b3b6a50 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,9 @@ dependencies: '@pushrocks/smarturl': specifier: ^3.0.6 version: 3.0.6 + '@tsclass/tsclass': + specifier: ^4.0.38 + version: 4.0.38 tldts: specifier: ^6.0.3 version: 6.0.3 @@ -482,7 +485,7 @@ packages: '@pushrocks/smartrequest': 2.0.15 '@pushrocks/smartsitemap': 2.0.1 '@pushrocks/smarttime': 4.0.1 - '@tsclass/tsclass': 4.0.34 + '@tsclass/tsclass': 4.0.38 '@types/compression': 1.7.2 '@types/cors': 2.8.13 '@types/express': 4.17.17 @@ -656,7 +659,7 @@ packages: '@pushrocks/smartpromise': 3.1.7 '@pushrocks/smartpuppeteer': 2.0.2 '@pushrocks/smartunique': 3.0.3 - '@tsclass/tsclass': 4.0.34 + '@tsclass/tsclass': 4.0.38 '@types/express': 4.17.17 express: 4.18.2 pdf-merger-js: 3.4.0 @@ -934,11 +937,10 @@ packages: type-fest: 2.19.0 dev: true - /@tsclass/tsclass@4.0.34: - resolution: {integrity: sha512-Fk4y/cKfzAjq+9HcsR/CRvWDn7ERrKxd75oPVASrfjECyA/Mf7zDKbPfLwZyAq4zk4abkg1RydfNjQWRLXHdTA==} + /@tsclass/tsclass@4.0.38: + resolution: {integrity: sha512-dwxW8MkmAAi8BYO//yYLb0x01BqtUh3kN6t5pq163GEMBYZ9pNSLs/7cafQFPX1/Ia9gknlOphYH0uYZwJET/g==} dependencies: - type-fest: 3.7.2 - dev: true + type-fest: 3.8.0 /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} @@ -4269,10 +4271,9 @@ packages: engines: {node: '>=12.20'} dev: true - /type-fest@3.7.2: - resolution: {integrity: sha512-f9BHrLjRJ4MYkfOsnC/53PNDzZJcVo14MqLp2+hXE39p5bgwqohxR5hDZztwxlbxmIVuvC2EFAKrAkokq23PLA==} + /type-fest@3.8.0: + resolution: {integrity: sha512-FVNSzGQz9Th+/9R6Lvv7WIAkstylfHN2/JYxkyhhmKFYh9At2DST8t6L6Lref9eYO8PXFTfG9Sg1Agg0K3vq3Q==} engines: {node: '>=14.16'} - dev: true /type-is@1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} diff --git a/test/test.ts b/test/test.ts index 8478286..0f4ea38 100644 --- a/test/test.ts +++ b/test/test.ts @@ -9,9 +9,9 @@ tap.test('should create a valid instance of SmartWhois', async () => { }); tap.test('should get a parsed url result for whois', async () => { - const parsedUrlResult = await testSmartWhois.getParsedUrlResultForWhois('https://coffee.link/understanding-gen-z/'); + const parsedUrlResult = await testSmartWhois.getDomainDelegation('https://coffee.link/understanding-gen-z/'); console.log(parsedUrlResult); - const parsedUrlResult2 = await testSmartWhois.getParsedUrlResultForWhois('task.vc'); + const parsedUrlResult2 = await testSmartWhois.getDomainDelegation('task.vc'); console.log(parsedUrlResult2); }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 29318ef..453f541 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.12', + version: '1.0.13', description: 'a package for dealing with whois requests' } diff --git a/ts/index.ts b/ts/index.ts index 6fef100..60c64ab 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -41,7 +41,7 @@ export class SmartWhois { /** * can be used to prepare an input for the whois command */ - public async getParsedUrlResultForWhois(urlArg: string) { + public async getDomainDelegation(urlArg: string): Promise { if (!urlArg.includes('//')) { urlArg = `https://${urlArg}`; } @@ -53,12 +53,13 @@ export class SmartWhois { domain: tldtsData.domain, publicSuffix: tldtsData.publicSuffix, subdomain: tldtsData.subdomain, + domainWithoutSuffix: tldtsData.domainWithoutSuffix, } } public async getAdditionalWhoisDataForDomain(domainArg: string) { if (domainArg.includes('//')) { - const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg); + const parsedUrlResult = await this.getDomainDelegation(domainArg); domainArg = parsedUrlResult.fullDomain; } @@ -80,7 +81,7 @@ export class SmartWhois { public async getWhoisForDomain(domainArg: string): Promise { if (domainArg.includes('//')) { - const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg); + const parsedUrlResult = await this.getDomainDelegation(domainArg); domainArg = parsedUrlResult.fullDomain; } const whoisInfo = await plugins.whoiser.domain(domainArg); diff --git a/ts/smartwhois.plugins.ts b/ts/smartwhois.plugins.ts index a020108..fa74412 100644 --- a/ts/smartwhois.plugins.ts +++ b/ts/smartwhois.plugins.ts @@ -1,3 +1,10 @@ +// @tsclass scope +import * as tsclass from '@tsclass/tsclass'; + +export { + tsclass, +} + // pushrocks scope import * as smarturl from '@pushrocks/smarturl'; import * as smartrequest from '@pushrocks/smartrequest';