{"id":20390657,"url":"https://github.com/dizmo/functions-queued","last_synced_at":"2026-04-29T23:33:21.172Z","repository":{"id":34895966,"uuid":"186822603","full_name":"dizmo/functions-queued","owner":"dizmo","description":"dizmoFun: queued invocations","archived":false,"fork":false,"pushed_at":"2023-03-15T08:20:45.000Z","size":971,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-22T16:41:35.395Z","etag":null,"topics":["dizmo","function","invocation","javascript","library","queued","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@dizmo/functions-queued","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dizmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-15T12:33:17.000Z","updated_at":"2022-11-16T19:00:47.000Z","dependencies_parsed_at":"2023-01-15T10:02:03.827Z","dependency_job_id":null,"html_url":"https://github.com/dizmo/functions-queued","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/dizmo/functions-queued","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizmo%2Ffunctions-queued","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizmo%2Ffunctions-queued/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizmo%2Ffunctions-queued/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizmo%2Ffunctions-queued/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dizmo","download_url":"https://codeload.github.com/dizmo/functions-queued/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizmo%2Ffunctions-queued/sbom","scorecard":{"id":345616,"data":{"date":"2025-08-11","repo":{"name":"github.com/dizmo/functions-queued","commit":"e6c183072634c638a27c4d192f07472b02635e88"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":-1,"reason":"No tokens found","details":null,"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Code-Review","score":0,"reason":"Found 0/30 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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: ISC 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":"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":"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":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"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-18T06:57:41.721Z","repository_id":34895966,"created_at":"2025-08-18T06:57:41.722Z","updated_at":"2025-08-18T06:57:41.722Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32448400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dizmo","function","invocation","javascript","library","queued","typescript"],"created_at":"2024-11-15T03:26:09.754Z","updated_at":"2026-04-29T23:33:21.156Z","avatar_url":"https://github.com/dizmo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version](https://badge.fury.io/js/%40dizmo%2Ffunctions-queued.svg)](https://npmjs.org/package/@dizmo/functions-queued)\n[![Build Status](https://travis-ci.com/dizmo/functions-queued.svg?branch=master)](https://travis-ci.com/dizmo/functions-queued)\n[![Coverage Status](https://coveralls.io/repos/github/dizmo/functions-queued/badge.svg?branch=master)](https://coveralls.io/github/dizmo/functions-queued?branch=master)\n\n# @dizmo/functions-queued\n\nProvides two functions `queued` and `auto`, where the latter can *also* be accessed via `queued.auto`. The `queued` function takes as argument another function e.g. `fn`, which is then queued for execution. During its invocation `fn` receives an *extra* argument \u0026ndash; a `next` function \u0026ndash; which needs to be invoked within the body of `fn` to continue processing the queue.\n\nThe `queued` function creates a *separate* queue defined by the *name* of the provided function: This means that if multiple functions e.g. `f1` and `f2` need to be queued together, then they need to be *wrapped* with functions using the *same* name (e.g. `fn`). If *only* anonymous functions are provided then the internal queue is named with a random identifier.\n\n\u003e Functions with the *same* name will be put into the *same* queue, and class methods with the *same* class plus method name will also be put into the *same* queue!\n\nThe `auto` function takes a boolean flag and returns then a queue e.g. `qn` (for the provided function). If the flag is set to `true` then the queue start dequeueing immediately, and otherwise `qn.next` is required to be invoked to trigger dequeueing; by default `queued` starts dequeueing immediately.\n\nBoth the `queued` and `auto` functions accepts options, which enable dequeueing (a)synchronously and also support a mechanism to acquire and release (global) locks. By default dequeueing is performed synchronously without the usage of a lock. Also, an option to limit the maximum queue size can provided.\n\nFurther, by using a `@queued.decorator`, class methods can be decorated to turn them into queues, where the same naming rules as explained above apply. However, each method name is prepended with the corresponding class name; i.e. two methods with the same name but from to differently named classes will be put into to different queues.\n\nInstead of using the provided `next` function to continue dequeueing, the wrapped function can also return a promise for a truthy value. Also, the returned value can be accessed upon awaiting the promise returned by the invocation of the wrapped function.\n\n## Usage\n\n### Install\n\n```sh\nnpm install @dizmo/functions-queued --save\n```\n\n### Require\n\n```javascript\nconst { queued } = require('@dizmo/functions-queued');\n```\n\n### Examples (functions)\n\n```typescript\nimport { queued } from '@dizmo/functions-queued';\n```\n\n#### Dequeue with `next` (and `auto=true`):\n```typescript\nconst fn = queued(function fn(\n    n: number, next: Function\n) {\n    setTimeout(next, 200);\n});\n```\n\n```typescript\nfn(1); fn(2); const result = await fn(3);\n```\n\n#### Dequeue with `next` (and `auto=false`):\n```typescript\nconst qn = queued.auto(false)((\n    ...args: any[]\n) =\u003e {\n    const next = args.pop() as Function;\n    setTimeout(next, 200);\n});\n```\n\n```typescript\nqn(1); qn(1, 2); qn(1, 2, 3); qn.next();\n```\n\n#### Dequeue with `Promise` (and `auto=true`):\n```typescript\nconst gn = queued(function gn(\n    n: number\n) {\n    return Promise.resolve(true);\n});\n```\n\n```typescript\ngn(1); gn(2); const result = await gn(3);\n```\n\n#### Dequeue with `Promise` (and `auto=false`):\n```typescript\nconst qn = queued.auto(false)((\n    ...args: any[]\n) =\u003e {\n    return new Promise((resolve) =\u003e {\n        setTimeout(() =\u003e resolve(true), 200);\n    });\n});\n```\n\n```typescript\nqn(1); qn(1, 2); qn(1, 2, 3); qn.next();\n```\n\n### Examples (functions) with queue size\n\n#### Dequeue with `Promise` (and `size=0`):\n```typescript\nconst gn = queued(function gn(\n    n: number\n) {\n    return Promise.resolve(true);\n}, {\n    size: 0\n});\n```\n\n```typescript\ngn(1); // throws QueueError('full')\n```\n\n#### Dequeue with `Promise` (and `size=1`):\n```typescript\nconst gn = queued(function gn(\n    n: number\n) {\n    return Promise.resolve(true);\n}, {\n    size: 1\n});\n```\n\n```typescript\ngn(1); // throws QueueError('full')\n```\n\n#### Dequeue with `Promise` (and `size=2`):\n```typescript\nconst gn = queued(function gn(\n    n: number\n) {\n    return Promise.resolve(true);\n}, {\n    size: 2\n});\n```\n\n```typescript\ngn(1); gn(2); gn(3); // throws QueueError('full')\n```\n\n#### Dequeue with `Promise` (and `size=3`):\n```typescript\nconst gn = queued(function gn(\n    n: number\n) {\n    return Promise.resolve(true);\n}, {\n    size: 3\n});\n```\n\n```typescript\ngn(1); gn(2); gn(3); gn(4); // throws QueueError('full')\n```\n\n### Examples (functions) with locking\n\n#### Dequeue with `next` (and `auto=true`) plus a lock:\n```typescript\nconst fn = queued(function fn(\n    n: number, next: Function\n) {\n    setTimeout(next, 200);\n}, {\n    sync: true, // dequeue synchronously [default]\n    lock: {\n        // acquire (pseudo) lock [default]\n        acquire: () =\u003e Promise.resolve(true),\n        // release (pseudo) lock [default]\n        release: () =\u003e Promise.resolve(true)\n    }\n});\n```\n\n```typescript\nfn(1); fn(2); const result = await fn(3);\n```\n\n#### Dequeue with `Promise` (and `auto=false`) plus a lock:\n```typescript\nconst qn = queued.auto(false)((\n    ...args: any[]\n) =\u003e {\n    return new Promise((resolve) =\u003e {\n        setTimeout(() =\u003e resolve(true), 200);\n    });\n}, {\n    sync: false, // dequeue asynchronously [*not* default]\n    lock: {\n        // acquire (pseudo) lock [default]\n        acquire: () =\u003e Promise.resolve(true),\n        // release (pseudo) lock [default]\n        release: () =\u003e Promise.resolve(true)\n    }\n});\n```\n\n```typescript\nqn(1); qn(1, 2); qn(1, 2, 3); qn.next();\n```\n\n### Examples (class methods)\n\n```typescript\nimport { queued } from '@dizmo/functions-queued';\n```\n\n#### Dequeue with `next` (and `auto=true`):\n```typescript\nclass AClass {\n    @queued.decorator\n    public method(\n        n: number, next?: Function\n    ) {\n        if (next) setTimeout(next, 200);\n    }\n}\n```\n\n```typescript\nconst obj = new AClass();\n```\n\n```typescript\nobj.method(1); obj.method(2); const result = await obj.method(3);\n```\n\n#### Dequeue with `next` (and `auto=false`):\n```typescript\nclass BClass {\n    @queued.decorator(false)\n    public method(\n        n: number, next?: Function\n    ) {\n        if (next) setTimeout(next, 200);\n    }\n}\n```\n\n```typescript\nconst obj = new BClass();\n```\n\n```typescript\nobj.method(1); obj.method(2); obj.method(3); obj.method.next();\n```\n\n..where in **TypeScript** casting `obj.method` to `any` might be required to access the `next` method.\n\n#### Dequeue with `Promise` (and `auto=true`):\n```typescript\nclass CClass {\n    @queued.decorator\n    public method(\n        n: number\n    ) {\n        return Promise.resolve(true);\n    }\n}\n```\n\n```typescript\nconst obj = new CClass();\n```\n\n```typescript\nobj.method(1); obj.method(2); const result = await obj.method(3);\n```\n\n#### Dequeue with `Promise` (and `auto=false`):\n```typescript\nclass DClass {\n    @queued.decorator(false)\n    public method(\n        n: number\n    ) {\n        return Promise.resolve(true);\n    }\n}\n```\n\n```typescript\nconst obj = new DClass();\n```\n\n```typescript\nobj.method(1); obj.method(2); obj.method(3); obj.method.next();\n```\n\n..where in **TypeScript** casting `obj.method` to `any` might be required to access the `next` method.\n\n## Development\n\n### Clean\n\n```sh\nnpm run clean\n```\n\n### Build\n\n```sh\nnpm run build\n```\n\n#### without linting and cleaning:\n\n```sh\nnpm run -- build --no-lint --no-clean\n```\n\n#### with UMD bundling (incl. minimization):\n\n```sh\nnpm run -- build --prepack\n```\n\n#### with UMD bundling (excl. minimization):\n\n```sh\nnpm run -- build --prepack --no-minify\n```\n\n### Lint\n\n```sh\nnpm run lint\n```\n\n#### with auto-fixing:\n\n```sh\nnpm run -- lint --fix\n```\n\n### Test\n\n```sh\nnpm run test\n```\n\n#### without linting, cleaning and (re-)building:\n\n```sh\nnpm run -- test --no-lint --no-clean --no-build\n```\n\n### Cover\n\n```sh\nnpm run cover\n```\n\n#### without linting, cleaning and (re-)building:\n\n```sh\nnpm run -- cover --no-lint --no-clean --no-build\n```\n\n## Documentation\n\n```sh\nnpm run docs\n```\n\n## Publish\n\n```sh\nnpm publish\n```\n\n#### initially (if public):\n\n```sh\nnpm publish --access=public\n```\n\n## Copyright\n\n © 2021 [dizmo AG](http://dizmo.com/), Switzerland\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdizmo%2Ffunctions-queued","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdizmo%2Ffunctions-queued","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdizmo%2Ffunctions-queued/lists"}