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

wt-cli

v12.2.0

Published

Webtask Command Line Interface

Downloads

655

Readme

Webtask CLI: all you need is code

Command line tool for using webtasks to create microservices in seconds.

Setup

$ npm i -g wt-cli
$ wt init

Usage

Create a webtask

Write webtask code to the hello-world.js file:

module.exports = function (cb) {
  cb(null, 'Hello webtasks!');
}
wt create hello-world.js

and call it...

curl https://webtask.it.auth0.com/api/run/{yours}/hello-world

Create a webtask (from a public URL)

wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/html-response.js \
          --name html-response-url

Create a webtask with a secret

wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js \
          --name mongo \
          --secret MONGO_URL=mongodb://webtask:[email protected]:47592/webtask-examples

This is a real mongodb URL (powered by mongolab), no guarantee that it will work :)

Create a webtask that integrates with express.js

wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/express.js \
          --name express \
          --dependency express \
          --dependency body-parser

Log streaming

wt logs

Cron a webtask (long running)

wt cron schedule -n mongocron \
                 -s MONGO_URL=mongodb://webtask:[email protected]:47592/webtask-examples \
                 "*/10 * * * *" \
                 https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js

This cron will insert a document in a mongo collection every 10 minutes

Get cron history

wt cron history mongogron

Get all scheduled webtasks

wt cron ls

Auth0 CLI: extend Auth0 with custom code (BETA)

Auth0 hooks enable you to extend the Auth0 platform with custom code. Auth0 CLI allows you to manage Auth0 hooks for your Auth0 account.

Auth0 hooks are webtasks associated with specific extensibility points of the Auth0 platform that are invoked by Auth0 runtime to execute your custom logic.

Setup

Follow the instructions from the Account > Webtasks panel on the Auth0 management dashboard to install and configure wt-cli. The package now includes auth0 binary in addition to wt.

NOTE While Auth0 CLI is in BETA, the wt-cli tool must be installed from a branch of this repository instead of the public npm registry. Use npm i -g auth0/wt-cli#auth0 to install the tool. The rest of the instructions on the Auth0 management portal applies without changes.

Overview

Auth0 CLI allows you to create, list, enable/disable, edit, and remove Auth0 hooks associated with specific extensibility points within the Auth0 platform, as well as receive real-time logging information generated by custom code.

The list of supported extensibility points will be growing over time. Currently, the following extensibility points are supported:

client-credentials-exchange password-exchange pre-user-registration post-user-registration

For each of the extensibility points, there can be several Auth0 hooks created. A hook can be enabled or disabled, but only up to one hook per extensibility point can be enabled at a time. Disabled hooks are useful for staging new functionality.

Synopsis

The script below assumes you are creating an Auth0 hook for the pre-user-registration extensibility point using profile name tj-default. You can use any of the extensibility points listed above and the actual profile name has been provided to you during wt-cli setup.

# Scaffold sample code of an Auth0 hook:
auth0 scaffold -t pre-user-registration > file.js

# Create a new, disabled Auth0 hook:
auth0 create -t pre-user-registration --name my-extension-1 -p tj-default file.js

# Edit code of the Auth0 hook:
auth0 edit my-extension-1

# Enable the newly created extensibility point (all other hooks associated
# with the same extensibility point will be disabled):
auth0 enable my-extension-1 -p tj-default

# List hooks for a specific extensibility point:
auth0 ls -t pre-user-registration -p tj-default

# List all Auth0 hooks on your account:
auth0 ls -p tj-default

# Access streaming, real-time logs of all of your hooks:
auth0 logs -p tj-default

# Disable a hook:
auth0 disable my-extension-1 -p tj-default

# Delete a hook:
auth0 rm my-extension-1 -p tj-default

Closing remarks

Working behind a proxy

wt-cli supports operating behind a proxy as of v6.1.0. The cli relies on the HTTP_PROXY (or http_proxy) environment variable to determine if proxy support needs to be enabled. The HTTP_PROXY environment variable must be set to a uri according to the following table:

| Protocol | Proxy Agent for http requests | Proxy Agent for https requests | Example |:----------:|:-------------------------------:|:--------------------------------:|:--------: | http | http-proxy-agent | https-proxy-agent | http://proxy-server-over-tcp.com:3128 | https | http-proxy-agent | https-proxy-agent | https://proxy-server-over-tls.com:3129 | socks(v5)| socks-proxy-agent | socks-proxy-agent | socks://username:[email protected]:9050 (username & password are optional) | socks5 | socks-proxy-agent | socks-proxy-agent | socks5://username:[email protected]:9050 (username & password are optional) | socks4 | socks-proxy-agent | socks-proxy-agent | socks4://some-socks-proxy.com:9050 | pac | pac-proxy-agent | pac-proxy-agent | pac+http://www.example.com/proxy.pac

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.