fix(core): update
This commit is contained in:
parent
deba684093
commit
bec73de6d5
@ -23,6 +23,8 @@
|
||||
"@types/node": "^18.15.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartrequest": "^2.0.11",
|
||||
"@pushrocks/smarturl": "^3.0.6",
|
||||
"tldts": "^6.0.3",
|
||||
"whoiser": "^1.16.0"
|
||||
},
|
||||
|
29
pnpm-lock.yaml
generated
29
pnpm-lock.yaml
generated
@ -1,6 +1,12 @@
|
||||
lockfileVersion: '6.0'
|
||||
|
||||
dependencies:
|
||||
'@pushrocks/smartrequest':
|
||||
specifier: ^2.0.11
|
||||
version: 2.0.11
|
||||
'@pushrocks/smarturl':
|
||||
specifier: ^3.0.6
|
||||
version: 3.0.6
|
||||
tldts:
|
||||
specifier: ^6.0.3
|
||||
version: 6.0.3
|
||||
@ -74,7 +80,7 @@ packages:
|
||||
'@pushrocks/smartjson': 5.0.5
|
||||
'@pushrocks/smartsocket': 2.0.19
|
||||
'@pushrocks/smartstring': 4.0.5
|
||||
'@pushrocks/smarturl': 3.0.5
|
||||
'@pushrocks/smarturl': 3.0.6
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
@ -671,7 +677,6 @@ packages:
|
||||
|
||||
/@pushrocks/smartpromise@3.1.7:
|
||||
resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==}
|
||||
dev: true
|
||||
|
||||
/@pushrocks/smartpuppeteer@2.0.2:
|
||||
resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==}
|
||||
@ -691,12 +696,11 @@ packages:
|
||||
resolution: {integrity: sha512-fqS5D+o4fzhen4qlhT8DJiSSUVno1q+hSXcq5VJFGTQVtvaZ5lZeK1odqMJsCOHZ3mD2LykrufIPViktwgnyVg==}
|
||||
dependencies:
|
||||
'@pushrocks/smartpromise': 3.1.7
|
||||
'@pushrocks/smarturl': 3.0.5
|
||||
'@pushrocks/smarturl': 3.0.6
|
||||
agentkeepalive: 4.3.0
|
||||
form-data: 4.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@pushrocks/smartrx@2.0.27:
|
||||
resolution: {integrity: sha512-aFRpGxDZgHH1mpmkRBTFwuIVqFiDxk22n2vX2gW4hntV0nJGlt9M9dixMFFXGUjabwX9hHW7y60QPJm2rKaypA==}
|
||||
@ -830,9 +834,8 @@ packages:
|
||||
uuid: 7.0.3
|
||||
dev: true
|
||||
|
||||
/@pushrocks/smarturl@3.0.5:
|
||||
resolution: {integrity: sha512-XKS+GpIOvMhxr855PmO39SOvv/hdhBbLZ45dkAA6uGL3XdW036jAp61nu7qeB3c6FPShCyhJzo2z5x51wW7OwQ==}
|
||||
dev: true
|
||||
/@pushrocks/smarturl@3.0.6:
|
||||
resolution: {integrity: sha512-YHWnYE1mm8WIJk1usSXg+kNM7s7ByM+PKApO9cgl0T/oGybjzAJiO3clGNDro4ysP0TD+WuvJuiVue02bErEBQ==}
|
||||
|
||||
/@pushrocks/smartxml@1.0.6:
|
||||
resolution: {integrity: sha512-Cy//pxzdpplqE64h9/sAwvAkUBv9t3Nw9v6k2c+erXH779iOtuyGiiyWqgbRTX1wo2CRhMJqWGJx6xd2Ljq5kw==}
|
||||
@ -1421,7 +1424,6 @@ packages:
|
||||
humanize-ms: 1.2.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/aggregate-error@4.0.1:
|
||||
resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==}
|
||||
@ -1504,7 +1506,6 @@ packages:
|
||||
|
||||
/asynckit@0.4.0:
|
||||
resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=}
|
||||
dev: true
|
||||
|
||||
/axe-core@4.6.3:
|
||||
resolution: {integrity: sha512-/BQzOX780JhsxDnPpH4ZiyrJAzcd8AfzFPkv+89veFSr1rcMjuq2JDCwypKaPeB6ljHp9KjXhPpjgCvQlWYuqg==}
|
||||
@ -1779,7 +1780,6 @@ packages:
|
||||
engines: {node: '>= 0.8'}
|
||||
dependencies:
|
||||
delayed-stream: 1.0.0
|
||||
dev: true
|
||||
|
||||
/commander@2.20.3:
|
||||
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
|
||||
@ -1916,7 +1916,6 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
dev: true
|
||||
|
||||
/decompress-response@6.0.0:
|
||||
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
|
||||
@ -1950,7 +1949,6 @@ packages:
|
||||
/delayed-stream@1.0.0:
|
||||
resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: true
|
||||
|
||||
/delegates@1.0.0:
|
||||
resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=}
|
||||
@ -1964,7 +1962,6 @@ packages:
|
||||
/depd@2.0.0:
|
||||
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
dev: true
|
||||
|
||||
/dependency-graph@0.11.0:
|
||||
resolution: {integrity: sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==}
|
||||
@ -2515,7 +2512,6 @@ packages:
|
||||
asynckit: 0.4.0
|
||||
combined-stream: 1.0.8
|
||||
mime-types: 2.1.35
|
||||
dev: true
|
||||
|
||||
/forwarded@0.2.0:
|
||||
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
|
||||
@ -2769,7 +2765,6 @@ packages:
|
||||
resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=}
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
dev: true
|
||||
|
||||
/iconv-lite@0.4.24:
|
||||
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
|
||||
@ -3291,14 +3286,12 @@ packages:
|
||||
/mime-db@1.52.0:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: true
|
||||
|
||||
/mime-types@2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
dev: true
|
||||
|
||||
/mime@1.6.0:
|
||||
resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==}
|
||||
@ -3362,11 +3355,9 @@ packages:
|
||||
|
||||
/ms@2.1.2:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
dev: true
|
||||
|
||||
/ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
dev: true
|
||||
|
||||
/nanocolors@0.2.13:
|
||||
resolution: {integrity: sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==}
|
||||
|
12
test/test.ts
12
test/test.ts
@ -6,13 +6,23 @@ let testSmartWhois: smartwhois.SmartWhois;
|
||||
tap.test('should create a valid instance of SmartWhois', async () => {
|
||||
testSmartWhois = new 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 () => {
|
||||
const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc');
|
||||
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 () => {
|
||||
const comIsValid = await testSmartWhois.isValidTld('.com');
|
||||
console.log(comIsValid);
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartwhois',
|
||||
version: '1.0.7',
|
||||
version: '1.0.8',
|
||||
description: 'a package for dealing with whois requests'
|
||||
}
|
||||
|
20
ts/index.ts
20
ts/index.ts
@ -38,7 +38,27 @@ export interface IWhoisInfo {
|
||||
}
|
||||
|
||||
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> {
|
||||
if (domainArg.includes('//')) {
|
||||
const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg);
|
||||
domainArg = parsedUrlResult.fullDomain;
|
||||
}
|
||||
const whoisInfo = await plugins.whoiser.domain(domainArg);
|
||||
const whoisServers = Object.keys(whoisInfo);
|
||||
const selectedWhoisInfo: any = whoisInfo[whoisServers[0]];
|
||||
|
@ -1,3 +1,10 @@
|
||||
// pushrocks scope
|
||||
import * as smarturl from '@pushrocks/smarturl';
|
||||
|
||||
export {
|
||||
smarturl,
|
||||
}
|
||||
|
||||
// third party
|
||||
import * as whoiser from 'whoiser';
|
||||
import tldts from 'tldts';
|
||||
|
Loading…
Reference in New Issue
Block a user