{"id":22771037,"url":"https://github.com/hiproxy/step-flow","last_synced_at":"2025-10-31T10:59:05.072Z","repository":{"id":57153271,"uuid":"93405671","full_name":"hiproxy/step-flow","owner":"hiproxy","description":"A simple step-flow library.","archived":false,"fork":false,"pushed_at":"2018-05-09T03:58:40.000Z","size":59,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T16:48:47.090Z","etag":null,"topics":["control-flow","flow","step"],"latest_commit_sha":null,"homepage":"","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/hiproxy.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-05T13:16:53.000Z","updated_at":"2024-01-15T08:30:29.000Z","dependencies_parsed_at":"2022-09-06T10:51:11.313Z","dependency_job_id":null,"html_url":"https://github.com/hiproxy/step-flow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hiproxy/step-flow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiproxy%2Fstep-flow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiproxy%2Fstep-flow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiproxy%2Fstep-flow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiproxy%2Fstep-flow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiproxy","download_url":"https://codeload.github.com/hiproxy/step-flow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiproxy%2Fstep-flow/sbom","scorecard":{"id":465120,"data":{"date":"2025-08-11","repo":{"name":"github.com/hiproxy/step-flow","commit":"58c3f0ec95574e512aff74a3c419f743817c5548"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"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":"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":"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":"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":"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":"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":"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":"Vulnerabilities","score":0,"reason":"61 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-mh2h-6j8q-x246","Warn: Project is vulnerable to: GHSA-5q88-cjfq-g2mh","Warn: Project is vulnerable to: GHSA-xp63-6vf5-xf3v","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","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-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"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-19T12:16:57.314Z","repository_id":57153271,"created_at":"2025-08-19T12:16:57.315Z","updated_at":"2025-08-19T12:16:57.315Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281976636,"owners_count":26592973,"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-10-31T02:00:07.401Z","response_time":57,"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":["control-flow","flow","step"],"created_at":"2024-12-11T16:11:58.165Z","updated_at":"2025-10-31T10:59:05.026Z","avatar_url":"https://github.com/hiproxy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# step-flow\n\n简单的流程控制库，可以轻松的完成按步骤执行的流程控制 - 按顺序一个一个执行函数。支持异步的步骤流程和流程跳转。\n\n[![Build Status](https://travis-ci.org/zdying/step-flow.svg?branch=master)](https://travis-ci.org/zdying/step-flow)\n[![Build status](https://ci.appveyor.com/api/projects/status/okl9e4xs1nsuv7yq/branch/master?svg=true)](https://ci.appveyor.com/project/zdying/step-flow/branch/master)\n[![codecov](https://codecov.io/gh/zdying/step-flow/branch/master/graph/badge.svg)](https://codecov.io/gh/zdying/step-flow)\n[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat)](https://github.com/Flet/semistandard)\n[![Node.js version](https://img.shields.io/badge/node-%3E%3D0.12.7-green.svg)](https://nodejs.org/)\n[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/zdying/step-flow/blob/master/LICENSE)\n\n## 特色\n\n* 简洁轻量\n* 代码覆盖率100%\n* 支持步骤名称\n* 支持步骤自由跳转\n* 支持异步步骤流程\n* 支持错误统一处理\n* 支持上下文\n\n## 安装\n\n```bash\nnpm install --save step-flow\n```\n\n## 使用\n\n### 1. 引入step-flow\n\n```js\nvar Flow = require('step-flow');\n```\n\n### 2. 创建一个流程\n\n```js\nvar flow = new Flow();\n```\n\n### 3. 添加步骤和函数\n\n一个步骤，对应多个函数：\n\n```js\nflow.use(\n  'step1',\n  function fn1 (ctx, next) {\n    ctx.fn1 = true;\n    next();\n  },\n  function fn11 (ctx, next) {\n    ctx.fn11 = true;\n    next();\n  }\n);\n```\n\n一个步骤对应一个函数：\n\n```js\nflow\n  .use('step2', function fn2 (ctx, next) {\n    ctx.fn2 = true;\n    // next();\n  })\n  .use(function fn3 (ctx, next) {\n    ctx.fn3 = true;\n  });\n```\n\n### 4. 错误处理\n\n```js\nflow.catch(function (err) {\n  console.log('flow error:', err);\n});\n```\n\n### 5. 运行步骤函数\n\n```js\nvar context = {};\n\nflow.run(context)\n```\n\n## API\n\n\u003ca name=\"StepFlow\"\u003e\u003c/a\u003e\n\n### StepFlow()\n步骤流程控制\n\n* [StepFlow()](#StepFlow)\n    * [.use([stepName])](#StepFlow+use) ⇒ [\u003ccode\u003eStepFlow\u003c/code\u003e](#StepFlow)\n    * [.catch(fn)](#StepFlow+catch) ⇒ [\u003ccode\u003eStepFlow\u003c/code\u003e](#StepFlow)\n    * [.run(context, stepName, thisArg)](#StepFlow+run) ⇒ [\u003ccode\u003eStepFlow\u003c/code\u003e](#StepFlow)\n\n\u003ca name=\"StepFlow+use\"\u003e\u003c/a\u003e\n\n\u003cbr/\u003e\n\n#### stepFlow.use([stepName]) ⇒ [\u003ccode\u003eStepFlow\u003c/code\u003e](#StepFlow)\n添加步骤以及对应的函数。\n如果指定的步骤已经存在，这些函数将会追加到这个步骤中。\n如果不存在，则新建一个新的步骤。\n\n这里添加的每一个函数在执行时都会接收到参数`(context, next, nextTo, data)`：\n\n* `context`：上下文对象。\n* `next(err[,data])`：执行步骤中的下一个函数，如果不调用，不会执行下一个函数。\n* `nextTo(step[,data])`：调用这个方法并传递步骤名称，可以跳转到对应的步骤。\n* `data`：调用`next(null, data)`中传入的数据。\n\n只有调用`next()`，才会继续执行步骤中的下一个函数。如果调用时，传入了非空的参数`err`，则后面的函数不再执行，使用`catch(fn)`设置的错误处理函数会被执行。\n如果调用`next()`/`nextTo()`时，传递了参数`data`，**下一个**函数会接收到这个数据。\n但是，下一个之后的的函数不会接收到这个数据，除非在下一个函数中再次调用`next()/nextTo()`时传递`data`。\n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| [stepName] | \u003ccode\u003eString\u003c/code\u003e | \u003ccode\u003e\u0026#x27;default\u0026#x27;\u003c/code\u003e | 需要新建或者追加函数的步骤名称，如果省略这个参数，默认使用`default` |\n\n\u003ca name=\"StepFlow+catch\"\u003e\u003c/a\u003e\n\n\u003cbr/\u003e\n\n#### stepFlow.catch(fn) ⇒ [\u003ccode\u003eStepFlow\u003c/code\u003e](#StepFlow)\n添加错误处理函数，当调用`next(err)`，并传递非空的`err`参数时，会调用这些错误处理函数。\n\n此外，如果`use()`方法指定的方法运行时报错，`fn`也会被执行，错误对象也会被传递给`fn`。\n\n参数`fn`会接受到参数`(err)`, `err`为错误信息。\n\n| Param | Type | Description |\n| --- | --- | --- |\n| fn | \u003ccode\u003efunction\u003c/code\u003e | 错误处理函数 |\n\n\u003ca name=\"StepFlow+run\"\u003e\u003c/a\u003e\n\n\u003cbr/\u003e\n\n#### stepFlow.run(context, stepName, thisArg) ⇒ [\u003ccode\u003eStepFlow\u003c/code\u003e](#StepFlow)\n开始执行步骤函数。\n如果指定了步骤名称，将从对应的步骤开始执行。如果没有指定，则从第一个步骤开始执行。\n\n| Param | Type | Description |\n| --- | --- | --- |\n| context | \u003ccode\u003eAny\u003c/code\u003e | 上下文对象，每个步骤的函数都会接受到这个参数 |\n| stepName | \u003ccode\u003eString\u003c/code\u003e |起始步骤名称，默认从第一个步骤开始 |\n| thisArg | \u003ccode\u003eObject\u003c/code\u003e | 步骤函数的this |\n\n## Running tests\n\n```bash\nnpm test\n```\n\n## Contributing\n\n请参阅[CONTRIBUTING.md](https://github.com/zdying/step-flow/blob/master/CONTRIBUTING.md)了解我们的行为准则以及如何为step-flow贡献代码。\n\n## Authors\n\n* __zdying__ - _HTML/JavaScript/CSS/Node.js developer_ [zdying](https://github.com/zdying)\n\n查看其他贡献者 [contributors](https://github.com/zdying/step-flow/graphs/contributors)。\n\n## License\n\n这个项目采用MIT协议 - 详细信息请查看[LICENSE](https://github.com/zdying/step-flow/blob/master/LICENSE)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiproxy%2Fstep-flow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiproxy%2Fstep-flow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiproxy%2Fstep-flow/lists"}