Registry / devops / workers-pipeline

workers-pipeline

JSON →
library0.0.1jsnpmunverified

A minimal wrapper around the 'queue' library providing QueueWorker and WorkersPipeline classes for limiting concurrent async operations. Current version 0.0.1 (pre-1.0). Lightweight, TypeScript-friendly. Wraps jessetane/queue, adds class-based worker pattern. Intended for simple job queues with concurrency control, but the API is minimal and the package is very early stage.

npm install workers-pipeline
INSTALL
IMPORT
SIG · WORKERS-PIPELINE
W
workers-pipeline
devopsjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

QueueWorker
✓ import { QueueWorker } from 'workers-pipeline'
✗ const QueueWorker = require('workers-pipeline').QueueWorker
Package is ESM/CJS hybrid, named export.
WorkersPipeline
✓ import { WorkersPipeline } from 'workers-pipeline'
✗ import WorkersPipeline from 'workers-pipeline'
Default import does not work; named export only.
QueueWorker (type only)
✓ import type { QueueWorker } from 'workers-pipeline'
When using QueueWorker as base class in TypeScript, you can import type to avoid bundling runtime dependency.

Shows how to define a custom QueueWorker subclass with payload, create a WorkersPipeline with concurrency limit 2, push workers, and await completion.

import { QueueWorker, WorkersPipeline } from 'workers-pipeline' class HardWorker extends QueueWorker { private payload: any constructor(payload: any) { super() this.payload = payload } protected async call(that: HardWorker) { // Process this.payload console.log(this.payload) } } const pipeline = new WorkersPipeline(2) pipeline.push(new HardWorker({ url: 'https://example.com' })) pipeline.push(new HardWorker({ url: 'https://example.org' })) await pipeline.start() console.log('All workers done')
Debug
Known issues
breakingThe package is at version 0.0.1 – no stability guarantees; API may change at any time.
fix
Pin version and test upgrades.
affects: 0.0.1
gotchaThe call method receives 'that' as a parameter, not 'this' – this can cause confusion if you rely on 'this' context.
fix
Use the 'that' parameter or bind methods correctly.
affects: >=0.0.1
gotchaWorkersPipeline.push does not return anything; no error handling for duplicate pushes or pipeline already started.
fix
Manage pipeline state manually; ensure start() is called only once.
affects: >=0.0.1
missingNo documentation on error handling – if a worker throws, the pipeline may hang or reject unexpectedly.
fix
Wrap await pipeline.start() in try/catch and handle errors per worker.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'queue'
Missing peer dependency 'queue'
fix
npm install queue --save
TypeError: pipeline.start is not a function
Importing WorkersPipeline incorrectly (default import instead of named)
fix
Use import { WorkersPipeline } from 'workers-pipeline'
TypeError: Cannot read property 'payload' of undefined
In call(that), 'that' is undefined because super() not called or constructor missing
fix
Ensure constructor calls super() and assigns this.payload
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
queuerequiredruntime dependency for underlying queue implementation
Agent activity
24 hits · last 30 days
node
22
Resources
workers-pipeline — npm install workers-pipeline · libregistry