update tsconfig
This commit is contained in:
parent
6c38ff36d7
commit
aff5f2e7d9
@ -5,9 +5,19 @@
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartdns",
|
||||
"description": "smart dns methods written in TypeScript",
|
||||
"description": "A TypeScript library for smart DNS methods, supporting various DNS records and providers.",
|
||||
"npmPackagename": "@push.rocks/smartdns",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"DNS",
|
||||
"TypeScript",
|
||||
"Node.js",
|
||||
"Google DNS",
|
||||
"Cloudflare",
|
||||
"DNS records",
|
||||
"DNS resolution",
|
||||
"DNSSEC"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
@ -15,7 +25,7 @@
|
||||
"npmAccessLevel": "public",
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"tsdocs": {
|
||||
"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"
|
||||
}
|
||||
}
|
13
package.json
13
package.json
@ -2,7 +2,7 @@
|
||||
"name": "@push.rocks/smartdns",
|
||||
"version": "5.0.4",
|
||||
"private": false,
|
||||
"description": "smart dns methods written in TypeScript",
|
||||
"description": "A TypeScript library for smart DNS methods, supporting various DNS records and providers.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"scripts": {
|
||||
@ -15,9 +15,14 @@
|
||||
"url": "git+ssh://git@gitlab.com/pushrocks/dnsly.git"
|
||||
},
|
||||
"keywords": [
|
||||
"dns",
|
||||
"google dns",
|
||||
"dns record"
|
||||
"DNS",
|
||||
"TypeScript",
|
||||
"Node.js",
|
||||
"Google DNS",
|
||||
"Cloudflare",
|
||||
"DNS records",
|
||||
"DNS resolution",
|
||||
"DNSSEC"
|
||||
],
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
||||
|
147
readme.md
147
readme.md
@ -1,51 +1,124 @@
|
||||
# @pushrocks/smartdns
|
||||
# @push.rocks/smartdns
|
||||
|
||||
smart dns methods written in TypeScript
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdns)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdns)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/smartdns)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartdns/)
|
||||
## Install
|
||||
|
||||
## Status for master
|
||||
To install `@push.rocks/smartdns`, use the following command with npm:
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartdns/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartdns/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartdns)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartdns)](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/smartdns)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartdns)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartdns)](https://lossless.cloud)
|
||||
```bash
|
||||
npm install @push.rocks/smartdns --save
|
||||
```
|
||||
|
||||
Or with `yarn`:
|
||||
|
||||
```bash
|
||||
yarn add @push.rocks/smartdns
|
||||
```
|
||||
|
||||
Make sure you have a TypeScript environment setup to utilize the library effectively.
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class instellisense.
|
||||
`@push.rocks/smartdns` is a comprehensive library aimed at facilitating smart DNS operations, leveraging TypeScript for enhanced development experience. This section aims to cover several real-world scenarios demonstrating the library's capabilities, from basic DNS lookups to more advanced DNS management tasks.
|
||||
|
||||
### Getting Started
|
||||
|
||||
First, ensure you import the module into your TypeScript project:
|
||||
|
||||
```typescript
|
||||
const mySmartDns = new smartdns.SmartDns(); // uses Google DNS Https API
|
||||
const demoRecord = await mySmartDns.getRecord('example.com', 'AAAA'); // returns promise
|
||||
/*
|
||||
demoRecord looks like this:
|
||||
{
|
||||
name: 'example.com',
|
||||
type: 'A',
|
||||
dnsSecEnabled: true,
|
||||
value: '104.24.103.243'
|
||||
}
|
||||
*/
|
||||
import { Smartdns } from '@push.rocks/smartdns';
|
||||
```
|
||||
|
||||
## Contribution
|
||||
### Basic DNS Record Lookup
|
||||
|
||||
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). :)
|
||||
Often, the need arises to fetch various DNS records for a domain. `@push.rocks/smartdns` simplifies this by providing intuitive methods.
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
#### Fetching A Records
|
||||
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
To fetch an "A" record for a domain:
|
||||
|
||||
```typescript
|
||||
const dnsManager = new Smartdns({});
|
||||
const aRecords = await dnsManager.getRecordsA('example.com');
|
||||
console.log(aRecords);
|
||||
```
|
||||
|
||||
#### Fetching AAAA Records
|
||||
|
||||
Similarly, for "AAAA" records:
|
||||
|
||||
```typescript
|
||||
const aaaaRecords = await dnsManager.getRecordsAAAA('example.com');
|
||||
console.log(aaaaRecords);
|
||||
```
|
||||
|
||||
### Advanced DNS Management
|
||||
|
||||
Beyond simple queries, `@push.rocks/smartdns` offers functionalities suitable for more complex DNS management scenarios.
|
||||
|
||||
#### Checking DNS Propagation
|
||||
|
||||
When changing DNS records, ensuring that the new records have propagated fully is crucial. `@push.rocks/smartdns` facilitates this with a method to check a DNS record until it is available globally.
|
||||
|
||||
```typescript
|
||||
const recordType = 'TXT'; // Record type: A, AAAA, CNAME, TXT etc.
|
||||
const expectedValue = 'your_expected_value';
|
||||
const isAvailable = await dnsManager.checkUntilAvailable('example.com', recordType, expectedValue);
|
||||
|
||||
if (isAvailable) {
|
||||
console.log('Record propagated successfully.');
|
||||
} else {
|
||||
console.log('Record propagation failed or timed out.');
|
||||
}
|
||||
```
|
||||
|
||||
### Leveraging DNS for Application Logic
|
||||
|
||||
DNS records can serve beyond mere domain-to-IP resolution; they can be instrumental in application logic, such as feature flagging or environment-specific configurations.
|
||||
|
||||
#### Example: Feature Flagging via TXT Records
|
||||
|
||||
Consider leveraging TXT records for enabling/disabling features dynamically without deploying new code.
|
||||
|
||||
```typescript
|
||||
const txtRecords = await dnsManager.getRecordsTxt('features.example.com');
|
||||
const featureFlags = txtRecords.reduce((acc, record) => {
|
||||
const [flag, isEnabled] = record.value.split('=');
|
||||
acc[flag] = isEnabled === 'true';
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
if (featureFlags['NewFeature']) {
|
||||
// Logic to enable the new feature
|
||||
}
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
`@push.rocks/smartdns` offers a versatile set of tools for DNS querying and management, tailored for applications at any scale. The examples provided illustrate the library's potential use cases, highlighting its applicability in various scenarios from basic lookups to facilitating complex application features through DNS.
|
||||
|
||||
For the full spectrum of functionalities, including detailed method documentation and additional use cases, consult the module's [TypeDoc documentation](https://pushrocks.gitlab.io/smartdns/). This will serve as a comprehensive guide to leveraging `@push.rocks/smartdns` effectively in your projects.
|
||||
|
||||
Remember, DNS changes might take time to propagate worldwide, and the utility methods provided by `@push.rocks/smartdns` for checking record availability will be invaluable in managing these changes seamlessly.
|
||||
|
||||
|
||||
|
||||
## 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.
|
||||
|
Loading…
Reference in New Issue
Block a user