call-workflow.json 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {
  2. "name": "verify-call-workflow",
  3. "nodes": [
  4. {
  5. "id": "n1",
  6. "name": "Trigger",
  7. "type": "click-trigger",
  8. "position": {
  9. "x": 0,
  10. "y": 0
  11. },
  12. "config": {}
  13. },
  14. {
  15. "id": "call",
  16. "name": "Call",
  17. "type": "call-workflow",
  18. "position": {
  19. "x": 0,
  20. "y": 100
  21. },
  22. "config": {
  23. "workflowId": "{{helper:sub}}",
  24. "inputSource": "fields",
  25. "fields": [
  26. {
  27. "name": "n",
  28. "value": "21"
  29. }
  30. ]
  31. }
  32. },
  33. {
  34. "id": "after",
  35. "name": "After",
  36. "type": "code",
  37. "position": {
  38. "x": 0,
  39. "y": 200
  40. },
  41. "config": {
  42. "code": "const d=input.data||input; return { got: d.result, status: d.status };"
  43. }
  44. }
  45. ],
  46. "connections": [
  47. {
  48. "sourceNodeId": "n1",
  49. "sourceOutput": "main",
  50. "targetNodeId": "call",
  51. "targetInput": "data"
  52. },
  53. {
  54. "sourceNodeId": "call",
  55. "sourceOutput": "main",
  56. "targetNodeId": "after",
  57. "targetInput": "data"
  58. }
  59. ],
  60. "expectStatus": "completed",
  61. "expect": {
  62. "after": {
  63. "status": "completed",
  64. "output": {
  65. "result": {
  66. "status": "completed",
  67. "got": {
  68. "doubled": 42,
  69. "label": "unnamed"
  70. }
  71. }
  72. }
  73. }
  74. },
  75. "helpers": [
  76. {
  77. "key": "sub",
  78. "name": "verify sub: double a number",
  79. "active": true,
  80. "nodes": [
  81. {
  82. "id": "in",
  83. "name": "Input",
  84. "type": "workflow-input",
  85. "position": {
  86. "x": 0,
  87. "y": 0
  88. },
  89. "config": {
  90. "fields": [
  91. {
  92. "name": "n",
  93. "type": "number",
  94. "required": true
  95. }
  96. ]
  97. }
  98. },
  99. {
  100. "id": "calc",
  101. "name": "Double",
  102. "type": "code",
  103. "position": {
  104. "x": 0,
  105. "y": 100
  106. },
  107. "config": {
  108. "code": "const d=input.data||input; return { doubled: Number(d.n)*2, label: d.label || \"unnamed\" };"
  109. }
  110. },
  111. {
  112. "id": "out",
  113. "name": "Output",
  114. "type": "workflow-output",
  115. "position": {
  116. "x": 0,
  117. "y": 200
  118. },
  119. "config": {
  120. "source": "fields",
  121. "fields": [
  122. {
  123. "name": "doubled",
  124. "value": "{{data.result.doubled}}"
  125. },
  126. {
  127. "name": "label",
  128. "value": "{{data.result.label}}"
  129. }
  130. ]
  131. }
  132. }
  133. ],
  134. "connections": [
  135. {
  136. "sourceNodeId": "in",
  137. "sourceOutput": "main",
  138. "targetNodeId": "calc",
  139. "targetInput": "data"
  140. },
  141. {
  142. "sourceNodeId": "calc",
  143. "sourceOutput": "main",
  144. "targetNodeId": "out",
  145. "targetInput": "data"
  146. }
  147. ]
  148. }
  149. ]
  150. }