{"id":18730539,"url":"https://github.com/cadgerfeast/duncan","last_synced_at":"2025-08-30T18:24:54.848Z","repository":{"id":98945832,"uuid":"574903266","full_name":"cadgerfeast/duncan","owner":"cadgerfeast","description":"Great and Responsable TypeScript Chains","archived":false,"fork":false,"pushed_at":"2023-02-05T13:12:08.000Z","size":1155,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T14:44:49.480Z","etag":null,"topics":["chain","duncan","parallel","responsability","sequential","typescript"],"latest_commit_sha":null,"homepage":"https://duncan.cadgerfeast.dev","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/cadgerfeast.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}},"created_at":"2022-12-06T10:28:41.000Z","updated_at":"2024-02-03T17:52:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"7528b4e9-c78d-4454-833d-0a230f0512ab","html_url":"https://github.com/cadgerfeast/duncan","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadgerfeast%2Fduncan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadgerfeast%2Fduncan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadgerfeast%2Fduncan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadgerfeast%2Fduncan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cadgerfeast","download_url":"https://codeload.github.com/cadgerfeast/duncan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239599968,"owners_count":19666087,"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":["chain","duncan","parallel","responsability","sequential","typescript"],"created_at":"2024-11-07T14:42:16.367Z","updated_at":"2025-02-19T05:22:07.957Z","avatar_url":"https://github.com/cadgerfeast.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# duncan\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cadgerfeast_duncan\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=cadgerfeast_duncan)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=cadgerfeast_duncan\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=cadgerfeast_duncan)\n[![Version](https://badge.fury.io/js/duncan.svg)](https://www.npmjs.com/package/duncan)\n[![Downloads](https://img.shields.io/npm/dt/duncan.svg)](https://www.npmjs.com/package/duncan)\n[![License](https://img.shields.io/npm/l/duncan.svg)](https://github.com/cadgerfeast/duncan/blob/master/LICENSE)\n\n\u003cp align=\"center\"\u003e\u003cbr/\u003e\u003cimg width=\"200\" src=\"https://duncan.cadgerfeast.dev/icons/duncan.svg\" alt=\"Duncan Icon\"/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003c/p\u003e\n\n\u003e Great and Responsable TypeScript Chains\n\n**Duncan** is a JavaScript library that allows to organize `asynchronous operations` under a set of commands to be executed `sequentially`, or `in parallel`.\n\nThe library is heavily inspired by the [Chain of Responsibility](https://refactoring.guru/design-patterns/chain-of-responsibility) pattern, except it also allows to have chains in `parallel`.\n\nIn short, `Duncan` let's you organise `asynchronous operations` just like you would inside a `Pipeline`.\n\n## Installation\n\n``` bash\nnpm install duncan --save\n```\n\n## Usage\n\n``` typescript\n// Import the library\nimport * as Duncan from 'duncan';\n\n// Define commands\nconst myFirstCommand = new Duncan.Command({\n  name: 'My First Command',\n  async handler (context) {\n    // Do something awesome\n    return context;\n  }\n});\nconst mySecondCommand = new Duncan.Command({\n  name: 'My Second Command',\n  async handler (context) {\n    // Do something even more awesome\n    return context;\n  }\n});\n// Define a sequential chain\nconst mySequentialChain = new Duncan.SequentialChain({\n  name: 'My Sequential Chain',\n  handlers: [\n    myFirstCommand,\n    mySecondCommand\n  ]\n});\nawait mySequentialChain.execute();\n// Define a parallel chain\nconst myParallelChain = new Duncan.ParallelChain({\n  name: 'My Sequential Chain',\n  handlers: [\n    myFirstCommand,\n    mySecondCommand\n  ]\n});\nawait myParallelChain.execute();\n```\n\n## Contributors\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003ca href=\"https://github.com/cadgerfeast\" target=\"_blank\"\u003e\n          \u003cimg src=\"https://github.com/cadgerfeast.png?size=100\" alt=\"cadgerfeast\" width=\"100px\" style=\"min-width: 100px\"\u003e\n          \u003cbr/\u003e\n          \u003cspan\u003ecadgerfeast\u003c/span\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcadgerfeast%2Fduncan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcadgerfeast%2Fduncan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcadgerfeast%2Fduncan/lists"}