{"id":44530,"library":"callq","title":"callq","description":"callq is a lightweight, zero-dependency async call queue library for Node.js that provides a state machine-like execution of ordered asynchronous operations with support for branch, jump, sub-procedures, loops, forks, and timeouts. Current version 1.0.7 (maintained as of 2023). It differentiates itself by offering a flexible queue structure with sync/async operators, label-based routing, and procedural control flows (if, loop, fork, join) while remaining simple and small. The library uses an error-data-queue callback convention and supports both synchronous returns and asynchronous callbacks via que.next() or que.wait().","status":"active","version":"1.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/adf0001/callq","tags":["javascript","call","queue","async"],"install":[{"cmd":"npm install callq","lang":"bash","label":"npm"},{"cmd":"yarn add callq","lang":"bash","label":"yarn"},{"cmd":"pnpm add callq","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"callq is CommonJS only; ESM import is not supported natively.","wrong":"import cq from 'callq';","symbol":"default (main module)","correct":"const cq = require('callq');"},{"note":"If available as named export; check docs. CommonJS destructuring works.","wrong":"import { CallQueue } from 'callq';","symbol":"CallQueue class","correct":"const CallQueue = require('callq').CallQueue;"},{"note":"callq does not include TypeScript declarations; use @types/callq if available or define your own.","wrong":"types are not shipped.","symbol":"type definitions (if any)","correct":"// No TypeScript types provided by the package."}],"quickstart":{"code":"var cq = require('callq');\n\nvar myObj = {\n  f1: function (error, data, que) {\n    console.log(data = \"1-label\");\n    setTimeout(function() { que.jump(null, data, \"f3\"); }, 50);\n  },\n  f2: function (error, data, que) {\n    console.log(data = data + \",2-end\");\n    setTimeout(function() { que.jump(null, data, \"f4\"); }, 50);\n  },\n  f3: function (error, data, que) {\n    console.log(data = data + \",3-label\");\n    setTimeout(function() { que.jump(null, data, \"f2\"); }, 50);\n  },\n  f4: function (error, data, que) {\n    var expect = \"1-label,3-label,2-end\";\n    if(data != expect) throw Error(\"expect (\" + expect + \") but (\" + data + \")\");\n    que.next(null, data);\n  },\n};\n\ncq(myObj, [\"f1\", \"f2\", \"f3\", \"f4\"]);","lang":"javascript","description":"This example shows how to create a queue with named operators, use que.jump to redirect execution flow, and define both synchronous and asynchronous operators."},"warnings":[{"fix":"Use require('callq') or wrap with createRequire in ESM.","message":"The package uses CommonJS only; ESM import may fail or require dynamic import().","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure async operators return undefined and call que.next() inside the callback.","message":"Operators must return undefined if they call que.next() asynchronously; otherwise the return value may be treated as data.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use .pick(':label') to invoke a sub-procedure.","message":"Label strings prefixed with ':' are treated as sub-procedures and skipped during normal processing; they must be explicitly picked via .pick().","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"N/A","message":"No major breaking changes documented; the API has remained stable since initial release.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.7':41 '2023':45 'async':9,100 'asynchron':25,91 'base':60 'branch':30 'call':10,98 'callback':83,92 'callq':1,2 'control':64 'convent':84 'current':39 'data':81 'depend':8 'differenti':47 'error':80 'error-data-queu':79 'execut':22 'flexibl':52 'flow':65 'fork':36,68 'javascript':97 'join':69 'jump':31 'label':59 'label-bas':58 'librari':12,76 'lightweight':5 'like':21 'loop':35,67 'machin':20 'machine-lik':19 'maintain':42 'node.js':14 'offer':50 'oper':26,57 'order':24 'procedur':34,63 'provid':16 'que.next':94 'que.wait':96 'queue':11,53,82,99 'remain':71 'return':89 'rout':61 'simpl':72 'small':74 'state':18 'structur':54 'sub':33 'sub-procedur':32 'support':28,86 'sync/async':56 'synchron':88 'timeout':38 'use':77 'version':40 'via':93 'zero':7 'zero-depend':6","created_at":"2026-06-07T12:50:35.460676+00:00","updated_at":"2026-06-07T12:50:35.460676+00:00","problems":[{"fix":"Use const cq = require('callq'); in CommonJS, or use dynamic import() in ESM: const cq = (await import('callq')).default;","cause":"Improper import: import cq from 'callq' in ESM. The package is CommonJS and exports a function directly.","error":"TypeError: cq is not a function"},{"fix":"Ensure you use que.jump or que.next appropriately to control the order of operations.","cause":"Operator f2 was called before f3 due to missing jump or incorrect flow. The example uses que.jump to reorder execution.","error":"Error: expect (1-label,3-label,2-end) but (1-label,2-end)"},{"fix":"Only call que.next() within an operator callback and ensure the parameter name matches.","cause":"Using que outside of an operator callback or misnaming the parameter. The 'que' parameter is only available inside operator functions.","error":"que.next is not a function"}],"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/adf0001/callq#readme","github":"https://github.com/adf0001/callq","docs":null,"changelog":null,"pypi":null,"npm":"callq","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}}