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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@superqueues/sdk

v0.1.1

Published

JavaScript SDK for SuperQueues gateway - HTTP and WebSocket support

Readme

@superqueues/sdk

JavaScript SDK for the SuperQueues gateway. Supports both HTTP (pull-based) and WebSocket (push-based) modes.

Installation

npm install @superqueues/sdk

For WebSocket support in Node.js, also install ws:

npm install ws

Quick Start

HTTP Mode (Pull-based)

const { createClient } = require('@superqueues/sdk');

const client = createClient({
  baseUrl: 'http://localhost:3000',
  apiKey: 'sqk_your_api_key',
});

// Publish a message
const { jobId } = await client.publish('orders.created', {
  orderId: 'ORD-123',
  total: 99.99,
});

// Pull messages
const messages = await client.pull('orders.created', { maxMessages: 5 });

for (const msg of messages) {
  try {
    await processOrder(msg.payload);
    await client.ack('orders.created', msg.receiptId);
  } catch (err) {
    await client.nack('orders.created', msg.receiptId, {
      action: 'retry',
      reason: err.message,
    });
  }
}

WebSocket Mode (Push-based)

const { createClient } = require('@superqueues/sdk');

const client = createClient({
  baseUrl: 'ws://localhost:3000',
  apiKey: 'sqk_your_api_key',
  mode: 'ws',
});

await client.connect();

// Subscribe to receive messages
client.subscribe('orders.created', async (msg, { ack, nack }) => {
  try {
    await processOrder(msg.payload);
    await ack();
  } catch (err) {
    await nack({ action: 'retry', reason: err.message });
  }
});

// Publish still works
await client.publish('orders.created', { orderId: 'ORD-456' });

API Reference

createClient(options)

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | required | Gateway URL | | apiKey | string | required | API key | | mode | 'http' \| 'ws' | 'http' | Transport mode | | timeout | number | 30000 | Request timeout (ms) | | reconnect | boolean | true | Auto-reconnect (WS) |

Methods

publish(queue, payload, options?)

Publish a message to a queue.

const { jobId, messageId } = await client.publish('my-queue', { data: 'value' }, {
  correlationId: 'req-123',
  headers: { 'x-custom': 'header' },
});

pull(queue, options?) (HTTP only)

Pull messages from a queue.

const messages = await client.pull('my-queue', {
  maxMessages: 10,
  visibilityTimeoutMs: 30000,
});

ack(queue, receiptId)

Acknowledge a message.

await client.ack('my-queue', msg.receiptId);

nack(queue, receiptId, options?)

Negative-acknowledge a message.

await client.nack('my-queue', msg.receiptId, {
  action: 'retry', // 'requeue' | 'retry' | 'dlq'
  reason: 'Processing failed',
});

subscribe(queue, handler) (WS only)

Subscribe to receive messages.

const unsubscribe = client.subscribe('my-queue', async (msg, { ack, nack }) => {
  // Process message
  await ack();
});

// Later: unsubscribe();

admin()

Get admin client for management operations (requires admin scope).

const admin = client.admin();

// List queues with stats
const { queues } = await admin.listQueues();

// Start a consumer
await admin.startConsumer('my-queue');

// Requeue from DLQ
await admin.requeueFromDlq('my-queue', ['job-id-1', 'job-id-2']);

Events (WS mode)

client.on('connected', () => console.log('Connected'));
client.on('disconnected', (reason) => console.log('Disconnected:', reason));
client.on('reconnecting', (attempt) => console.log('Reconnecting...', attempt));
client.on('error', (err) => console.error('Error:', err));

Error Handling

const { SuperQueuesError, ErrorCodes } = require('@superqueues/sdk');

try {
  await client.publish('queue', data);
} catch (err) {
  if (err instanceof SuperQueuesError) {
    console.log(err.code);   // e.g., 'UNAUTHORIZED'
    console.log(err.status); // e.g., 401
  }
}

Message Shape

{
  receiptId: 'uuid',       // For ack/nack
  messageId: 'uuid',       // Unique message ID
  jobId: 'uuid',           // Job ID in gateway
  payload: { ... },        // Your data
  headers: { ... },        // Custom headers
  attempt: 1,              // Delivery attempt
  enqueuedAt: 'ISO8601',   // Enqueue timestamp
}

License

MIT