{ "kind": "open-flow-workflow", "version": 1, "name": "Process Ten Example Items One at a Time", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_de4990e5500baa56": { "name": "Run the example", "kind": "start", "inputDefs": [] }, "n_6441803677414152": { "inputs": { "state": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6441803677414152", "output": "state" } ] } }, "name": "Process one example item", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "state" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "message" } ], "name": "Process one example item", "moduleId": "n_ca7a5ab15f928c5b", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_00b8652d0084bac2": { "inputs": {}, "name": "More items?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_6441803677414152", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_5568be23d312d028": { "name": "Finished", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "message" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "visited" } ], "outputMappings": { "message": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6441803677414152", "output": "message" } ] }, "visited": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6441803677414152", "output": "state" } ] } } } }, "edges": [ { "source": "n_de4990e5500baa56", "target": "n_6441803677414152" }, { "source": "n_6441803677414152", "target": "n_00b8652d0084bac2" }, { "source": "n_00b8652d0084bac2", "target": "n_6441803677414152", "sourceHandle": "yes" }, { "source": "n_00b8652d0084bac2", "target": "n_5568be23d312d028", "sourceHandle": "otherwise" } ] } }, "modules": { "n_ca7a5ab15f928c5b": { "name": "Process one example item", "imports": [], "source": "export default function step({state}) {\n const visited=state ? [...state.visited] : [];\n if (visited.length >= 10) throw Error('Invalid batch state');\n visited.push(visited.length);\n return {state:{visited},more:visited.length<10,message:visited.length===10?'No Items Left':''};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }