{"id":19534646,"url":"https://github.com/buttercup/channel-queue","last_synced_at":"2025-09-01T04:42:27.032Z","repository":{"id":51147539,"uuid":"107671207","full_name":"buttercup/channel-queue","owner":"buttercup","description":"A queue management library with channels","archived":false,"fork":false,"pushed_at":"2024-12-11T16:01:18.000Z","size":693,"stargazers_count":6,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-25T07:21:05.110Z","etag":null,"topics":["buttercup","channel","channels","promise-queue","queue","queues"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buttercup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-20T11:42:22.000Z","updated_at":"2024-12-11T16:01:28.000Z","dependencies_parsed_at":"2023-11-16T15:02:47.514Z","dependency_job_id":"d55fba3f-c9d4-4e3f-a654-76eeb7724d95","html_url":"https://github.com/buttercup/channel-queue","commit_stats":{"total_commits":76,"total_committers":4,"mean_commits":19.0,"dds":"0.11842105263157898","last_synced_commit":"5b5bd8adbde145a4ca7a1c68f46f925d85501ff5"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/buttercup/channel-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fchannel-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fchannel-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fchannel-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fchannel-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buttercup","download_url":"https://codeload.github.com/buttercup/channel-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fchannel-queue/sbom","scorecard":{"id":259239,"data":{"date":"2025-08-11","repo":{"name":"github.com/buttercup/channel-queue","commit":"77903c4123db96d8ae73137c98dc1535e01502ef"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/buttercup/channel-queue/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/buttercup/channel-queue/test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T10:25:12.797Z","repository_id":51147539,"created_at":"2025-08-17T10:25:12.797Z","updated_at":"2025-08-17T10:25:12.797Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273075802,"owners_count":25041257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buttercup","channel","channels","promise-queue","queue","queues"],"created_at":"2024-11-11T02:14:57.502Z","updated_at":"2025-09-01T04:42:26.964Z","avatar_url":"https://github.com/buttercup.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# channel-queue\nA queue management library with channels.\n\n![Tests status](https://github.com/buttercup/channel-queue/actions/workflows/test.yml/badge.svg) [![npm version](https://badge.fury.io/js/%40buttercup%2Fchannel-queue.svg)](https://www.npmjs.com/package/@buttercup/channel-queue)\n\n## About\n\nThis library provides a queue system, organised by channels (or \"topics\"), that allows for finer-grain control over asynchronous method execution. It allows for queuing tasks by channels (string-based names) - tasks executing sequentially when the previous task is done. It also allows for 3 priority levels : **normal**, **high** and **tail**.\n\nCheck out the [API documentation](API.md).\n\n## Installation\n\nSimply run:\n\n```shell\nnpm install @buttercup/channel-queue --save\n```\n\n## Usage\nThe simplest usage is to just queue some tasks:\n\n```typescript\nimport { ChannelQueue } from \"@buttercup/channel-queue\";\n\nconst queue = new ChannelQueue();\nconst work = queue.channel(\"myChannel\").enqueue(() =\u003e 123);\n// 'work' will resolve with 123\n\nconst someChannel = queue.channel(\"someChannel\");\nsomeChannel.enqueue(job1);\nsomeChannel.enqueue(job2);\nsomeChannel.enqueue(job3);\n```\n\nYou can push tasks above others by setting them as high-priority:\n\n```typescript\nimport { ChannelQueue, TaskPriority } from \"@buttercup/channel-queue\";\n\nconst queue = new ChannelQueue();\nconst workChannel = queue.channel(\"work\");\n// some other tasks added to the queue...\nworkChannel.enqueue(importantJobMethod, TaskPriority.High).then(result =\u003e {\n    // 'result' is the resolved result from the 'importantJobMethod' function\n});\n```\n\nTasks can also be run as \"low\" priority or at the **tail** end of the queue:\n\n```typescript\nimport { ChannelQueue, TaskPriority } from \"@buttercup/channel-queue\";\n\nconst queue = new ChannelQueue();\nconst workChannel = queue.channel(\"work\");\n// some other tasks added to the queue...\nworkChannel.enqueue(runNearEnd, TaskPriority.Tail);\n```\n\n### Error Handling\n\nRegardless whether an enqueued task fails or not, the channel will continue processing after it's done.\n\nBy default, if the task enqueued in `enqueue` throws an error, it will throw at the `enqueue` call:\n\n```typescript\n// The following throws:\nawait channel.enqueue(() =\u003e Promise.reject(new Error(\"Fails!\")));\n```\n\nYou can disable enqueued functions throwing errors by setting `tasksThrow` to `false`:\n\n```typescript\nchannel.tasksThrow = false;\n// The following will not throw:\nawait channel.enqueue(() =\u003e Promise.reject(new Error(\"Fails!\")));\n```\n\nDisabling this is really only useful if you use `waitForEmpty` with the `throwForFailures` set to `true`. This allows you to delay error handling until the channel is waited upon:\n\n```typescript\nchannel.tasksThrow = false;\nchannel.enqueue(() =\u003e /* ... */)\nchannel.enqueue(() =\u003e Promise.reject(new Error(\"Fails!\")));\n\n// Later:\nawait channel.waitForEmpty({ throwForFailures: true });\n```\n\n### Stacking\nItems can be \"stacked\", meaning that if specified, items can be limited to only 1 pending item in queue. All items of the same stack _name_ would simply queue on the same item and not create more tasks. The stack can be specified when enqueuing:\n\n```typescript\nimport { ChannelQueue } from \"@buttercup/channel-queue\";\n\nconst queue = new ChannelQueue();\nconst workChannel = queue.channel(\"work\");\n\nconst promise1 = workChannel.enqueue(saveWorkFn, undefined, /* Stack ID */ \"save\");\n// work start\nconst promise2 = workChannel.enqueue(saveWorkFn, undefined, \"save\");\nconst promise3 = workChannel.enqueue(saveWorkFn, undefined, \"save\");\n// promise2 and promise3 will be equal, as promise2 was still in the queue when promise3\n```\n\n### Parallel Execution\nTasks can be run in parallel using the `ParallelChannel` class. You can create a parallel channel, in place of a regular channel, by calling `ChannelQueue#createParallelChannel`:\n\n```typescript\nimport { ChannelQueue } from \"@buttercup/channel-queue\";\n\nconst queue = new ChannelQueue();\nconst workChannel = queue.createParallelChannel(\"work\");\nworkChannel.enqueue(someTask);\n\n// The same channel can be fetched later using the familiar channel() method:\nqueue.channel(\"work\"); // The parallel channel\n```\n\nParallel channels, like their name implies, can run tasks in parallel. Instead of running them head-to-tail like regular channels, parallel channels can execute many tasks side-by-side. You can also limit them to a certain number of _threads_ (default is 2) by calling `queue.createParallelChannel(\"name\", 5)` (where `5` is the maximum number of simultaneous tasks).\n\nParallel channels by default do not run tasks of different priorities simultaneously. This means that if the current running tasks are high-priority, no normal priority tasks will be started. This feature can be disabled by running `parallelChannel.canRunAcrossTaskTypes = true`.\n\n### Waiting and Clearing\n\nYou can wait for a channel to empty (having all tasks completed) by using `waitForEmpty`:\n\n```typescript\nchannel.enqueue(someTask);\nchannel.enqueue(someTask);\n\n// Later:\nawait channel.waitForEmpty();\n```\n\nYou can clear all enqueued items in a `Channel` by calling `clear()`:\n\n```typescript\nqueue.channel(\"myChannel\").clear();\n```\n\n## Development \u0026 Supported Node Versions\nThis library is intended to be used with NodeJS version **6** and later.\n\nTo contribute, clone this project and run `npm install` before beginning development.\n\nTo test, simply run `npm test`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuttercup%2Fchannel-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuttercup%2Fchannel-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuttercup%2Fchannel-queue/lists"}