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

action-flow

v2.3.0

Published

Smart mutex manager.

Downloads

7

Readme

just-mongo

Action flow 2.3

Smart mutex manager.

Example

You can pause the user's requests until the user's previous request is executed.

How it works?

1) Connect and configure the action-flow

// commonJS
const AF = require('action-flow').default(options);
// es modules
import AFCreator from 'action-flow';
const AF = AFCreator(options);

2) Describe the operation. Any objects will accepted to describing.

const userRequestFlow = AF.create({
  description: 'user-request',
  userId,
});

Or you can create a common thread for any threads.

const anyFlow = AF.multi([
  {one: 1}, {two: 2},
]);

This way, only one client can executing these two operations at a time.

The thread of two operations will not start until these two threads of these operations are free. The expectation of a stream occurs sequentially to avoid deadlocks.

3) Set the waiting the operation.

await userRequestFlow.await();

4) Do your code.

// execute user request code

5) Set the ending the operation.

await userRequestFlow.end();

Drivers & Custom drivers

At now the action-flow have 3 drivers. To use specific driver, use driverName option.

  • redis (default)
  • process
  • mongodb (just-mongo library is dev dependency, install that to use)

About each of drivers

redis

Queue storage in Redis lists.

Options (optional): host, port, password.

const AF = require('action-flow')({
  host: 'localhost',
  password: 'yourPwd',
});

process

Storage in Node.js process memory. No specific options.

const AF = require('action-flow')({
  driverName: 'process',
});

mongodb

MongoDB storage.

Options (optional): user, password, host, port.

const AF = require('action-flow')({
  host: 'localhost',
});

Use driverClass option to connect custom driver.

const AF = require('action-flow')({
  driverName: 'custom',
  driverClass: someClass,
});

More options

| Name | Description | Required | Default | |----------------- |---------------------- |:--------: |:-------: | | awaitTimeoutSec | Maximum waiting time | false | 60 | | sessionName | Prefix for all descriptions | false | null | | noSHA | Turn off sha256 for description | false | false |

Other docs: