36 Commits

Author SHA1 Message Date
jkunz 4be4df03bc v1.0.17 2026-05-01 16:20:47 +00:00
jkunz c7d2b13c8b fix(whois): improve type safety and harden WHOIS parsing for missing fields 2026-05-01 16:20:47 +00:00
jkunz dc3288cc51 update 2025-07-29 00:27:48 +00:00
philkunz 86cc1a138b update description 2024-05-29 14:17:14 +02:00
philkunz 37a00db7c8 update tsconfig 2024-04-14 18:34:24 +02:00
philkunz 65a9b7f504 update tsconfig 2024-04-01 21:42:17 +02:00
philkunz e9fa022159 update npmextra.json: githost 2024-04-01 20:00:06 +02:00
philkunz b2b3ae34bd update npmextra.json: githost 2024-03-30 21:49:06 +01:00
philkunz 7267a0cc38 1.0.16 2023-10-06 11:11:01 +02:00
philkunz 79ab43876d fix(core): update 2023-10-06 11:11:00 +02:00
philkunz 50742ddfa5 1.0.15 2023-10-06 11:10:13 +02:00
philkunz 83a851a6aa fix(core): update 2023-10-06 11:10:13 +02:00
philkunz b6d5f61f3c 1.0.14 2023-04-19 21:51:15 +02:00
philkunz 101772d8dc fix(core): update 2023-04-19 21:51:14 +02:00
philkunz ba4a910962 1.0.13 2023-04-19 21:36:44 +02:00
philkunz 739c95c1e1 fix(core): update 2023-04-19 21:36:44 +02:00
philkunz 39442208c8 1.0.12 2023-04-19 18:57:12 +02:00
philkunz b686202ae5 fix(core): update 2023-04-19 18:57:12 +02:00
philkunz 4093d091f4 1.0.11 2023-04-19 18:49:06 +02:00
philkunz 7a8086b58c fix(core): update 2023-04-19 18:49:06 +02:00
philkunz a45e41889d 1.0.10 2023-04-19 18:41:54 +02:00
philkunz c33ee3f52c fix(core): update 2023-04-19 18:41:54 +02:00
philkunz 1732a2ab3e 1.0.9 2023-04-19 14:52:38 +02:00
philkunz 43ebd17ae6 fix(core): update 2023-04-19 14:52:37 +02:00
philkunz 18f09a5109 1.0.8 2023-04-18 20:40:39 +02:00
philkunz bec73de6d5 fix(core): update 2023-04-18 20:40:39 +02:00
philkunz deba684093 1.0.7 2023-04-10 14:43:46 +02:00
philkunz 1625f507d8 fix(core): update 2023-04-10 14:43:46 +02:00
philkunz 32f8315493 1.0.6 2023-04-10 14:42:24 +02:00
philkunz ffbf56625e fix(core): update 2023-04-10 14:42:24 +02:00
philkunz d928a62b5e 1.0.5 2023-04-10 14:34:29 +02:00
philkunz b5c5b18f35 fix(core): update 2023-04-10 14:34:28 +02:00
philkunz 3e3b61cc73 1.0.4 2023-04-03 17:50:55 +02:00
philkunz ecb009dedb fix(core): update 2023-04-03 17:50:55 +02:00
philkunz 6e8beac2dd 1.0.3 2023-04-03 17:08:27 +02:00
philkunz 9160a1bd56 fix(core): update 2023-04-03 17:08:26 +02:00
17 changed files with 8349 additions and 4089 deletions
+66
View File
@@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
+124
View File
@@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true
-128
View File
@@ -1,128 +0,0 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
before_script:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ====================
# security stage
# ====================
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags:
- lossless
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --dev
tags:
- lossless
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testBuild:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install stable
- npmci npm install
- npmci command npm run buildDocs
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true
+37
View File
@@ -0,0 +1,37 @@
{
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartwhois",
"shortDescription": "execute WHOIS requests",
"npmPackagename": "@push.rocks/smartwhois",
"license": "MIT",
"description": "A package for executing WHOIS requests and processing domain and IP information.",
"keywords": [
"WHOIS",
"domain information",
"IP lookup",
"TLD validation",
"DNSSEC status",
"HTTP status checker",
"TypeScript"
]
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {
"npmGlobalTools": [],
"npmRegistryUrl": "registry.npmjs.org"
}
}
+51
View File
@@ -0,0 +1,51 @@
# Changelog
## 2026-05-01 - 1.0.17 - fix(whois)
improve type safety and harden WHOIS parsing for missing fields
- add explicit additional WHOIS data interface and return types
- default parsed domain and WHOIS fields to safe fallback values to avoid undefined access
- normalize Domain Status handling for both string and array responses
- update test entrypoint to test.node.ts and align tooling and build scripts with newer dependencies
## 2025-07-29 - 1.0.16 - maintenance
Routine maintenance updates for v1.0.16 after the initial release.
- Updated project description
- Updated TypeScript configuration
- Updated `npmextra.json` git host settings
- Included a general maintenance update
## 2023-10-06 - 1.0.16 - release
Released v1.0.16.
- Published version 1.0.16
- Included a core update carried forward from the previous patch cycle
## 2023-10-06 - 1.0.15 - core
Applied a core fix update.
- Updated core behavior in v1.0.15
## 2023-04-19 - 1.0.14 - core
Patch releases from v1.0.8 through v1.0.14 consisted primarily of repeated core maintenance updates.
- Released versions 1.0.8 through 1.0.14
- Applied recurring `fix(core): update` changes across the patch range
## 2023-04-18 - 1.0.8 - release
Released v1.0.8.
- Published version 1.0.8
## 2023-04-10 - 1.0.7 - core
Patch releases from v1.0.4 through v1.0.7 focused on small core fixes.
- Released versions 1.0.4 through 1.0.7
- Applied recurring `fix(core): update` changes across the patch range
## 2023-04-03 - 1.0.4 - core
Initial patch series from v1.0.1 through v1.0.3 contained minor core fixes.
- Released versions 1.0.1 through 1.0.3
- Applied recurring `fix(core): update` changes across the patch range
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2026 Task Venture Capital GmbH <hello@task.vc>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+27 -8
View File
@@ -1,18 +1,37 @@
{
"gitzone": {
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartwhois",
"description": "a package for dealing with whois requests",
"npmPackagename": "@pushrocks/smartwhois",
"shortDescription": "execute WHOIS requests",
"npmPackagename": "@push.rocks/smartwhois",
"license": "MIT",
"projectDomain": "push.rocks"
"description": "A package for executing WHOIS requests and processing domain and IP information.",
"keywords": [
"WHOIS",
"domain information",
"IP lookup",
"TLD validation",
"DNSSEC status",
"HTTP status checker",
"TypeScript"
]
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"npmci": {
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
"npmRegistryUrl": "registry.npmjs.org"
}
}
+37 -16
View File
@@ -1,29 +1,33 @@
{
"name": "@pushrocks/smartwhois",
"version": "1.0.2",
"name": "@push.rocks/smartwhois",
"version": "1.0.17",
"private": false,
"description": "a package for dealing with whois requests",
"description": "A package for executing WHOIS requests and processing domain and IP information.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Task Venture Capital GmbH",
"author": "Task Venture Capital GmbH <hello@task.vc>",
"license": "MIT",
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "(tsdoc)"
"test": "tstest test/ --verbose",
"format": "gitzone format",
"build": "tsbuild --web",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.65",
"@gitzone/tsbundle": "^2.0.7",
"@gitzone/tsdoc": "^1.1.12",
"@gitzone/tsrun": "^1.2.39",
"@gitzone/tstest": "^1.0.74",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.15.11"
"@git.zone/tsbuild": "^4.4.0",
"@git.zone/tsbundle": "^2.10.1",
"@git.zone/tsrun": "^2.0.3",
"@git.zone/tstest": "^3.6.3",
"@types/node": "^25.6.0",
"why-is-node-running": "^3.2.2"
},
"dependencies": {
"whoiser": "^1.16.0"
"@push.rocks/smartrequest": "^5.0.1",
"@push.rocks/smarturl": "^3.0.6",
"@tsclass/tsclass": "^9.5.1",
"tldts": "^7.0.29",
"whoiser": "^1.18.0"
},
"browserslist": [
"last 1 chrome versions"
@@ -37,7 +41,24 @@
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
".smartconfig.json",
"license",
"npmextra.json",
"readme.md"
]
],
"keywords": [
"WHOIS",
"domain information",
"IP lookup",
"TLD validation",
"DNSSEC status",
"HTTP status checker",
"TypeScript"
],
"homepage": "https://code.foss.global/push.rocks/smartwhois",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartwhois.git"
},
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}
+7667 -3873
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
+106 -26
View File
@@ -1,37 +1,117 @@
# @pushrocks/smartwhois
# @push.rocks/smartwhois
a package for dealing with whois requests
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartwhois)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartwhois)
* [github.com (source mirror)](https://github.com/pushrocks/smartwhois)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartwhois/)
## Install
To install `@push.rocks/smartwhois`, you can use npm or yarn. First, open your terminal, then execute one of the following commands in your project directory:
## Status for master
```sh
npm install @push.rocks/smartwhois --save
```
or
```sh
yarn add @push.rocks/smartwhois
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartwhois/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartwhois/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartwhois)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartwhois)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartwhois)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartwhois)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartwhois)](https://lossless.cloud)
This will add `@push.rocks/smartwhois` to your project's dependencies.
## Usage
The `@push.rocks/smartwhois` module provides an intuitive TypeScript interface for dealing with WHOIS requests. It allows you to gather WHOIS information for domains, including registration details, registrar information, and more. For using this module, it is highly recommended to be familiar with TypeScript and async/await patterns for promise handling.
Use TypeScript for best in class intellisense
### Getting Started
First, ensure that you import the necessary classes from the module. The primary class you will interact with is `SmartWhois`.
## Contribution
```typescript
import { SmartWhois } from '@push.rocks/smartwhois';
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
// Create an instance of SmartWhois
const smartWhois = new SmartWhois();
```
For further information read the linked docs at the top of this readme.
### Fetching WHOIS Information for a Domain
The most common operation is to fetch WHOIS information for a given domain. This can easily be done using the `getWhoisForDomain` method, which returns detailed WHOIS information.
## Legal
> MIT licensed | **&copy;** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
```typescript
async function getDomainWhois() {
const domainInfo = await smartWhois.getWhoisForDomain('example.com');
console.log(domainInfo);
}
getDomainWhois();
```
### Determining Domain Delegation
To understand the structure of a domain or URL, you can use `getDomainDelegation`. This method provides insights into various components of a domain or URL, such as its TLD, domain name, etc.
```typescript
async function checkDomainDelegation() {
const delegationInfo = await smartWhois.getDomainDelegation('https://www.example.com/path');
console.log(delegationInfo);
}
checkDomainDelegation();
```
### Additional WHOIS Data
For some domains, additional WHOIS data beyond the basics might be useful. This includes HTTPS status, headers, and more. Retrieving additional data is straightforward:
```typescript
async function fetchAdditionalData() {
const additionalData = await smartWhois.getAdditionalWhoisDataForDomain('example.com');
console.log(additionalData);
}
fetchAdditionalData();
```
### Validating TLDs
When working with various top-level domains (TLDs), you might want to verify if a given TLD is valid. The `isValidTld` method helps check the validity of a TLD:
```typescript
async function isTldValid() {
const isValid = await smartWhois.isValidTld('.com');
console.log(`Is .com a valid TLD? ${isValid}`);
}
isTldValid();
```
### Handling Errors
When making requests, there is always a possibility of running into errors due to network issues, invalid domains, or other reasons. It's crucial to properly handle these cases:
```typescript
async function safelyGetWhois() {
try {
const whoisInfo = await smartWhois.getWhoisForDomain('nonexistentdomain.xyz');
console.log(whoisInfo);
} catch (error) {
console.error('Failed to fetch WHOIS info:', error);
}
}
safelyGetWhois();
```
### Integration with Other Systems
The retrieved WHOIS data can be easily integrated into other parts of your application or system. For instance, you could store the data in a database, use it to monitor domain registration changes, or create alerts for domain expiry dates.
### Advanced Usage
While the above examples cover the basics, `@push.rocks/smartwhois` offers much more. Explore the source code and TypeScript definitions to uncover additional functionality, such as parsing complex WHOIS server responses, handling internationalized domain names (IDNs), and more.
### Summary
`@push.rocks/smartwhois` is a powerful tool for querying WHOIS information, designed with modern development practices in mind. By leveraging TypeScript, it offers a robust and type-safe way to integrate WHOIS data into your applications, enriching your projects with valuable domain-related insights.
For further information and the latest updates, refer to the official documentation and GitHub repository.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
+45
View File
@@ -0,0 +1,45 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as smartwhois from '../ts/index.js';
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 domainDelegation = await testSmartWhois.getDomainDelegation('https://coffee.link/understanding-gen-z/');
console.log(domainDelegation);
const parsedUrlResult2 = await testSmartWhois.getDomainDelegation('task.vc');
console.log(parsedUrlResult2);
});
tap.test('should get additional data', async () => {
const parsedUrlResult = await testSmartWhois.getAdditionalWhoisDataForDomain('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://lossless.com');
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);
expect(comIsValid).toBeTrue();
});
export default tap.start({
throwOnError: true
});
-16
View File
@@ -1,16 +0,0 @@
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartwhois from '../ts/index.js';
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 whois info for domain', async () => {
const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc');
console.log(whoisInfo);
});
tap.start();
+4 -4
View File
@@ -1,8 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartwhois',
version: '1.0.2',
description: 'a package for dealing with whois requests'
name: '@push.rocks/smartwhois',
version: '1.0.17',
description: 'A package for executing WHOIS requests and processing domain and IP information.'
}
+133 -8
View File
@@ -1,17 +1,134 @@
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;
isIp: boolean;
isPrivate: boolean;
publicSuffix: string;
subdomain: string;
dnsSec: 'signedDelegation' | 'unsigned';
originalWhoisInfo: {
[key: string]: any;
};
whoisServers: string[];
registrar: string;
registrarUrl: string;
createdDate: string;
updatedDate: string;
expiryDate: string;
}
export interface IAdditionalWhoisData {
httpStatus: number;
httpsStatus: number;
httpHeaders: unknown;
httpsHeaders: unknown;
}
export class SmartWhois {
public async getWhoisForDomain(domainArg: string) {
/**
* can be used to prepare an input for the whois command
*/
public async getDomainDelegation(urlArg: string): Promise<plugins.tsclass.network.IDomainDelegation> {
if (!urlArg.includes('//')) {
urlArg = `https://${urlArg}`;
}
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 ?? '',
domainWithoutSuffix: tldtsData.domainWithoutSuffix ?? '',
isIcann: tldtsData.isIcann ?? undefined,
};
}
public async getAdditionalWhoisDataForDomain(domainArg: string): Promise<IAdditionalWhoisData> {
if (domainArg.includes('//')) {
const parsedUrlResult = await this.getDomainDelegation(domainArg);
domainArg = parsedUrlResult.fullDomain;
}
// lets test http response
const httpResult = await plugins.smartrequest.SmartRequest.create()
.url(`http://${domainArg}/`)
.get();
// lets test https response
const httpsResult = await plugins.smartrequest.SmartRequest.create()
.url(`https://${domainArg}/`)
.get();
return {
httpStatus: httpResult.status,
httpsStatus: httpsResult.status,
httpHeaders: httpResult.headers,
httpsHeaders: httpsResult.headers,
};
}
public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> {
if (domainArg.includes('//')) {
const parsedUrlResult = await this.getDomainDelegation(domainArg);
domainArg = parsedUrlResult.fullDomain;
}
const whoisInfo = await plugins.whoiser.domain(domainArg);
const whoisServers = Object.keys(whoisInfo);
const selectedWhoisInfo: any = whoisInfo[whoisServers[0]];
const registrar = selectedWhoisInfo.Registrar;
const registrarUrl = selectedWhoisInfo['Registrar URL'];
const createdDate = selectedWhoisInfo['Created Date'];
const updatedDate = selectedWhoisInfo['Updated Date'];
const expiryDate = selectedWhoisInfo['Expiry Date'];
const selectedWhoisInfo = whoisInfo[whoisServers[0]] as Record<string, unknown>;
const getStringField = (fieldName: string): string => {
const fieldValue = selectedWhoisInfo[fieldName];
return typeof fieldValue === 'string' ? fieldValue : '';
};
const registrar = getStringField('Registrar');
const registrarUrl = getStringField('Registrar URL');
const createdDate = getStringField('Created Date');
const updatedDate = getStringField('Updated Date');
const expiryDate = getStringField('Expiry Date');
const domainStatusRaw = selectedWhoisInfo['Domain Status'];
const domainStatusSource = Array.isArray(domainStatusRaw)
? domainStatusRaw
: typeof domainStatusRaw === 'string'
? [domainStatusRaw]
: [];
const domainStatus = domainStatusSource.map((statusArg) => String(statusArg).split(' ')[0]) as IWhoisInfo['domainStatus'];
const tldtsData = plugins.tldts.parse(domainArg);
return {
originalWhoisInfo: whoisInfo,
domain: tldtsData.domain ?? '',
domainWithoutSuffix: tldtsData.domainWithoutSuffix ?? '',
hostname: tldtsData.hostname ?? '',
isIcann: tldtsData.isIcann ?? false,
isIp: tldtsData.isIp ?? false,
isPrivate: tldtsData.isPrivate ?? false,
publicSuffix: tldtsData.publicSuffix ?? '',
subdomain: tldtsData.subdomain ?? '',
isRegistered: true,
domainStatus,
dnsSec: getStringField('DNSSEC') as IWhoisInfo['dnsSec'],
originalWhoisInfo: whoisInfo as Record<string, unknown>,
whoisServers,
registrar,
registrarUrl,
@@ -21,5 +138,13 @@ export class SmartWhois {
};
}
public async isValidTld(tldArg: string): Promise<boolean> {
const allTlds = await plugins.whoiser.allTlds();
const sanatizedTld = tldArg.startsWith('.')
? tldArg.replace('.', '').toUpperCase()
: tldArg.toUpperCase();
return allTlds.includes(sanatizedTld);
}
public async getWhoisForIp(ipArg: string) {}
}
+22 -4
View File
@@ -1,6 +1,24 @@
// third party
import * as whoiser from 'whoiser';
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
whoiser
}
tsclass,
};
// pushrocks scope
import * as smarturl from '@push.rocks/smarturl';
import * as smartrequest from '@push.rocks/smartrequest';
export {
smarturl,
smartrequest,
};
// third party
import * as whoiser from 'whoiser';
import tldts from 'tldts';
export {
whoiser,
tldts,
};
+8 -4
View File
@@ -3,8 +3,12 @@
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitAny": true,
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"types": ["node"]
},
"exclude": ["dist_*/**/*.d.ts"]
}