{"id":24742560,"url":"https://github.com/bastion-rnd/async-task-manager","last_synced_at":"2025-03-22T20:43:45.034Z","repository":{"id":219703473,"uuid":"749661196","full_name":"Bastion-RND/async-task-manager","owner":"Bastion-RND","description":"Sequential async tasks manager","archived":false,"fork":false,"pushed_at":"2024-02-01T08:00:40.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-03-19T12:14:55.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Bastion-RND.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-29T06:14:48.000Z","updated_at":"2024-01-29T07:42:36.000Z","dependencies_parsed_at":"2024-01-29T09:45:45.810Z","dependency_job_id":"5c05077b-0f31-4ab1-acba-e59172a263f0","html_url":"https://github.com/Bastion-RND/async-task-manager","commit_stats":null,"previous_names":["bastion-rnd/async-task-manager"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bastion-RND%2Fasync-task-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bastion-RND%2Fasync-task-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bastion-RND%2Fasync-task-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bastion-RND%2Fasync-task-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bastion-RND","download_url":"https://codeload.github.com/Bastion-RND/async-task-manager/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245020314,"owners_count":20548156,"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","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":[],"created_at":"2025-01-28T00:38:27.733Z","updated_at":"2025-03-22T20:43:45.005Z","avatar_url":"https://github.com/Bastion-RND.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async-task-manager\n\nThis package is an asynchronous task manager for organizing the sequential execution of asynchronous tasks.\n\n## Documentation\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Chaining](#chaining)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\nThis package requires [node](https://nodejs.org) and [npm](https://npmjs.com).\n\nYou can install it by running:\n\n```sh\nnpm install @bs-solutions/async-task-manager\n```\n\n## Usage\n\nFirst you need to create a new instance of the class AsyncTaskQueue (with parameter `debug: true` if you want to see logs with task execution results in the console): \n\n```ts\nconst asyncQueue = new AsyncTasksQueue({ debug: true });\n```\n\nThen you can use the following methods:\n- `asyncQueue.enqueue()` method adds an asynchronous task to the queue. This method has two parameters: required parameter `queueTask` and optional parameter `queueTaskConfig`.\n  `queueTaskConfig` type config looks like this:\n   ```ts\n  type QueueTaskConfig = { \n      resolve?: (args?: unknown) =\u003e unknown | Promise\u003cunknown\u003e,\n      reject?: (args?: unknown) =\u003e unknown | Promise\u003cunknown\u003e,\n      clearIfReject?: boolean,\n      retry?: {\n        count: number,\n        delay: number,\n      },\n  };\n   ``` \n   You can see an example below:\n  ```ts\n  asyncQueue.enqueue(\n    () =\u003e someAsyncFunc(),  // the task you want to add to the queue\n    {\n      resolve: (result) =\u003e callbackFunc(result), // will be executed if tasks resolve\n      reject: (result) =\u003e callbackFunc(result), // will be executed if tasks reject after last retry\n      clearIfReject: true, // clears all tasks from queue if tasks reject \n      retry: {\n        count: 3, // determines the number of attempts\n        delay: 2500, // defines the delay between attempts\n      },\n    },\n  );\n  ```\n- `asyncQueue.clearQueue()` method removes all tasks from the queue.\n\n## Chaining\n\n`asyncQueue.enqueue()` method always returns an instance of the `asyncQueue` class, so chaining is supported, and you can use it like this:\n\n```ts\nasyncQueue\n  .enqueue(() =\u003e func())\n  .enqueue(() =\u003e func2())\n  .clearQueue();\n```\n\n## Maintainer\n\n[@VladSolyony](https://github.com/VladSolyony)\n\n## Contributing\n\nPlease contribute! [Look at the issues](https://github.com/Bastion-RND/async-task-manager/issues).\n\n## License\n\nMIT © 2024","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastion-rnd%2Fasync-task-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastion-rnd%2Fasync-task-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastion-rnd%2Fasync-task-manager/lists"}