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 🙏

© 2025 – Pkg Stats / Ryan Hefner

chat-app-workers

v1.1.3

Published

This app uses bull.js with is Redis-based queue for Node.

Downloads

11

Readme

CHAT APP WORKERS

This app uses bull.js with is Redis-based queue for Node.

STRUCTURE

The main goal is to communicating with external services (slack, autopilot, etc...). This lead to specific structure, made of different queues specific for each service. To call it just return object with queue value equal to corespondent queue name and data as object with method and params.

How to use

Facing all over again same issues we decide to put all hard logic into sequence factory. This allow to build speed up the process of adding new jobs. Let's take a look into this:

CLI

At first install cli:

npm i chat-app-workers-cli -g

and then call generate-workers name, where name is desire name of directory to be created and follow up with selecting type of your new queue.

File structure

generate-workers command will create a directory with 3 files. You need to interact with all of it. At first set name for queue in index.js file. This should be imported from @autopilot/chat-app-core. You don't need to worry about importing it. It'll be done automatically. Then, modify you eventListener.js file if you need any event to catch. Then you are ready to go and write main content inside `processors.js' file.

The processors.js file should be structure this way:

module.exports = {
    // __default__ is key word to name first function to call in queue.
    // All functions takes two arguments, _job_  and _app_ if needed.
    __default__: (job, app) => {
      return {
        queue: queues.slack.name, // if queue is set it will add job with job.data to that queue.
        // Otherwise it will try to add job to self (if nextStep is set)
        params: {
          method: 'chat.postMessage', // method that will be called in queue, with params 
          params: { token: 'xxx' }
        },
        extraData: {
          name: 'name' // this will extend job.data that will be passed to next step (if nextStep is set)
        },
        nextStep: 'secondStep' // next method in THIS queue that will be called
      }
    },
    secondStep: (job) => {
      console.log(job.data) // will have name === 'name' as we passed it in previous extraData value.
      const { res } = job.data // res from external will be passed to job.data in res key.

      return {
        queue: queues.slack.name, // if queue is set it will add job with job.data to that queue.
        // Otherwise it will try to add job to self (if nextStep is set)
        params: {
          method: 'chat.delete', // method that will be called in queue, with params 
          params: {
            token: 'xxx',
            channel: '1',
            ts: '123'
          },
        }
      }
    //this will be last step as nextStep is not set
    }
}