npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@torus-tools/domains

v0.0.14

Published

A standrad promise-based SDK for managing nameserver and DNS operations accorss multiple domain name registrars

Downloads

5

Readme

Torus Tools - Domains

A promise-based javascript SDK that standarizes interactions with various different domain registrars providers.

Currently Supporting

  • AWS
  • Godaddy

If you are interested in adding new providers create the feature request and we will add it to our pipeline; or feel free to submit your own PR :sunglasses:

Records Format

the records parameter has the following format

{
  name:"example.com",  //traffic coming into (root domain or sub-domain)
  data: "192.0.2.44",  //route traffic to somewhere (an ip or resource ARN)
  type: "CNAME",  //type of record.
  ttl: 3600   //ttl for the record if required
  alias: true|false   //depending on this value the record will either have a resourceRecords attribute or an aliasTarget attribute in AWS
}

Record Types

  • A
  • AAAA
  • CAA
  • CNAME
  • MX
  • NAPTR
  • NS
  • PTR
  • SOA
  • SPF
  • SRV
  • TXT

API

The API standardizes operations accross different providers. As shown in the example below, all of the methods must be used in the format [PROVIDER].method

const {godaddy} = require('@torus-tools/domains')

godaddy.getNameservers('mydomain.com')
.then(data=> console.log(data))
.catch(err=>console.log(err))

getNameservers(domain)

  • description: gets the nameservers for a particular domain
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: (nameservers)
      • nameservers: an array of nameserver addresses
    • reject: (error)

updateNameservers(domain, nameservers)

  • description: updates the nameservers for a particular domain
  • params: (domain, nameservers)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • nameservers: ARRAY: REQUIRED: an array of nameserver strings
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • nameservers: an array of nameserver addresses
    • reject: (error)

listRecords(domain)

  • description: Lists the records of a particular domain
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • recordSet: an object with the record set of the given domain
    • reject: (error)

upsertRecords(domain, records)

  • description: It will create or update the specified records for a given domain. If one of the records exists it will updated, otherwise it will be created.
  • params: (domain, records)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • records: OBJECT: REQUIRED: the record set that includes:
      • Record name
      • Record type
      • Record data
      • Record ttl
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • record: an array with the new record data that has been created or updated
    • reject: (error)

deleteRecords(domain, records)

  • description: deletes the specified records for a given domain.
  • params: (domain, records)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • records: OBJECT: REQUIRED: the record sets that will be deleted
  • returns: promise(resolve, reject)
    • resolve: ('recordSet deleted')
      • recordSet: an object with the record set hat has been deleted
    • reject: (error)

deleteAllRecords(doamin, records)

  • description: Deletes all DNS records for a given domain.
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: ('All recordSets deleted')
    • reject: (error)

createRedirect(domain, url)

  • description: creates a 301 redirect for the given domian to a specified url.
  • params: (domain, url)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • url: STRING: REQUIRED: the url address you want to redirect
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • type: a string with the value "REDIRECT_PERMANENT"
      • url: a string for the redirect url address
    • reject: (error)

addRecord(domain, records)

  • description: It will add the specified records to the given domain.
  • params: (domain, records)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • records: OBJECT: REQUIRED: the record set that includes:
      • Record name
      • Record type
      • Record data
      • Record ttl
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • record: an object with the record that has been added
    • reject: (error)

getZone(domain)

  • description: gets the DNS zone Id for a given domain.
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • HostedZones: An array with the hosted zone ID of given domain.
    • reject: ('no hosted zones exist for the given domain')