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

@low-systems/cloud-tasks-doer

v1.1.91

Published

A Google Cloud Tasks doer for low

Downloads

70

Readme

Cloud Tasks Doer

A Google Cloud Tasks Doer for low

Important setup required for unit tests to work

As this doer's whole schtick is to talk to a Google Cloud Tasks instance, testing it is a little hard without some configuration from you. Unfortunately - as of 2019-11-14 - there is no Cloud Tasks emulator and obviously we're not going to leave our client details and credentials in a public Git repository so you'll need to setup two files for the unit tests to run. Both of these files sit in a directory at the root of this module called ./configuration.

THESE TESTS WILL CONNECT TO A CLOUD TASKS INSTANCE AND CREATE AND MANIPULATE QUEUES. DON'T CONNECT THIS TO AN IMPORTANT PRODUCTION ENVIRONMENT WHERE THEY MIGHT OVERWRITE SOMETHING IMPORTANT

client.secrets.ts

All tests will use a Cloud Tasks Client named test-client and it's configuration is taken from this file. It's schema can be taken from here. This Doer will insert credentials from the environment secrets so please omit them from your configuration. Remember that all these options are optional.

You also cannot use the options.promise property as it expects a function which replaces the native Node.JS promise handler. low's purpose is to be purely configuration based and as such expects certain things about your Node.JS environment. One of these things is that native Promises can be used. I'm sure there is a way of mucking about with Typescript compiler settings to shim your own Promise handler but that is outside of the scope of low.

It might look a little something like this

export default {
  "options": {
    "projectId": "my-awesome-project",
    "apiEndpoint": "my-awesome-app.com"
  }
};

secrets.json

This is the file that is loaded by jest to act as your environment secrets (see low documentation on secrets). Obviously you won't want to stick private keys and other credentials in your main environment configuration and this doer will load Cloud Tasks Client's credentials from environment secrets. If you really wanted too you can store your credentials in the doer's configuration but it is not recommended. For the purposes of testing we want to make sure that credentials can be loaded from secrets.

This file should look like this

export default {
  "modules": {
    "CloudTasksDoer": {
      "clientCredentials": {
        "test-client": {
          "client_email": "[email protected]",
          "private_key": "Not going to come up with a dummy private key to go here"
        }
      }
    }
  }
};