{"id":46343,"library":"sequential-task-queue","title":"SequentialTaskQueue","description":"FIFO task queue for Node.js and browser that executes asynchronous tasks in strict order. Version 1.2.1 is stable, with infrequent updates. Supports promises, timeouts, and task cancellation via CancellationToken. Differentiators include simple API, cancellation of queued/active tasks, and error handling that continues execution. Ships TypeScript types.","status":"active","version":"1.2.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/BalassaMarton/sequential-task-queue","tags":["javascript","typescript"],"install":[{"cmd":"npm install sequential-task-queue","lang":"bash","label":"npm"},{"cmd":"yarn add sequential-task-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add sequential-task-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; named export.","wrong":"const SequentialTaskQueue = require('sequential-task-queue')","symbol":"SequentialTaskQueue","correct":"import { SequentialTaskQueue } from 'sequential-task-queue'"},{"note":"Exported for type usage, but typically not imported directly.","wrong":null,"symbol":"CancellationToken","correct":"import { CancellationToken } from 'sequential-task-queue'"},{"note":"TypeScript users can import the type separately.","wrong":null,"symbol":"SequentialTaskQueue type","correct":"import type { SequentialTaskQueue } from 'sequential-task-queue'"}],"quickstart":{"code":"import { SequentialTaskQueue } from 'sequential-task-queue';\n\nconst queue = new SequentialTaskQueue();\nqueue.push(() => console.log('first'));\nqueue.push(() => console.log('second'));\n// Output: first, second","lang":"typescript","description":"Create a FIFO queue and push two synchronous tasks that log in order."},"warnings":[{"fix":"Always attach a .catch() handler to the promise returned by push() to handle cancellation rejections.","message":"Cancelled tasks reject the returned promise, even if the task function does not check the CancellationToken.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware that timeout applies only to the execution duration; queue wait time is not counted.","message":"Timeout starts when the task execution begins, not when it is queued. This can lead to longer effective wait times if the queue is long.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Listen to the 'error' event: queue.on('error', (err) => console.error(err));","message":"The queue does not stop on promise rejection; it continues to the next task. Unhandled rejections may be missed if no 'error' event listener is attached.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use queue.push(task, { timeout: 1000 }) instead of queue.push(task, 1000).","message":"The push() API previously accepted a second argument as timeout number directly. That is now deprecated in favor of an options object with timeout property.","severity":"deprecated","affected_versions":">=1.1.0"}],"env_vars":null,"search_vec":"'1.2.1':17 'api':34 'asynchron':11 'browser':8 'cancel':28,35 'cancellationtoken':30 'continu':43 'differenti':31 'error':40 'execut':10,44 'fifo':2 'handl':41 'includ':32 'infrequ':21 'javascript':48 'node.js':6 'order':15 'promis':24 'queue':4 'queued/active':37 'sequentialtaskqueu':1 'ship':45 'simpl':33 'stabl':19 'strict':14 'support':23 'task':3,12,27,38 'timeout':25 'type':47 'typescript':46,49 'updat':22 'version':16 'via':29","created_at":"2026-06-07T12:59:28.108960+00:00","updated_at":"2026-06-07T12:59:28.108960+00:00","problems":[{"fix":"Use `import { SequentialTaskQueue } from 'sequential-task-queue'` instead of `const SequentialTaskQueue = require('sequential-task-queue')`.","cause":"Importing a CommonJS-style require when package is ESM-only.","error":"TypeError: class_1.default is not a constructor"},{"fix":"Attach a .catch() to the push() promise, or use the 'error' event on the queue.","cause":"Cancelling a task causes the promise to reject with an error. Not catching it leads to unhandled rejection.","error":"Error: Task cancelled"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/BalassaMarton/sequential-task-queue#readme","github":"ssh://git@github.com/BalassaMarton/sequential-task-queue","docs":null,"changelog":null,"pypi":null,"npm":"sequential-task-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}