{"id":18152223,"url":"https://github.com/bsdelf/dag-maker","last_synced_at":"2026-04-30T15:32:04.732Z","repository":{"id":96479350,"uuid":"263226613","full_name":"bsdelf/dag-maker","owner":"bsdelf","description":"DAG Maker","archived":false,"fork":false,"pushed_at":"2023-03-02T05:54:07.000Z","size":167,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-20T11:21:57.294Z","etag":null,"topics":["dag","dependency-injection","dependency-resolution","directed-acyclic-graph","javascript","topological-sorting","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsdelf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-05-12T03:52:10.000Z","updated_at":"2023-11-07T14:27:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfc736a8-e0f6-45fd-be68-2ee996030e80","html_url":"https://github.com/bsdelf/dag-maker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bsdelf/dag-maker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fdag-maker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fdag-maker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fdag-maker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fdag-maker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsdelf","download_url":"https://codeload.github.com/bsdelf/dag-maker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsdelf%2Fdag-maker/sbom","scorecard":{"id":256143,"data":{"date":"2025-08-11","repo":{"name":"github.com/bsdelf/dag-maker","commit":"d2305a54ec659fd5e00b0ffea169b7d3aa974ca0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/8 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":"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":"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":"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","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-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","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-17T09:45:56.210Z","repository_id":96479350,"created_at":"2025-08-17T09:45:56.210Z","updated_at":"2025-08-17T09:45:56.210Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32469344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"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":["dag","dependency-injection","dependency-resolution","directed-acyclic-graph","javascript","topological-sorting","typescript"],"created_at":"2024-11-02T02:06:04.718Z","updated_at":"2026-04-30T15:32:04.714Z","avatar_url":"https://github.com/bsdelf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DAG Maker\n\nDAG maker utilize [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting) to make directed acyclic graphs.\n\nIt can be used to solve following problems:\n\n- Dependency resolution \u0026 injection\n- Figure out services start \u0026 stop order\n- Create \u0026 destroy objects in reasonable order\n\n## Installation\n\n```\nnpm i dag-maker\n```\n\n## Usage\n\nSuppose we have two classes A and B. The dependency graph as follows:\n\n```\nA \u003c- B\n```\n\nTo instantiate them, first we create an instance of A, then pass the instance to B's constructor. Since there are only two classes, it's quite straightforward.\n\nHowever, when it comes to a dozen classes with complex dependencies, it's no longer feasible to figure out the proper construction order manually. Not to mention the destruction order.\n\nHere is an example (in TypeScript) presents how to solve this kind of problem with `dag-maker`:\n\n```typescript\nimport { dependencies, DagMaker } from 'dag-maker';\n\nclass A {\n  static async create() {\n    console.log('create A');\n    return new A();\n  }\n  static async destroy(a: A) {\n    console.log('destroy A:', a);\n  }\n}\n\n@dependencies({\n  a: A,\n})\nclass B {\n  constructor(a: A) {\n    this.a = a;\n  }\n  static async create(options: { a: A }) {\n    console.log('create B');\n    return new B(options.a);\n  }\n  static async destroy(b: B) {\n    console.log('destroy B:', b);\n  }\n}\n\nconst dagMaker = new DagMaker(A, B);\nconsole.log(dagMaker.orderBy('dependencies'));\n// [ [ 'A' ], [ 'B' ] ]\n\nconsole.log(dagMaker.orderBy('dependents'));\n// [ [ 'B' ], [ 'A' ] ]\n\nconst dag = await dagMaker.create();\n// create A\n// create B\n\nconsole.log(dag);\n// Map(2) { 'A' =\u003e A {}, 'B' =\u003e B { a: A {} } }\n\nawait dagMaker.destroy(dag);\n// destroy B: B { a: A {} }\n// destroy A: A {}\n```\n\nIn this example, we implement factory methods `create()` and `destroy()` right inside class A and B, and declare B's dependencies with a decorator `@dependencies`. If you don't want to use decorator, declare a static variable named `dependencies` could achieve the same semantic. After then, we create a `DagMaker` for class A and B. Eventually, the DAG maker will inspect `dependencies` property and figure out how to construct A and B.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsdelf%2Fdag-maker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsdelf%2Fdag-maker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsdelf%2Fdag-maker/lists"}