fix(core): update

This commit is contained in:
Philipp Kunz 2023-04-18 20:40:39 +02:00
parent deba684093
commit bec73de6d5
6 changed files with 51 additions and 21 deletions

View File

@ -23,6 +23,8 @@
"@types/node": "^18.15.11" "@types/node": "^18.15.11"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartrequest": "^2.0.11",
"@pushrocks/smarturl": "^3.0.6",
"tldts": "^6.0.3", "tldts": "^6.0.3",
"whoiser": "^1.16.0" "whoiser": "^1.16.0"
}, },

29
pnpm-lock.yaml generated
View File

@ -1,6 +1,12 @@
lockfileVersion: '6.0' lockfileVersion: '6.0'
dependencies: dependencies:
'@pushrocks/smartrequest':
specifier: ^2.0.11
version: 2.0.11
'@pushrocks/smarturl':
specifier: ^3.0.6
version: 3.0.6
tldts: tldts:
specifier: ^6.0.3 specifier: ^6.0.3
version: 6.0.3 version: 6.0.3
@ -74,7 +80,7 @@ packages:
'@pushrocks/smartjson': 5.0.5 '@pushrocks/smartjson': 5.0.5
'@pushrocks/smartsocket': 2.0.19 '@pushrocks/smartsocket': 2.0.19
'@pushrocks/smartstring': 4.0.5 '@pushrocks/smartstring': 4.0.5
'@pushrocks/smarturl': 3.0.5 '@pushrocks/smarturl': 3.0.6
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
- supports-color - supports-color
@ -671,7 +677,6 @@ packages:
/@pushrocks/smartpromise@3.1.7: /@pushrocks/smartpromise@3.1.7:
resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==} resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==}
dev: true
/@pushrocks/smartpuppeteer@2.0.2: /@pushrocks/smartpuppeteer@2.0.2:
resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==} resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==}
@ -691,12 +696,11 @@ packages:
resolution: {integrity: sha512-fqS5D+o4fzhen4qlhT8DJiSSUVno1q+hSXcq5VJFGTQVtvaZ5lZeK1odqMJsCOHZ3mD2LykrufIPViktwgnyVg==} resolution: {integrity: sha512-fqS5D+o4fzhen4qlhT8DJiSSUVno1q+hSXcq5VJFGTQVtvaZ5lZeK1odqMJsCOHZ3mD2LykrufIPViktwgnyVg==}
dependencies: dependencies:
'@pushrocks/smartpromise': 3.1.7 '@pushrocks/smartpromise': 3.1.7
'@pushrocks/smarturl': 3.0.5 '@pushrocks/smarturl': 3.0.6
agentkeepalive: 4.3.0 agentkeepalive: 4.3.0
form-data: 4.0.0 form-data: 4.0.0
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true
/@pushrocks/smartrx@2.0.27: /@pushrocks/smartrx@2.0.27:
resolution: {integrity: sha512-aFRpGxDZgHH1mpmkRBTFwuIVqFiDxk22n2vX2gW4hntV0nJGlt9M9dixMFFXGUjabwX9hHW7y60QPJm2rKaypA==} resolution: {integrity: sha512-aFRpGxDZgHH1mpmkRBTFwuIVqFiDxk22n2vX2gW4hntV0nJGlt9M9dixMFFXGUjabwX9hHW7y60QPJm2rKaypA==}
@ -830,9 +834,8 @@ packages:
uuid: 7.0.3 uuid: 7.0.3
dev: true dev: true
/@pushrocks/smarturl@3.0.5: /@pushrocks/smarturl@3.0.6:
resolution: {integrity: sha512-XKS+GpIOvMhxr855PmO39SOvv/hdhBbLZ45dkAA6uGL3XdW036jAp61nu7qeB3c6FPShCyhJzo2z5x51wW7OwQ==} resolution: {integrity: sha512-YHWnYE1mm8WIJk1usSXg+kNM7s7ByM+PKApO9cgl0T/oGybjzAJiO3clGNDro4ysP0TD+WuvJuiVue02bErEBQ==}
dev: true
/@pushrocks/smartxml@1.0.6: /@pushrocks/smartxml@1.0.6:
resolution: {integrity: sha512-Cy//pxzdpplqE64h9/sAwvAkUBv9t3Nw9v6k2c+erXH779iOtuyGiiyWqgbRTX1wo2CRhMJqWGJx6xd2Ljq5kw==} resolution: {integrity: sha512-Cy//pxzdpplqE64h9/sAwvAkUBv9t3Nw9v6k2c+erXH779iOtuyGiiyWqgbRTX1wo2CRhMJqWGJx6xd2Ljq5kw==}
@ -1421,7 +1424,6 @@ packages:
humanize-ms: 1.2.1 humanize-ms: 1.2.1
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true
/aggregate-error@4.0.1: /aggregate-error@4.0.1:
resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==} resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==}
@ -1504,7 +1506,6 @@ packages:
/asynckit@0.4.0: /asynckit@0.4.0:
resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=} resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=}
dev: true
/axe-core@4.6.3: /axe-core@4.6.3:
resolution: {integrity: sha512-/BQzOX780JhsxDnPpH4ZiyrJAzcd8AfzFPkv+89veFSr1rcMjuq2JDCwypKaPeB6ljHp9KjXhPpjgCvQlWYuqg==} resolution: {integrity: sha512-/BQzOX780JhsxDnPpH4ZiyrJAzcd8AfzFPkv+89veFSr1rcMjuq2JDCwypKaPeB6ljHp9KjXhPpjgCvQlWYuqg==}
@ -1779,7 +1780,6 @@ packages:
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
dependencies: dependencies:
delayed-stream: 1.0.0 delayed-stream: 1.0.0
dev: true
/commander@2.20.3: /commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
@ -1916,7 +1916,6 @@ packages:
optional: true optional: true
dependencies: dependencies:
ms: 2.1.2 ms: 2.1.2
dev: true
/decompress-response@6.0.0: /decompress-response@6.0.0:
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
@ -1950,7 +1949,6 @@ packages:
/delayed-stream@1.0.0: /delayed-stream@1.0.0:
resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=} resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
dev: true
/delegates@1.0.0: /delegates@1.0.0:
resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=} resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=}
@ -1964,7 +1962,6 @@ packages:
/depd@2.0.0: /depd@2.0.0:
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
dev: true
/dependency-graph@0.11.0: /dependency-graph@0.11.0:
resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==} resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==}
@ -2515,7 +2512,6 @@ packages:
asynckit: 0.4.0 asynckit: 0.4.0
combined-stream: 1.0.8 combined-stream: 1.0.8
mime-types: 2.1.35 mime-types: 2.1.35
dev: true
/forwarded@0.2.0: /forwarded@0.2.0:
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
@ -2769,7 +2765,6 @@ packages:
resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=} resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=}
dependencies: dependencies:
ms: 2.1.3 ms: 2.1.3
dev: true
/iconv-lite@0.4.24: /iconv-lite@0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
@ -3291,14 +3286,12 @@ packages:
/mime-db@1.52.0: /mime-db@1.52.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
dev: true
/mime-types@2.1.35: /mime-types@2.1.35:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
dependencies: dependencies:
mime-db: 1.52.0 mime-db: 1.52.0
dev: true
/mime@1.6.0: /mime@1.6.0:
resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
@ -3362,11 +3355,9 @@ packages:
/ms@2.1.2: /ms@2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true
/ms@2.1.3: /ms@2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
dev: true
/nanocolors@0.2.13: /nanocolors@0.2.13:
resolution: {integrity: sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==} resolution: {integrity: sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==}

View File

@ -6,13 +6,23 @@ let testSmartWhois: smartwhois.SmartWhois;
tap.test('should create a valid instance of SmartWhois', async () => { tap.test('should create a valid instance of SmartWhois', async () => {
testSmartWhois = new smartwhois.SmartWhois(); testSmartWhois = new smartwhois.SmartWhois();
expect(testSmartWhois).toBeInstanceOf(smartwhois.SmartWhois); expect(testSmartWhois).toBeInstanceOf(smartwhois.SmartWhois);
}) });
tap.test('should get a parsed url result for whois', async () => {
const parsedUrlResult = await testSmartWhois.getParsedUrlResultForWhois('https://coffee.link/understanding-gen-z/');
console.log(parsedUrlResult);
});
tap.test('should get whois info for domain', async () => { tap.test('should get whois info for domain', async () => {
const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc'); const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc');
console.log(whoisInfo); console.log(whoisInfo);
}); });
tap.test('should get whois info for domain', async () => {
const whoisInfo = await testSmartWhois.getWhoisForDomain('https://coffee.link/understanding-gen-z/');
console.log(whoisInfo);
});
tap.test('should check for a valid tld', async () => { tap.test('should check for a valid tld', async () => {
const comIsValid = await testSmartWhois.isValidTld('.com'); const comIsValid = await testSmartWhois.isValidTld('.com');
console.log(comIsValid); console.log(comIsValid);

View File

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

View File

@ -38,7 +38,27 @@ export interface IWhoisInfo {
} }
export class SmartWhois { export class SmartWhois {
/**
* can be used to prepare an input for the whois command
*/
public async getParsedUrlResultForWhois(urlArg: string) {
const smarturlInstance = plugins.smarturl.Smarturl.createFromUrl(urlArg);
const tldtsData = plugins.tldts.parse(urlArg);
return {
fullUrl: smarturlInstance.toString(),
fullDomain: smarturlInstance.hostname,
domain: tldtsData.domain,
publicSuffix: tldtsData.publicSuffix,
subdomain: tldtsData.subdomain,
}
}
public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> { public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> {
if (domainArg.includes('//')) {
const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg);
domainArg = parsedUrlResult.fullDomain;
}
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]];

View File

@ -1,3 +1,10 @@
// pushrocks scope
import * as smarturl from '@pushrocks/smarturl';
export {
smarturl,
}
// third party // third party
import * as whoiser from 'whoiser'; import * as whoiser from 'whoiser';
import tldts from 'tldts'; import tldts from 'tldts';