{"id":31642602,"url":"https://github.com/codejie/flowengine","last_synced_at":"2025-10-07T04:02:15.843Z","repository":{"id":183255039,"uuid":"669802876","full_name":"codejie/FlowEngine","owner":"codejie","description":"Flow Tool","archived":false,"fork":false,"pushed_at":"2023-10-19T15:30:05.000Z","size":232,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-10-19T16:34:47.609Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codejie.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}},"created_at":"2023-07-23T13:32:07.000Z","updated_at":"2023-10-19T16:34:47.610Z","dependencies_parsed_at":"2023-07-23T16:49:07.200Z","dependency_job_id":"44b8c9e3-1421-415e-bb6d-103d216f041b","html_url":"https://github.com/codejie/FlowEngine","commit_stats":null,"previous_names":["codejie/flowengine"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/codejie/FlowEngine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejie%2FFlowEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejie%2FFlowEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejie%2FFlowEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejie%2FFlowEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codejie","download_url":"https://codeload.github.com/codejie/FlowEngine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejie%2FFlowEngine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717433,"owners_count":26033542,"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-07T02:00:06.786Z","response_time":59,"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":[],"created_at":"2025-10-07T04:00:37.236Z","updated_at":"2025-10-07T04:02:15.836Z","avatar_url":"https://github.com/codejie.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FlowEngine\nThis is a sample project to study how to make a Flow Engine.\n# Elements in Project\nThere are three core elements in FlowEngine project: Flow, Node, and Action. \n## Flow\n![Flow Image](./readme/flow_image.png)\nAs above picture, one Flow is contain of two or more Nodes and one or more Actions. And the flow should be began with a StartNode, then ended with a EndNode.\n\nThe imporantest field is `nodes` fields in a Flow, all nodes and releationship between nodes are declared in this field.\n\n```json\n    \"index\": {\n        \"type\": \"number\"\n    },\n    \"id\": {\n        \"type\": \"string\"\n    },\n    \"parameters\": {\n        \"type\": \"array\",\n        \"items\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"name\": {\n                    \"type\": \"string\"\n                },\n                \"value\": {\n                    \"type\": \"[string | number | boolean | object | array | null]\"\n                }               \n            },\n            \"required\": [\"name\", \"value\"]\n        }\n    },\n```\n\n**index**: the index of node in this flow\n\n**id**: the id of node refer to `Node Schema`\n\n**parameters**: the value definition of `Node Option`\n\n```json\n    \"actions\": {\n        \"type\": \"array\",\n        \"items\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"id\": {\n                    \"type\": \"string\"\n                },\n                \"nextNodes\": {\n                    \"type\": \"array\",\n                    \"items\": {\n                        \"type\": \"number\"\n                    }\n                }\n            }\n        }\n    }\n```\nThis section is used to declare next nodes of the `nextAction` of the Node.\n\n**id**: the id of Action refer to `Action Schema`\n\n**nextNode**: all node's index in the flow that behind the Action of the Node\n\nIf a `nextAction`'s ID of Node did not appear, means the brance of this action is not in the Flow.\n\n\u003eRefrence to [Flow JSON Schema](./FlowEngine/blob/master/src/definitions/schema/flow_schema.json) to detail.\n## Node\nElement Node has main three attributes: options, onPrevAction and nextActions.\n![Node Image](./readme/node_image.png)\n- Options: Members or Variants of Node, they can be used to pass data in whole Flow lifecycle;\n```json\n    \"options\": {\n        \"type\": \"array\",\n        \"items\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"name\": {\n                    \"type\": \"string\"\n                },\n                \"type\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"string\", \"number\", \"boolean\", \"object\", \"array\", \"null\"]\n                },\n                \"default\": {\n                    \"type\": \"any\"\n                },\n                \"flag\": { \n                    \"type\": \"string\",\n                    \"enum\": [\"OPTIONAL\", \"REQUIRED\"]\n                }\n            },\n            \"required\": [\"name\"]\n        }\n    }\n```\n- onPrevAction: a callback function that called while the Node be actived by a Action. If `opPrevAction` is not defined, it would be assigned a default function `defaultOnPrevActionFunction` to ensure the node can be called normally.\n```json\n    \"onPrevAction\": {\n        \"type\": \"string\"\n    }\n```\n- nextActions: it indicates how many actions be supported by Node. All actions must be declared in Action collection firstly, in Node just be referenced from the collection by `Action's ID`. \n```json\n    \"nextActions\": {\n        \"type\": \"array\",\n        \"items\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"id\": {\n                    \"type\": \"string\"\n                },\n                \"mode\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"NORMAL\", \"AUTO\", \"DELAY\"]\n                },\n                \"state\": {\n                    \"type\": \"string\",\n                    \"enum\": [\"DISMISS\", \"KEEP\"]\n                },\n                \"payload\": {\n                    \"type\": \"object\"\n                },\n                \"onAction\": {\n                    \"type\": \"string\"\n                }\n            },\n            \"required\": [\"id\"]\n        }\n    },\n```\nIn `nextAction` of Node Schema, it declares an Action (index by `ID`) how to be triggerred, what to do and return while triggered.\n\n**mode**: action how to be triggerred\n- NORMAL: triggerred by manual\n- AUTO: triggerred while Node be actived\n- DELAY: triggerred by a timer\n\n**state**: action what should to do\n- DISMISS: do something and leave the Node\n- KEEP: do something and keep in the Node\n\n**payload**: action what to return\n\n**onAction**: action's callback function while triggerred, would be assigned to default function while not defined.\n\n\u003eRefrence to [Node JSON Schema](./FlowEngine/blob/master/src/definitions/schema/\nnode_schema.json) to detail.\n\nThe base Node, Start and End have defined in the project, and be able to use them.\n## Action\nAction is the simplest element in project currently, it only includes three basic attributes: `ID`, `Name` and `Description`.\n\u003eRefrence to [Action JSON Schema](./FlowEngine/blob/master/src/definitions/schema/action_schema.json) to detail.\n\n# How to\n\n## Make a Flow\nTo make a flow, please try the follow steps.\n- make all actions, and register them into action factory\n- make other nodes, such as Auto or Input, and bind the specified actions, then register them into node factory in the same way\n- make a flow, import some required nodes, and make the relationship between them with thire nextActions field, and register\n- well, you got one flow\n\n## Call a Flow\nFollow the below lines\n```ts\n    const flow: FlowBase = await FlowFactory.load('input.json');\n    flow.show();\n    await flow.onStart();\n    await flow.onNextAction(3, 'ACTION_OK', {'a': 123});\n    flow.show();\n```\n\n\n# Last Section\nThis is just a practice project to learn how to make flow engine, be careful. :)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodejie%2Fflowengine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodejie%2Fflowengine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodejie%2Fflowengine/lists"}