loop-explicit-loopback.json 2.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. {
  2. "name": "verify-loop-explicit-loopback",
  3. "nodes": [
  4. {"id": "n1", "name": "Trigger", "type": "click-trigger", "position": {"x": 0, "y": 0}, "config": {}},
  5. {"id": "src", "name": "Src", "type": "code", "position": {"x": 0, "y": 100},
  6. "config": {"code": "return { items: ['a', 'b', 'c', 'd', 'e'] };"}},
  7. {"id": "lp", "name": "Loop", "type": "loop", "position": {"x": 0, "y": 200},
  8. "config": {"inputField": "data.result.items", "itemVariableName": "it", "outputField": "res", "continueOnError": true}},
  9. {"id": "mark", "name": "Mark", "type": "code", "position": {"x": -100, "y": 300},
  10. "config": {"code": "return { seen: input.it };"}},
  11. {"id": "gate", "name": "Gate", "type": "if-condition", "position": {"x": -100, "y": 400},
  12. "config": {"combineWith": "and", "conditions": [{"field": "data.result.seen", "operator": "equals", "value": "b"}]}},
  13. {"id": "stopHere", "name": "StopHere", "type": "code", "position": {"x": -250, "y": 500},
  14. "config": {"code": "return { hit: true };"}},
  15. {"id": "carryOn", "name": "CarryOn", "type": "code", "position": {"x": 50, "y": 500},
  16. "config": {"code": "return { next: true };"}},
  17. {"id": "after", "name": "After", "type": "code", "position": {"x": 200, "y": 300},
  18. "config": {"code": "const d=(input&&input.data)||{}; return { ran: true, processed: d.totalProcessed };"}}
  19. ],
  20. "connections": [
  21. {"sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "src", "targetInput": "data"},
  22. {"sourceNodeId": "src", "sourceOutput": "main", "targetNodeId": "lp", "targetInput": "data"},
  23. {"sourceNodeId": "lp", "sourceOutput": "loop", "targetNodeId": "mark", "targetInput": "data"},
  24. {"sourceNodeId": "mark", "sourceOutput": "main", "targetNodeId": "gate", "targetInput": "data"},
  25. {"sourceNodeId": "gate", "sourceOutput": "true", "targetNodeId": "stopHere", "targetInput": "data"},
  26. {"sourceNodeId": "gate", "sourceOutput": "false", "targetNodeId": "carryOn", "targetInput": "data"},
  27. {"sourceNodeId": "carryOn", "sourceOutput": "main", "targetNodeId": "lp", "targetInput": "data"},
  28. {"sourceNodeId": "lp", "sourceOutput": "done", "targetNodeId": "after", "targetInput": "data"}
  29. ],
  30. "expectStatus": "completed",
  31. "expect": {
  32. "after": {"status": "completed", "output": {"result": {"ran": true, "processed": 2}}}
  33. }
  34. }