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

now-universal-client

v1.3.3

Published

Now API universal wrapper based on axios

Downloads

20

Readme

now-universal-client

🎁 Promise-based Universal API wrapper for now.sh

Usage

$ npm install --save now-universal-client
const {getDeployments} = require('now-universal-client')
const TOKEN = 'YOUR TOKEN'

let deployments

try {
  deployments = await getDeployments({token: TOKEN})
} catch (err) {
  console.error(err)
}

console.log(deployments)

API

const now = require('now-universal-client')

now.getDeployments({token}) ⇒ Promise

Returns an array with all deployments.

Kind: instance method of Now
See: https://zeit.co/api#list-endpoint

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token |

Resolves to an array of deployments.

now.getDeployment({token, id}) ⇒ Promise

Returns an object with deployment data.

Kind: instance method of Now
See: https://zeit.co/api#get-endpoint

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID of deployment |

Resolves to the deployment object.

now.createDeployment({token, data}) ⇒ Promise

Creates a new deployment and returns its data.

Kind: instance method of Now
See: https://zeit.co/api#instant-endpoint

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | data | Object | The keys should represent a file path, with their respective values containing the file contents. |

Resolves to the deployment object.

now.deleteDeployment({token, id}) ⇒ Promise

Deletes a deployment and returns its data.

Kind: instance method of Now
See: https://zeit.co/api#rm-endpoint

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID of deployment |

Resolves to the deployment object.

now.getFiles({token, id}) ⇒ Promise

Returns an array with the file structure.

Kind: instance method of Now
See: https://zeit.co/api#file-structure-endpoint

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID of deployment |

Resolves to an array with the file structure.

now.getFile({token, id, fileId}) ⇒ Promise

Returns the content of a file either as string or object, depending on the filetype.

Kind: instance method of Now
See: https://zeit.co/api#file--endpoint

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID of deployment | | fileId | String | ID of the file |

Resolves to either a String or an Object of the file's content.

now.getDomains({token}) ⇒ Promise

Returns an array with all domain names and related aliases.

Kind: instance method of Now See: https://zeit.co/api#get-domains

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token |

Resolves to an array with all domain names and related aliases.

now.addDomain({token, domain}) ⇒ Promise

Adds a new domain and returns its data.

Kind: instance method of Now See: https://zeit.co/api#post.domains

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | domain | object | An object containing a string name and a boolean isExternalDNS |

Resolves to an object with the domain's data.

now.deleteDomain({token, name}) ⇒ Promise

Deletes a domain name.

Kind: instance method of Now See: https://zeit.co/api#delete-domains

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | name | String | Domain name |

now.getDomainRecords({token, domain}) ⇒ Promise

Returns an array with all DNS records configured for a domain name.

Kind: instance method of Now See: https://zeit.co/api#get-domain-records

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | name | String | Domain name |

Resolves to an array with all DNS records configured for a domain name.

now.addDomainRecord({token, domain, recordData}) ⇒ Promise

Adds a new DNS record for a domain.

Kind: instance method of Now See: https://zeit.co/api#post-domain-records

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | domain | object | An object containing a string name and a boolean isExternalDNS | | recordData | object | An object containing a description of the new record according to the documentation. |

now.deleteDomainRecord({token, name, recordId}) ⇒ Promise

Deletes a DNS record associated with a domain.

Kind: instance method of Now See: https://zeit.co/api#delete-domain-records

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | domain | String | Domain name | | recordId | String | Record ID |

now.getCertificates({token, [cn]}) ⇒ Promise

Returns an array of all certificates.

Kind: instance method of Now See: https://zeit.co/api#get-certs

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | [cn] | String | Common Name |

Resolves to an array of all certificates.

now.createCertificate({token, cn}) ⇒ Promise

Creates a new certificate for a domain registered to the user.

Kind: instance method of Now See: https://zeit.co/api#post-certs

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | cn | String | Common Name |

now.renewCertificate({token, cn}) ⇒ Promise

Renews an existing certificate.

Kind: instance method of Now See: https://zeit.co/api#post-certs

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | cn | String | Common Name |

now.replaceCertificate({token, cn, cert, key, [ca]}) ⇒ Promise

Replace an existing certificate.

Kind: instance method of Now See: https://zeit.co/api#put-certs

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | cn | String | Common Name | | cert | String | X.509 certificate | | key | String | Private key for the certificate | | ca | String | CA certificate chain |

Resolves to an object with the new certificate details.

now.deleteCertificate({token, cn}) ⇒ Promise

Deletes a certificate.

Kind: instance method of Now See: https://zeit.co/api#delete-certs

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | cn | String | Common Name |

now.getAliases({token, [id]}) ⇒ Promise

Returns an array with all aliases.

Kind: instance method of Now
See: https://zeit.co/api#user-aliases

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | [id OR callback] | String | function | ID of deployment or callback |

Resolves to an array with all aliases.

now.createAlias({token, id, alias}) ⇒ Promise

Creates an alias for the given deployment.

Kind: instance method of Now
See: https://zeit.co/api#create-alias

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID of deployment | | alias | String | Hostname or custom url for the alias |

Resolves to an Object with the alias data

now.deleteAlias({token, id}) ⇒ Promise

Deletes an alias and returns a status.

Kind: instance method of Now
See: https://zeit.co/api#delete-user-aliases

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID of alias |

Resolves to the status

now.getSecrets({token, id}) ⇒ Promise

Returns an array with all secrets.

Kind: instance method of Now
See: https://zeit.co/api#get-now-secrets

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | [id OR callback] | String | function | ID of deployment or callback |

Resolves to an array with all secrets.

now.createSecret({token, name, value}) ⇒ Promise

Creates a secret and returns its ID.

Kind: instance method of Now
See: https://zeit.co/api#post-now-secrets

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | name | String | name for the secret | | value | String | value for the secret |

Resolves to a secret's ID.

now.renameSecret({token, id, name}) ⇒ Promise

Changes the name of the given secret and returns its ID and name.

Kind: instance method of Now
See: https://zeit.co/api#patch-now-secrets

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | id or name of the secret | | name | String | new name for the secret |

Resolves to a secret's ID and name.

now.deleteSecret({token, id}) ⇒ Promise

Deletes a secret and returns its ID.

Kind: instance method of Now
See: https://zeit.co/api#delete-now-secrets

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token | | id | String | ID or name of the secret |

Resolves to a secret's status.

now.getEvents({token}) ⇒ Promise

Get the latest events happened in your team.

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token |

Resolves to an array of events.

now.getUser({token}) ⇒ Promise

Get the info of user with the provided token

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token |

Resolves to a user object.

now.getTeams({token}) ⇒ Promise

Get the teams that are related to the given token.

| Param | Type | Description | | --- | --- | --- | | token | String | Your ZEIT token |

Resolves to an array of teams.

License

See License.