Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bullish

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bullish

A nice bull queue interface for hapi.

  • 0.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bullish

Usage

server.bullish.job({
  name: 'add5',
  handler: (job) => {
    // do job logic here, return a promise!
    return Promise.resolve(job.data + 5);
  },
  config: {
    validate: joi.number(),
  }
}, next);

bullish.job(options, [callback])

Defines a new job queue.

Has the following parameters:

  • options
    • name – the queue name
    • handler – the handler that will be called
    • config – a optional config object containing:
      • validate – a joi schema, used for input validation
      • concurrency – the max. concurrency for the handler (on a single process)
      • preExperimental: an array of functions that will be called before the handler. Have to return Promises or be synchronous.
      • routes – configure auto generated routes, can be one of
        • Boolean: false – disable auto route generation
        • Array: ['create', 'status', 'simulate'] – Toggle specific routes to be generated
  • callback – a optional function called, when the queue is ready to be used.
server.bullish.job({
  name: 'squareAll',
  handler: (job) =>  job.data.map(num => num * num + job.pre[0]),
  config: {
    concurrency: 5,
    pre: [ () => 0 ],
    validate: joi.array().items(joi.number()).required(),
  }
});

bullish.add(jobName, [data], [options])

Adds a new job to the queue. Analog to bulls queue.add, but with validation.

Has the following options:

  • data – the data passed to the handler in job.data.
  • options – all bull options and an extra validate option, to toggle validation.
    • validateBoolean: toggles input validation
server.bullish.add('sum', { a: 5, b: 10 }, { validation: false });

bullish.inject(jobName, [data], [options])

can be used for testing or simulation. Returns a promise.

Has the following parameters:

  • data – the data passed to the handler in job.data.
  • options – object of options:
    • pre – an optional array of precalculated results to use instead of the defined job pre middleware.
    • validation – disables input validation inside the job
bullish.inject(jobName, { name: 'Max', email: 'max@example.com' }, {
  pre: [ 5 ],
  validation: false,
});

FAQs

Package last updated on 02 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc