New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

do-red

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

do-red - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

8

CHANGELOG.md
# Changelog
## Version 0.4.1 (26th of January 2024)
- added .npmignore (pictures)
- Bugfix: history entry for replaced node link
- minified html files
- updated examples
## Version 0.4.0 (26th of January 2024)
- Corrected node version (new feature in 0.3.5)
- Bugfix doubled nodes:add event emitted an append
- Bugfix: doubled nodes:add event emitted an append
- new / replaced nodes have an temporar _do_red key to identify nodes created via do-red in events

@@ -7,0 +13,0 @@

2

examples/1_Loop.json

@@ -1,1 +0,1 @@

[{"id":"d9faa645.5bfcf8","type":"tab","label":"loop","disabled":false,"info":""},{"id":"18a66fd.9292f9","type":"do","z":"d9faa645.5bfcf8","name":"","tasks":["default"],"outputs":2,"x":330,"y":130,"wires":[["c24065ab.7c41e8"],["6ae4c26e.7de8dc"]]},{"id":"76ad755e.45063c","type":"do-return","z":"d9faa645.5bfcf8","name":"","mode":"continue","x":1020,"y":130,"wires":[]},{"id":"61725a2d.4971a4","type":"debug","z":"d9faa645.5bfcf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":790,"y":240,"wires":[]},{"id":"c24065ab.7c41e8","type":"change","z":"d9faa645.5bfcf8","name":"puncture balloon :)","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload - 1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":130,"wires":[["d4063b53.69ee08"]]},{"id":"bfd89a3a.160f88","type":"inject","z":"d9faa645.5bfcf8","name":"99 red balloons","topic":"","payload":"99","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":130,"wires":[["18a66fd.9292f9"]]},{"id":"d4063b53.69ee08","type":"switch","z":"d9faa645.5bfcf8","name":"more balloons?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":130,"wires":[["76ad755e.45063c"],["8816b1c8.08343"]]},{"id":"8816b1c8.08343","type":"do-return","z":"d9faa645.5bfcf8","name":"","mode":"done","x":1010,"y":180,"wires":[]},{"id":"6ae4c26e.7de8dc","type":"change","z":"d9faa645.5bfcf8","name":"no more balloons :(","rules":[{"t":"set","p":"payload","pt":"msg","to":"That was fun! But now I already punctured all the balloons. :/ Do you have me some more?","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":240,"wires":[["61725a2d.4971a4"]]},{"id":"4ac62b51.1d8d04","type":"comment","z":"d9faa645.5bfcf8","name":"Description of Loop-Example","info":"Loops are the most basic usecase for the do-return-nodes. Just drag the do-node onto the canvas and wire its first output (task output) to whatever shall be repeatedly done and the second output (done-output) to where the flow shall continue after the loop ended. Using the return node you can decide whether you want to execute the loop once again (continue mode) or to end it (done mode).","x":160,"y":60,"wires":[]}]
[{"id":"d9faa645.5bfcf8","type":"tab","label":"loop","disabled":false,"info":""},{"id":"18a66fd.9292f9","type":"do","z":"d9faa645.5bfcf8","name":"","tasks":["default"],"mode":"msg","each":"","eachType":"","yield":"","doneOutput":true,"firstValueOutput":"","lastValueOutput":"","outputs":2,"_version":"0.4.1","x":330,"y":130,"wires":[["c24065ab.7c41e8"],["6ae4c26e.7de8dc"]]},{"id":"76ad755e.45063c","type":"do-return","z":"d9faa645.5bfcf8","name":"","mode":"continue","x":1020,"y":130,"wires":[]},{"id":"61725a2d.4971a4","type":"debug","z":"d9faa645.5bfcf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":790,"y":240,"wires":[]},{"id":"c24065ab.7c41e8","type":"change","z":"d9faa645.5bfcf8","name":"puncture balloon :)","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload - 1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":130,"wires":[["d4063b53.69ee08"]]},{"id":"bfd89a3a.160f88","type":"inject","z":"d9faa645.5bfcf8","name":"99 red balloons","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"99","payloadType":"num","x":120,"y":130,"wires":[["18a66fd.9292f9"]]},{"id":"d4063b53.69ee08","type":"switch","z":"d9faa645.5bfcf8","name":"more balloons?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":130,"wires":[["76ad755e.45063c"],["8816b1c8.08343"]]},{"id":"8816b1c8.08343","type":"do-return","z":"d9faa645.5bfcf8","name":"","mode":"done","x":1010,"y":180,"wires":[]},{"id":"6ae4c26e.7de8dc","type":"change","z":"d9faa645.5bfcf8","name":"no more balloons :(","rules":[{"t":"set","p":"payload","pt":"msg","to":"That was fun! But now I already punctured all the balloons. :/ Do you have me some more?","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":240,"wires":[["61725a2d.4971a4"]]},{"id":"4ac62b51.1d8d04","type":"comment","z":"d9faa645.5bfcf8","name":"Description of Loop-Example","info":"Loops are the most basic usecase for the do-return-nodes. Just drag the do-node onto the canvas and wire its first output (task output) to whatever shall be repeatedly done and the second output (done-output) to where the flow shall continue after the loop ended. Using the return node you can decide whether you want to execute the loop once again (continue mode) or to end it (done mode).","x":160,"y":60,"wires":[]}]

@@ -1,1 +0,1 @@

[{"id":"8b50971b.a49d58","type":"tab","label":"task list","disabled":false,"info":""},{"id":"8f4d8f31.7603d","type":"do","z":"8b50971b.a49d58","name":"","tasks":["Paint white","Let balloon fly","Smile"],"outputs":4,"x":330,"y":130,"wires":[["7f3c80de.33b62"],["98e054a3.6efdb8"],["c87c123d.7a65a"],["42ab67d2.12a628"]]},{"id":"3e77f475.9764ec","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"continue","x":1020,"y":170,"wires":[]},{"id":"94766e4b.0424c","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"done","x":730,"y":270,"wires":[]},{"id":"42ab67d2.12a628","type":"debug","z":"8b50971b.a49d58","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":350,"wires":[]},{"id":"c87c123d.7a65a","type":"change","z":"8b50971b.a49d58","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"So many red balloons flying. Cool! :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":270,"wires":[["94766e4b.0424c"]]},{"id":"48edc785.2d0098","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"continue","x":1220,"y":90,"wires":[]},{"id":"855c920c.14b34","type":"switch","z":"8b50971b.a49d58","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1000,"y":110,"wires":[["48edc785.2d0098"],["feeb0c66.b5931"]]},{"id":"feeb0c66.b5931","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"done","x":1210,"y":130,"wires":[]},{"id":"2db458ac.da41e8","type":"inject","z":"8b50971b.a49d58","name":"99 white balloons","topic":"","payload":"[\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":130,"wires":[["8f4d8f31.7603d"]]},{"id":"3c51a9de.e0d7b6","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"done","x":1010,"y":210,"wires":[]},{"id":"7f3c80de.33b62","type":"change","z":"8b50971b.a49d58","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":110,"wires":[["b65f5fea.ae4f2"]]},{"id":"b65f5fea.ae4f2","type":"function","z":"8b50971b.a49d58","name":"paint red","func":"msg.payload[msg.current_balloon] = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":110,"wires":[["855c920c.14b34"]]},{"id":"98e054a3.6efdb8","type":"function","z":"8b50971b.a49d58","name":"let balloon fly","func":"msg.payload.pop();\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":190,"wires":[["4247a2da.af362c"]]},{"id":"4247a2da.af362c","type":"switch","z":"8b50971b.a49d58","name":"more balloons?","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":190,"wires":[["3e77f475.9764ec"],["3c51a9de.e0d7b6"]]},{"id":"ae68f0e9.f06eb","type":"comment","z":"8b50971b.a49d58","name":"Description of Task-List-Example","info":"Like having a TODO-list, you can tell Node-RED to sequentially do some tasks (on the same message).\n\nTherefore you need to add more task-outputs in the do-node (by adding tasks in its configuration). Each time a return-node in done-mode is called, it returns to the do-node and continues with the next task. Returning in continue-mode loops the current task.","x":180,"y":60,"wires":[]}]
[{"id":"8b50971b.a49d58","type":"tab","label":"task list","disabled":false,"info":""},{"id":"8f4d8f31.7603d","type":"do","z":"8b50971b.a49d58","name":"","tasks":["Paint white","Let balloon fly","Smile"],"mode":"msg","each":"","eachType":"msg","yield":"keyValue","doneOutput":true,"firstValueOutput":false,"lastValueOutput":false,"outputs":4,"_version":"0.4.1","x":330,"y":130,"wires":[["7f3c80de.33b62"],["98e054a3.6efdb8"],["c87c123d.7a65a"],["42ab67d2.12a628"]]},{"id":"3e77f475.9764ec","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"continue","x":1020,"y":170,"wires":[]},{"id":"94766e4b.0424c","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"done","x":730,"y":270,"wires":[]},{"id":"42ab67d2.12a628","type":"debug","z":"8b50971b.a49d58","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":350,"wires":[]},{"id":"c87c123d.7a65a","type":"change","z":"8b50971b.a49d58","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"So many red balloons flying. Cool! :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":270,"wires":[["94766e4b.0424c"]]},{"id":"48edc785.2d0098","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"continue","x":1220,"y":90,"wires":[]},{"id":"855c920c.14b34","type":"switch","z":"8b50971b.a49d58","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1000,"y":110,"wires":[["48edc785.2d0098"],["feeb0c66.b5931"]]},{"id":"feeb0c66.b5931","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"done","x":1210,"y":130,"wires":[]},{"id":"2db458ac.da41e8","type":"inject","z":"8b50971b.a49d58","name":"99 white balloons","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\"]","payloadType":"json","x":120,"y":130,"wires":[["8f4d8f31.7603d"]]},{"id":"3c51a9de.e0d7b6","type":"do-return","z":"8b50971b.a49d58","name":"","mode":"done","x":1010,"y":210,"wires":[]},{"id":"7f3c80de.33b62","type":"change","z":"8b50971b.a49d58","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":110,"wires":[["b65f5fea.ae4f2"]]},{"id":"b65f5fea.ae4f2","type":"function","z":"8b50971b.a49d58","name":"paint red","func":"msg.payload[msg.current_balloon] = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":110,"wires":[["855c920c.14b34"]]},{"id":"98e054a3.6efdb8","type":"function","z":"8b50971b.a49d58","name":"let balloon fly","func":"msg.payload.pop();\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":180,"wires":[["4247a2da.af362c"]]},{"id":"4247a2da.af362c","type":"switch","z":"8b50971b.a49d58","name":"more balloons?","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":190,"wires":[["3e77f475.9764ec"],["3c51a9de.e0d7b6"]]},{"id":"ae68f0e9.f06eb","type":"comment","z":"8b50971b.a49d58","name":"Description of Task-List-Example","info":"Like having a TODO-list, you can tell Node-RED to sequentially do some tasks (on the same message).\n\nTherefore you need to add more task-outputs in the do-node (by adding tasks in its configuration). Each time a return-node in done-mode is called, it returns to the do-node and continues with the next task. Returning in continue-mode loops the current task.","x":180,"y":60,"wires":[]}]

@@ -1,1 +0,1 @@

[{"id":"19507521.e9188b","type":"tab","label":"abort","disabled":false,"info":""},{"id":"123ed832.1535d8","type":"do","z":"19507521.e9188b","name":"","tasks":["Paint white","Let balloon fly","Smile"],"outputs":4,"x":330,"y":160,"wires":[["a412c18f.0969"],["b5116b07.d4f558"],["69269666.b3e568"],["bec15721.0bbe08"]]},{"id":"ca4d1582.7d2d28","type":"do-return","z":"19507521.e9188b","name":"","mode":"continue","x":1020,"y":200,"wires":[]},{"id":"e4e96a79.50ae18","type":"do-return","z":"19507521.e9188b","name":"","mode":"done","x":730,"y":300,"wires":[]},{"id":"bec15721.0bbe08","type":"debug","z":"19507521.e9188b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":380,"wires":[]},{"id":"69269666.b3e568","type":"change","z":"19507521.e9188b","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"I'm happy. :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":300,"wires":[["e4e96a79.50ae18"]]},{"id":"d525aa05.aedba8","type":"do-return","z":"19507521.e9188b","name":"","mode":"continue","x":1460,"y":120,"wires":[]},{"id":"8c888461.8b43d8","type":"switch","z":"19507521.e9188b","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1240,"y":140,"wires":[["d525aa05.aedba8"],["3f6c10ce.42b8a"]]},{"id":"3f6c10ce.42b8a","type":"do-return","z":"19507521.e9188b","name":"","mode":"done","x":1450,"y":160,"wires":[]},{"id":"7c26f69.4582008","type":"inject","z":"19507521.e9188b","name":"99 white balloons","topic":"","payload":"[\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":130,"wires":[["123ed832.1535d8"]]},{"id":"648622b8.ebfc6c","type":"do-return","z":"19507521.e9188b","name":"","mode":"done","x":1010,"y":240,"wires":[]},{"id":"a412c18f.0969","type":"change","z":"19507521.e9188b","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":140,"wires":[["5beca763.a8e158"]]},{"id":"92c6b2a5.119d3","type":"function","z":"19507521.e9188b","name":"paint red","func":"msg.payload[msg.current_balloon] = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":1020,"y":140,"wires":[["8c888461.8b43d8"]]},{"id":"b5116b07.d4f558","type":"function","z":"19507521.e9188b","name":"let balloon fly","func":"msg.payload.pop();\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":220,"wires":[["5d844cf5.4988d4"]]},{"id":"5d844cf5.4988d4","type":"switch","z":"19507521.e9188b","name":"more balloons?","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":220,"wires":[["ca4d1582.7d2d28"],["648622b8.ebfc6c"]]},{"id":"a9ab10d2.3f354","type":"inject","z":"19507521.e9188b","name":"99 mixed balloons","topic":"","payload":"[\"white\",\"blue\",\"white\",\"green\",\"white\",\"white\",\"yellow\",\"yellow\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"blue\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"blue\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"blue\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"white\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"yellow\",\"white\",\"red\",\"red\",\"white\",\"blue\",\"white\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":190,"wires":[["123ed832.1535d8"]]},{"id":"5beca763.a8e158","type":"switch","z":"19507521.e9188b","name":"is it red?","property":"current_balloon","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"msg.payload[$$.msg.current_balloon] = \"red\"","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":780,"y":140,"wires":[["43d17ee8.27433"],["92c6b2a5.119d3"]]},{"id":"ae362cb9.358e4","type":"do-return","z":"19507521.e9188b","name":"","mode":"abort","x":1210,"y":90,"wires":[]},{"id":"8cfe76f2.bc1158","type":"comment","z":"19507521.e9188b","name":"Description of Abort-Example","info":"You can abort a task-list at any time by returning in abort-mode.\n\nIn this example the balloons get painted red but in case a balloon is already red, it immediately aborts as this should not happen.","x":160,"y":60,"wires":[]},{"id":"43d17ee8.27433","type":"change","z":"19507521.e9188b","name":"Set error","rules":[{"t":"set","p":"payload","pt":"msg","to":"Error: Balloon was already red.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":90,"wires":[["ae362cb9.358e4"]]}]
[{"id":"19507521.e9188b","type":"tab","label":"abort","disabled":false,"info":""},{"id":"123ed832.1535d8","type":"do","z":"19507521.e9188b","name":"","tasks":["Paint white","Let balloon fly","Smile"],"mode":"msg","each":"","eachType":"msg","yield":"keyValue","doneOutput":true,"firstValueOutput":false,"lastValueOutput":false,"outputs":4,"_version":"0.4.1","x":330,"y":160,"wires":[["a412c18f.0969"],["b5116b07.d4f558"],["69269666.b3e568"],["bec15721.0bbe08"]]},{"id":"ca4d1582.7d2d28","type":"do-return","z":"19507521.e9188b","name":"","mode":"continue","x":1020,"y":200,"wires":[]},{"id":"e4e96a79.50ae18","type":"do-return","z":"19507521.e9188b","name":"","mode":"done","x":730,"y":300,"wires":[]},{"id":"bec15721.0bbe08","type":"debug","z":"19507521.e9188b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":380,"wires":[]},{"id":"69269666.b3e568","type":"change","z":"19507521.e9188b","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"I'm happy. :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":300,"wires":[["e4e96a79.50ae18"]]},{"id":"d525aa05.aedba8","type":"do-return","z":"19507521.e9188b","name":"","mode":"continue","x":1460,"y":120,"wires":[]},{"id":"8c888461.8b43d8","type":"switch","z":"19507521.e9188b","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1240,"y":140,"wires":[["d525aa05.aedba8"],["3f6c10ce.42b8a"]]},{"id":"3f6c10ce.42b8a","type":"do-return","z":"19507521.e9188b","name":"","mode":"done","x":1450,"y":160,"wires":[]},{"id":"7c26f69.4582008","type":"inject","z":"19507521.e9188b","name":"99 white balloons","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\"]","payloadType":"json","x":120,"y":130,"wires":[["123ed832.1535d8"]]},{"id":"648622b8.ebfc6c","type":"do-return","z":"19507521.e9188b","name":"","mode":"done","x":1010,"y":240,"wires":[]},{"id":"a412c18f.0969","type":"change","z":"19507521.e9188b","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":140,"wires":[["5beca763.a8e158"]]},{"id":"92c6b2a5.119d3","type":"function","z":"19507521.e9188b","name":"paint red","func":"msg.payload[msg.current_balloon] = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":1020,"y":140,"wires":[["8c888461.8b43d8"]]},{"id":"b5116b07.d4f558","type":"function","z":"19507521.e9188b","name":"let balloon fly","func":"msg.payload.pop();\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":220,"wires":[["5d844cf5.4988d4"]]},{"id":"5d844cf5.4988d4","type":"switch","z":"19507521.e9188b","name":"more balloons?","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":220,"wires":[["ca4d1582.7d2d28"],["648622b8.ebfc6c"]]},{"id":"a9ab10d2.3f354","type":"inject","z":"19507521.e9188b","name":"99 mixed balloons","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"white\",\"blue\",\"white\",\"green\",\"white\",\"white\",\"yellow\",\"yellow\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"blue\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"blue\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"white\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"blue\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"red\",\"green\",\"white\",\"blue\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"white\",\"white\",\"green\",\"white\",\"yellow\",\"white\",\"red\",\"white\",\"yellow\",\"white\",\"red\",\"red\",\"white\",\"blue\",\"white\"]","payloadType":"json","x":130,"y":190,"wires":[["123ed832.1535d8"]]},{"id":"5beca763.a8e158","type":"switch","z":"19507521.e9188b","name":"is it red?","property":"current_balloon","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"msg.payload[$$.msg.current_balloon] = \"red\"","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":780,"y":140,"wires":[["43d17ee8.27433"],["92c6b2a5.119d3"]]},{"id":"ae362cb9.358e4","type":"do-return","z":"19507521.e9188b","name":"","mode":"abort","x":1210,"y":90,"wires":[]},{"id":"8cfe76f2.bc1158","type":"comment","z":"19507521.e9188b","name":"Description of Abort-Example","info":"You can abort a task-list at any time by returning in abort-mode.\n\nIn this example the balloons get painted red but in case a balloon is already red, it immediately aborts as this should not happen.","x":160,"y":60,"wires":[]},{"id":"43d17ee8.27433","type":"change","z":"19507521.e9188b","name":"Set error","rules":[{"t":"set","p":"payload","pt":"msg","to":"Error: Balloon was already red.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":90,"wires":[["ae362cb9.358e4"]]}]

@@ -1,1 +0,1 @@

[{"id":"98c1572b.950998","type":"tab","label":"overlapping task lists","disabled":false,"info":""},{"id":"febdb7e8.509a88","type":"do-return","z":"98c1572b.950998","name":"","mode":"continue","x":1200,"y":490,"wires":[]},{"id":"1ed9cd0.20b0733","type":"debug","z":"98c1572b.950998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":750,"wires":[]},{"id":"49763f9.c5a2ac","type":"do-return","z":"98c1572b.950998","name":"","mode":"continue","x":1400,"y":220,"wires":[]},{"id":"a06ba5ae.b74748","type":"switch","z":"98c1572b.950998","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1180,"y":240,"wires":[["49763f9.c5a2ac"],["df3ee4f7.a5a2f8"]]},{"id":"df3ee4f7.a5a2f8","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1390,"y":260,"wires":[]},{"id":"2fcfafc.500b75","type":"inject","z":"98c1572b.950998","name":"Start","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":190,"wires":[["39cf6db8.ea8302"]]},{"id":"ca97a02e.e109e","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1190,"y":530,"wires":[]},{"id":"85a06a9c.110828","type":"change","z":"98c1572b.950998","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":240,"wires":[["d07a273e.cb1a38"]]},{"id":"d07a273e.cb1a38","type":"function","z":"98c1572b.950998","name":"paint red","func":"msg.payload[msg.current_balloon] = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":240,"wires":[["a06ba5ae.b74748"]]},{"id":"2014e2ec.7cf63e","type":"function","z":"98c1572b.950998","name":"let balloon fly","func":"msg.payload.pop();\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":510,"wires":[["b3111487.4c41b8"]]},{"id":"b3111487.4c41b8","type":"switch","z":"98c1572b.950998","name":"more balloons?","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":980,"y":510,"wires":[["febdb7e8.509a88"],["ca97a02e.e109e"]]},{"id":"28668177.9e16de","type":"comment","z":"98c1572b.950998","name":"Description of Overlapping-Task-Lists-Example","info":"Using do-red, you can define different task-lists having some tasks in common. This allows to create e.g. some kind of building plan.\n\nSome tasks are thereby executed in both cases (e.g. creating the ballons) and some are specific for one building plan (e.g. how the ballons get colored or what to do with them afterwards).\n\nThe return node always knows to which do-node it needs to return to.\n\nIn this example we have two building plans: The first creates red ballons and lets them fly, the second creates blue balloons. Blue balloons are not meant for flying, so they are kept for Node-RED to be happy. ;)","x":220,"y":60,"wires":[]},{"id":"79e6cfc5.a8483","type":"comment","z":"98c1572b.950998","name":"We want red balloons","info":"","x":780,"y":190,"wires":[]},{"id":"b6774dd0.37dff","type":"change","z":"98c1572b.950998","name":"create 99 white ballons","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":110,"wires":[["4ad3363.abb25c8"]]},{"id":"3820b99.245ad46","type":"comment","z":"98c1572b.950998","name":"Create a bunch of balloons","info":"","x":790,"y":60,"wires":[]},{"id":"4ad3363.abb25c8","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":980,"y":110,"wires":[]},{"id":"df7247b0.db8768","type":"do-return","z":"98c1572b.950998","name":"","mode":"continue","x":1400,"y":360,"wires":[]},{"id":"e769c079.86492","type":"switch","z":"98c1572b.950998","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1180,"y":380,"wires":[["df7247b0.db8768"],["aea3f92d.c221a8"]]},{"id":"aea3f92d.c221a8","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1390,"y":400,"wires":[]},{"id":"90ebbfb2.b2589","type":"change","z":"98c1572b.950998","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":380,"wires":[["926e8958.bb32f8"]]},{"id":"926e8958.bb32f8","type":"function","z":"98c1572b.950998","name":"paint blue","func":"msg.payload[msg.current_balloon] = \"blue\";\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":380,"wires":[["e769c079.86492"]]},{"id":"a71eb74b.8fe2c8","type":"comment","z":"98c1572b.950998","name":"We want blue balloons","info":"","x":780,"y":330,"wires":[]},{"id":"555582c0.f5f6fc","type":"comment","z":"98c1572b.950998","name":"Let the balloons fly","info":"","x":770,"y":460,"wires":[]},{"id":"b088b485.d767b8","type":"comment","z":"98c1572b.950998","name":"Smiling is always a good idea","info":"","x":800,"y":580,"wires":[]},{"id":"39cf6db8.ea8302","type":"do","z":"98c1572b.950998","name":"Create red balloons","tasks":["Create balloons","Paint them red","Let them fly","Smile"],"outputs":5,"x":320,"y":190,"wires":[["b6774dd0.37dff"],["85a06a9c.110828"],["2014e2ec.7cf63e"],["bfdf8ef2.7266a"],["1ed9cd0.20b0733"]]},{"id":"19ac8522.bc84db","type":"do","z":"98c1572b.950998","name":"Create blue balloons","tasks":["Create ballons","Paint them blue","Smile"],"outputs":4,"x":330,"y":580,"wires":[["b6774dd0.37dff"],["90ebbfb2.b2589"],["bfdf8ef2.7266a"],["1ed9cd0.20b0733"]]},{"id":"2ebeb21e.8bd6ae","type":"inject","z":"98c1572b.950998","name":"Start","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":580,"wires":[["19ac8522.bc84db"]]},{"id":"9202474a.8ed598","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1060,"y":630,"wires":[]},{"id":"54c489d1.9b8168","type":"change","z":"98c1572b.950998","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"So many red balloons flying. Wow! :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":630,"wires":[["9202474a.8ed598"]]},{"id":"bfdf8ef2.7266a","type":"switch","z":"98c1572b.950998","name":"","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":630,"wires":[["54c489d1.9b8168"],["a477229f.34291"]]},{"id":"a477229f.34291","type":"change","z":"98c1572b.950998","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"So many lovely blue balloons. :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":680,"wires":[["9202474a.8ed598"]]}]
[{"id":"98c1572b.950998","type":"tab","label":"overlapping task lists","disabled":false,"info":""},{"id":"febdb7e8.509a88","type":"do-return","z":"98c1572b.950998","name":"","mode":"continue","x":1200,"y":490,"wires":[]},{"id":"1ed9cd0.20b0733","type":"debug","z":"98c1572b.950998","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":750,"wires":[]},{"id":"49763f9.c5a2ac","type":"do-return","z":"98c1572b.950998","name":"","mode":"continue","x":1400,"y":220,"wires":[]},{"id":"a06ba5ae.b74748","type":"switch","z":"98c1572b.950998","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1180,"y":240,"wires":[["49763f9.c5a2ac"],["df3ee4f7.a5a2f8"]]},{"id":"df3ee4f7.a5a2f8","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1390,"y":260,"wires":[]},{"id":"2fcfafc.500b75","type":"inject","z":"98c1572b.950998","name":"Start","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":190,"wires":[["39cf6db8.ea8302"]]},{"id":"ca97a02e.e109e","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1190,"y":530,"wires":[]},{"id":"85a06a9c.110828","type":"change","z":"98c1572b.950998","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":240,"wires":[["d07a273e.cb1a38"]]},{"id":"d07a273e.cb1a38","type":"function","z":"98c1572b.950998","name":"paint red","func":"msg.payload[msg.current_balloon] = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":240,"wires":[["a06ba5ae.b74748"]]},{"id":"2014e2ec.7cf63e","type":"function","z":"98c1572b.950998","name":"let balloon fly","func":"msg.payload.pop();\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":510,"wires":[["b3111487.4c41b8"]]},{"id":"b3111487.4c41b8","type":"switch","z":"98c1572b.950998","name":"more balloons?","property":"payload.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":980,"y":510,"wires":[["febdb7e8.509a88"],["ca97a02e.e109e"]]},{"id":"28668177.9e16de","type":"comment","z":"98c1572b.950998","name":"Description of Overlapping-Task-Lists-Example","info":"Using do-red, you can define different task-lists having some tasks in common. This allows to create e.g. some kind of building plan.\n\nSome tasks are thereby executed in both cases (e.g. creating the ballons) and some are specific for one building plan (e.g. how the ballons get colored or what to do with them afterwards).\n\nThe return node always knows to which do-node it needs to return to.\n\nIn this example we have two building plans: The first creates red ballons and lets them fly, the second creates blue balloons. Blue balloons are not meant for flying, so they are kept for Node-RED to be happy. ;)","x":220,"y":60,"wires":[]},{"id":"79e6cfc5.a8483","type":"comment","z":"98c1572b.950998","name":"We want red balloons","info":"","x":780,"y":190,"wires":[]},{"id":"b6774dd0.37dff","type":"change","z":"98c1572b.950998","name":"create 99 white ballons","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\",\"white\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":110,"wires":[["4ad3363.abb25c8"]]},{"id":"3820b99.245ad46","type":"comment","z":"98c1572b.950998","name":"Create a bunch of balloons","info":"","x":790,"y":60,"wires":[]},{"id":"4ad3363.abb25c8","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":980,"y":110,"wires":[]},{"id":"df7247b0.db8768","type":"do-return","z":"98c1572b.950998","name":"","mode":"continue","x":1400,"y":360,"wires":[]},{"id":"e769c079.86492","type":"switch","z":"98c1572b.950998","name":"more balloons?","property":"current_balloon","propertyType":"msg","rules":[{"t":"lt","v":"$count(msg.payload) - 1","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1180,"y":380,"wires":[["df7247b0.db8768"],["aea3f92d.c221a8"]]},{"id":"aea3f92d.c221a8","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1390,"y":400,"wires":[]},{"id":"90ebbfb2.b2589","type":"change","z":"98c1572b.950998","name":"next balloon","rules":[{"t":"set","p":"current_balloon","pt":"msg","to":"msg.current_balloon >= 0 ? msg.current_balloon + 1 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":380,"wires":[["926e8958.bb32f8"]]},{"id":"926e8958.bb32f8","type":"function","z":"98c1572b.950998","name":"paint blue","func":"msg.payload[msg.current_balloon] = \"blue\";\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":380,"wires":[["e769c079.86492"]]},{"id":"a71eb74b.8fe2c8","type":"comment","z":"98c1572b.950998","name":"We want blue balloons","info":"","x":780,"y":330,"wires":[]},{"id":"555582c0.f5f6fc","type":"comment","z":"98c1572b.950998","name":"Let the balloons fly","info":"","x":770,"y":460,"wires":[]},{"id":"b088b485.d767b8","type":"comment","z":"98c1572b.950998","name":"Smiling is always a good idea","info":"","x":800,"y":580,"wires":[]},{"id":"39cf6db8.ea8302","type":"do","z":"98c1572b.950998","name":"Create red balloons","tasks":["Create balloons","Paint them red","Let them fly","Smile"],"mode":"msg","each":"","eachType":"msg","yield":"keyValue","doneOutput":true,"firstValueOutput":false,"lastValueOutput":false,"outputs":5,"_version":"0.4.1","x":320,"y":190,"wires":[["b6774dd0.37dff"],["85a06a9c.110828"],["2014e2ec.7cf63e"],["bfdf8ef2.7266a"],["1ed9cd0.20b0733"]]},{"id":"19ac8522.bc84db","type":"do","z":"98c1572b.950998","name":"Create blue balloons","tasks":["Create ballons","Paint them blue","Smile"],"mode":"msg","each":"","eachType":"msg","yield":"keyValue","doneOutput":true,"firstValueOutput":false,"lastValueOutput":false,"outputs":4,"_version":"0.4.1","x":330,"y":580,"wires":[["b6774dd0.37dff"],["90ebbfb2.b2589"],["bfdf8ef2.7266a"],["1ed9cd0.20b0733"]]},{"id":"2ebeb21e.8bd6ae","type":"inject","z":"98c1572b.950998","name":"Start","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":580,"wires":[["19ac8522.bc84db"]]},{"id":"9202474a.8ed598","type":"do-return","z":"98c1572b.950998","name":"","mode":"done","x":1060,"y":630,"wires":[]},{"id":"54c489d1.9b8168","type":"change","z":"98c1572b.950998","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"So many red balloons flying. Wow! :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":630,"wires":[["9202474a.8ed598"]]},{"id":"bfdf8ef2.7266a","type":"switch","z":"98c1572b.950998","name":"","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":630,"wires":[["54c489d1.9b8168"],["a477229f.34291"]]},{"id":"a477229f.34291","type":"change","z":"98c1572b.950998","name":"Smile","rules":[{"t":"set","p":"payload","pt":"msg","to":"So many lovely blue balloons. :)","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":680,"wires":[["9202474a.8ed598"]]}]

@@ -1,1605 +0,1 @@

[
{
"id": "a37ba4fb4c0f75b5",
"type": "tab",
"label": "each",
"disabled": false,
"info": ""
},
{
"id": "13801fdd6b5b4fa2",
"type": "group",
"z": "a37ba4fb4c0f75b5",
"name": "",
"style": {
"label": true
},
"nodes": [
"9f805e9c08470329",
"bd3ea16681f75a48",
"6ed13f9be5e114b7",
"ec13c40821918014",
"3572247be8af7f3d",
"db011552a95b3c4b",
"e88ffe5ac5c0e1cc",
"f6abb27126a0451d",
"43ac74b2f62b1a00",
"c64e8966c886ed56",
"c848fbb8bcf13c73",
"fa6c84b86112dacf",
"6d3e7a5685df6118",
"88413b561f1fa8ad",
"8633e8cd8755d41e",
"0b679b604339a0f5",
"2c7a327d51775f1b",
"46f9cf59ba916358",
"fb86275488bfe72d",
"92577a77fc14f3df",
"0a01060611f50b89",
"9dd3cb82ca403cd8",
"6bd6b4852ebd8cef",
"2c687a8db5ad2d7d",
"7fe39e1936da5497"
],
"x": 54,
"y": 39,
"w": 1252,
"h": 622
},
{
"id": "156e48294e15a399",
"type": "group",
"z": "a37ba4fb4c0f75b5",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"3df32a9ffbb5242a",
"a11a09b08407dc50",
"631d6b526bea7e4d",
"0a06ba357340e2d3",
"091b1cb23ef8485e",
"fa63bd549cae8b41",
"e33fc812f873369b",
"333892a0ea4ade46",
"ba827510167634bd",
"004c984fdb5923ca",
"54c16615e721f476",
"9cb922e4f6891085",
"7572d26446ddf8f9"
],
"x": 54,
"y": 1379,
"w": 1132,
"h": 342
},
{
"id": "9df54a142a4bddf1",
"type": "group",
"z": "a37ba4fb4c0f75b5",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"c712565fe629a8b5",
"89b76248799543f0",
"098245f2db6a16ce",
"59d31a51e31dd8aa",
"663353f613d517ab",
"4f69b439ce7b954e",
"6e060feb4ec85989",
"04b5a2ec2c7ea1b9",
"e74cafe822752aee",
"f657e43da9571001",
"dc2c9c21b92ad433",
"9be31c0756c32141",
"5d2debdf8162371b",
"d49352494dc53b12",
"80e1a07a26db735b",
"e75b5f7903ac8597",
"944458cb4ec11494",
"bf491cbe1425c4d2",
"d562b47c01c791c3",
"19015160fcdf862f",
"62b55aab9f60e142",
"da789c49f0b2f636",
"36ced97cf601143d",
"a4704c83cdbea31e",
"69a43c2e8b7b3aec",
"052c6324621a0ee4",
"83fbcfa575479023",
"4238567a740c868e",
"de5035e88890d192",
"f4d933bac346eff7"
],
"x": 54,
"y": 719,
"w": 952,
"h": 622
},
{
"id": "9f805e9c08470329",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "the inject value",
"payloadType": "str",
"x": 150,
"y": 220,
"wires": [
[
"fa6c84b86112dacf"
]
]
},
{
"id": "bd3ea16681f75a48",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"tasks": [
"Task0",
"Task1"
],
"mode": "each",
"each": "balloons",
"eachType": "msg",
"yield": "value",
"doneOutput": true,
"outputs": 3,
"_version": "0.3.5",
"x": 460,
"y": 220,
"wires": [
[
"ec13c40821918014"
],
[
"e88ffe5ac5c0e1cc"
],
[
"c848fbb8bcf13c73"
]
]
},
{
"id": "6ed13f9be5e114b7",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "balloons :)",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 100,
"wires": []
},
{
"id": "ec13c40821918014",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "shout ballons",
"func": "if (msg._do.keys) {\n const ballonColor = msg._do.keys[msg._do.index]\n const amount = msg.payload[ballonColor]\n \n msg.payload = 'Wow there are ' + amount + ' ' + ballonColor + ' baloons!'\n return msg; \n} else {\n msg.payload = \"Wow it's a \" + msg.payload + ' balloon!'\n return msg;\n}\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 120,
"wires": [
[
"6ed13f9be5e114b7",
"db011552a95b3c4b"
]
]
},
{
"id": "3572247be8af7f3d",
"type": "comment",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "Iterate",
"info": "You can iterate through a collection.\nThis means each value of your collection will walk through all tasks. Then the next value will do the same.\nThe first and last value are marked in msg._do.isFirstMsg / isLastMsg.\n\nIn this example we iterate an array and send a msg in the debugger with the current color. We don't change the value.",
"x": 150,
"y": 80,
"wires": []
},
{
"id": "c712565fe629a8b5",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"tasks": [
"Task0"
],
"mode": "each",
"each": "payload",
"eachType": "msg",
"yield": "value",
"doneOutput": true,
"firstValueOutput": "",
"lastValueOutput": "",
"outputs": 2,
"_version": "0.3.5",
"x": 480,
"y": 820,
"wires": [
[
"59d31a51e31dd8aa"
],
[
"6e060feb4ec85989"
]
]
},
{
"id": "89b76248799543f0",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"mode": "done",
"saveValue": true,
"x": 910,
"y": 800,
"wires": []
},
{
"id": "098245f2db6a16ce",
"type": "comment",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "Change value",
"info": "In this example we get each value of an array and want to overwrite it with 'red'.",
"x": 150,
"y": 760,
"wires": []
},
{
"id": "59d31a51e31dd8aa",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint it red",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "red",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 690,
"y": 800,
"wires": [
[
"89b76248799543f0"
]
]
},
{
"id": "663353f613d517ab",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "array",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "['white','blue','green', 'red', 'yellow', 'brown']",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 820,
"wires": [
[
"c712565fe629a8b5"
]
]
},
{
"id": "4f69b439ce7b954e",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "painting",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "paint",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 820,
"wires": [
[
"663353f613d517ab"
]
]
},
{
"id": "3df32a9ffbb5242a",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "remove from array",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "remove",
"payloadType": "date",
"x": 190,
"y": 1480,
"wires": [
[
"631d6b526bea7e4d"
]
]
},
{
"id": "a11a09b08407dc50",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "each value-index",
"tasks": [
"Task0"
],
"mode": "each",
"each": "payload",
"eachType": "msg",
"yield": "indexValue",
"doneOutput": true,
"firstValueOutput": "",
"lastValueOutput": "",
"outputs": 2,
"_version": "0.3.5",
"x": 630,
"y": 1480,
"wires": [
[
"091b1cb23ef8485e"
],
[
"fa63bd549cae8b41"
]
]
},
{
"id": "631d6b526bea7e4d",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "ballons :)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "['white','blue','green', 'red', 'yellow', 'brown']",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 420,
"y": 1480,
"wires": [
[
"a11a09b08407dc50"
]
]
},
{
"id": "db011552a95b3c4b",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"mode": "done",
"saveValue": false,
"x": 910,
"y": 140,
"wires": []
},
{
"id": "e88ffe5ac5c0e1cc",
"type": "switch",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "is last balloon?",
"property": "_do.isLastMsg",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 720,
"y": 220,
"wires": [
[
"c64e8966c886ed56"
],
[
"43ac74b2f62b1a00"
]
]
},
{
"id": "f6abb27126a0451d",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "stop watching",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1180,
"y": 200,
"wires": []
},
{
"id": "43ac74b2f62b1a00",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"mode": "done",
"saveValue": false,
"x": 1150,
"y": 240,
"wires": []
},
{
"id": "c64e8966c886ed56",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "stop watching",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Oh that's the last one! :(",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 940,
"y": 200,
"wires": [
[
"f6abb27126a0451d",
"43ac74b2f62b1a00"
]
]
},
{
"id": "c848fbb8bcf13c73",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "done -> let`s go on with the flow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 770,
"y": 300,
"wires": []
},
{
"id": "0a06ba357340e2d3",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "",
"mode": "done",
"saveValue": true,
"x": 1110,
"y": 1440,
"wires": []
},
{
"id": "091b1cb23ef8485e",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "only red allowed",
"func": "const value = Object.values(msg.payload)[0]\n\nif (value !== 'red') msg.payload = { undefined: undefined }\nreturn msg",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 880,
"y": 1440,
"wires": [
[
"0a06ba357340e2d3"
]
]
},
{
"id": "fa63bd549cae8b41",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "remaining balloons",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 890,
"y": 1500,
"wires": []
},
{
"id": "6e060feb4ec85989",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "all balloons are red",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 840,
"wires": []
},
{
"id": "04b5a2ec2c7ea1b9",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "each key",
"tasks": [
"Task0"
],
"mode": "each",
"each": "balloons",
"eachType": "msg",
"yield": "key",
"doneOutput": true,
"firstValueOutput": "",
"lastValueOutput": "",
"outputs": 2,
"_version": "0.3.5",
"x": 480,
"y": 980,
"wires": [
[
"dc2c9c21b92ad433"
],
[
"5d2debdf8162371b"
]
]
},
{
"id": "e74cafe822752aee",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "object",
"rules": [
{
"t": "set",
"p": "balloons",
"pt": "msg",
"to": "{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 980,
"wires": [
[
"04b5a2ec2c7ea1b9"
]
]
},
{
"id": "f657e43da9571001",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "paint",
"payloadType": "date",
"x": 150,
"y": 980,
"wires": [
[
"e74cafe822752aee"
]
]
},
{
"id": "dc2c9c21b92ad433",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint white stripes",
"func": "msg.payload = msg.payload + \"_with_white_stripes\" \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 960,
"wires": [
[
"9be31c0756c32141"
]
]
},
{
"id": "9be31c0756c32141",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"mode": "done",
"saveValue": true,
"x": 910,
"y": 960,
"wires": []
},
{
"id": "5d2debdf8162371b",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "all balloons are painted (msg.balloons)",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "balloons",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 770,
"y": 1000,
"wires": []
},
{
"id": "e33fc812f873369b",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "each key",
"tasks": [
"Task0"
],
"mode": "each",
"each": "payload",
"eachType": "msg",
"yield": "key",
"doneOutput": true,
"outputs": 2,
"_version": "0.3.5",
"x": 600,
"y": 1640,
"wires": [
[
"004c984fdb5923ca"
],
[
"7572d26446ddf8f9"
]
]
},
{
"id": "333892a0ea4ade46",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "object",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 410,
"y": 1640,
"wires": [
[
"e33fc812f873369b"
]
]
},
{
"id": "ba827510167634bd",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "remove keys from object",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "paint",
"payloadType": "date",
"x": 210,
"y": 1640,
"wires": [
[
"333892a0ea4ade46"
]
]
},
{
"id": "004c984fdb5923ca",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "remove green and lila",
"func": "let checkThis = msg.payload\n\nif (typeof msg.payload !== 'string') {\n checkThis = Object.keys(msg.payload)[0]\n}\nif (checkThis === 'green' || checkThis === 'lila') msg.payload = undefined \n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 1620,
"wires": [
[
"54c16615e721f476"
]
]
},
{
"id": "54c16615e721f476",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "",
"mode": "done",
"saveValue": true,
"x": 1110,
"y": 1620,
"wires": []
},
{
"id": "9cb922e4f6891085",
"type": "comment",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "Remove",
"info": "Array: If you want to remove an index you have to set the index to undefined.\n\nObject: If you want to delete an key, set the key to undefined.",
"x": 140,
"y": 1420,
"wires": []
},
{
"id": "7572d26446ddf8f9",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "156e48294e15a399",
"name": "remaining balloons",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 890,
"y": 1680,
"wires": []
},
{
"id": "fa6c84b86112dacf",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "array",
"rules": [
{
"t": "set",
"p": "balloons",
"pt": "msg",
"to": "['red','blue','green', 'yellow', 'brown']",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 220,
"wires": [
[
"bd3ea16681f75a48"
]
]
},
{
"id": "6d3e7a5685df6118",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "my payload value",
"payloadType": "str",
"x": 150,
"y": 500,
"wires": [
[
"8633e8cd8755d41e"
]
]
},
{
"id": "88413b561f1fa8ad",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"tasks": [
"forgot to look"
],
"mode": "each",
"each": "balloons",
"eachType": "msg",
"yield": "value",
"doneOutput": true,
"firstValueOutput": true,
"lastValueOutput": true,
"outputs": 4,
"_version": "0.3.5",
"x": 460,
"y": 500,
"wires": [
[
"2c687a8db5ad2d7d"
],
[
"6bd6b4852ebd8cef"
],
[
"fb86275488bfe72d"
],
[
"0a01060611f50b89"
]
]
},
{
"id": "8633e8cd8755d41e",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "array",
"rules": [
{
"t": "set",
"p": "balloons",
"pt": "msg",
"to": "['red','blue','green', 'yellow', 'brown']",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 500,
"wires": [
[
"88413b561f1fa8ad"
]
]
},
{
"id": "0b679b604339a0f5",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "first balloon spotted",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 970,
"y": 380,
"wires": []
},
{
"id": "2c7a327d51775f1b",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"mode": "done",
"saveValue": false,
"x": 930,
"y": 420,
"wires": []
},
{
"id": "46f9cf59ba916358",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"mode": "done",
"saveValue": false,
"x": 930,
"y": 500,
"wires": []
},
{
"id": "fb86275488bfe72d",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "oh no the last one",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "'Oh no! I just saw the last balloon. It was a ' & msg.payload & ' one!'",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 560,
"wires": [
[
"92577a77fc14f3df",
"9dd3cb82ca403cd8"
]
]
},
{
"id": "92577a77fc14f3df",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "",
"mode": "done",
"saveValue": false,
"x": 930,
"y": 580,
"wires": []
},
{
"id": "0a01060611f50b89",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "done -> let`s go on with the flow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 750,
"y": 620,
"wires": []
},
{
"id": "9dd3cb82ca403cd8",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "last balloon spotted",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 970,
"y": 540,
"wires": []
},
{
"id": "6bd6b4852ebd8cef",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "missed balloon",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "\"I didn't noticed the \" & msg.payload & \" balloon!\"",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 480,
"wires": [
[
"46f9cf59ba916358",
"7fe39e1936da5497"
]
]
},
{
"id": "2c687a8db5ad2d7d",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "spotted first ballon",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "'Wow! I saw a ' & msg.payload & ' balloon!'",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 420,
"wires": [
[
"2c7a327d51775f1b",
"0b679b604339a0f5"
]
]
},
{
"id": "7fe39e1936da5497",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "13801fdd6b5b4fa2",
"name": "missed balloon",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 960,
"y": 460,
"wires": []
},
{
"id": "d49352494dc53b12",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "each key",
"tasks": [
"Task0"
],
"mode": "each",
"each": "payload",
"eachType": "msg",
"yield": "key",
"doneOutput": true,
"firstValueOutput": true,
"lastValueOutput": true,
"outputs": 4,
"_version": "0.3.5",
"x": 480,
"y": 1220,
"wires": [
[
"62b55aab9f60e142"
],
[
"944458cb4ec11494"
],
[
"da789c49f0b2f636"
],
[
"d562b47c01c791c3"
]
]
},
{
"id": "80e1a07a26db735b",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "object",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 1220,
"wires": [
[
"d49352494dc53b12"
]
]
},
{
"id": "e75b5f7903ac8597",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "paint",
"payloadType": "date",
"x": 150,
"y": 1220,
"wires": [
[
"80e1a07a26db735b"
]
]
},
{
"id": "944458cb4ec11494",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint white stripes",
"func": "msg.payload = msg.payload + \"_with_white_stripes\" \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 1220,
"wires": [
[
"bf491cbe1425c4d2"
]
]
},
{
"id": "bf491cbe1425c4d2",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"mode": "done",
"saveValue": true,
"x": 930,
"y": 1220,
"wires": []
},
{
"id": "d562b47c01c791c3",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "all balloons are painted",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 1300,
"wires": []
},
{
"id": "19015160fcdf862f",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"mode": "done",
"saveValue": true,
"x": 930,
"y": 1180,
"wires": []
},
{
"id": "62b55aab9f60e142",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint black stripes",
"func": "msg.payload = msg.payload + \"_with_black_stripes\" \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 1180,
"wires": [
[
"19015160fcdf862f"
]
]
},
{
"id": "da789c49f0b2f636",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "paint green stripes",
"func": "msg.payload = msg.payload + \"_with_green_stripes\" \nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 1260,
"wires": [
[
"36ced97cf601143d"
]
]
},
{
"id": "36ced97cf601143d",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"mode": "done",
"saveValue": true,
"x": 930,
"y": 1260,
"wires": []
},
{
"id": "a4704c83cdbea31e",
"type": "comment",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "handle first/last value different",
"info": "In this example we get each value of an array and want to overwrite it with 'red'.",
"x": 200,
"y": 1180,
"wires": []
},
{
"id": "69a43c2e8b7b3aec",
"type": "do",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "each key",
"tasks": [
"Task0"
],
"mode": "each",
"each": "payload",
"eachType": "msg",
"yield": "keyValue",
"doneOutput": true,
"firstValueOutput": "",
"lastValueOutput": "",
"outputs": 2,
"_version": "0.3.5",
"x": 480,
"y": 1080,
"wires": [
[
"4238567a740c868e"
],
[
"f4d933bac346eff7"
]
]
},
{
"id": "052c6324621a0ee4",
"type": "change",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "object",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}",
"tot": "json"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 1080,
"wires": [
[
"69a43c2e8b7b3aec"
]
]
},
{
"id": "83fbcfa575479023",
"type": "inject",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "release",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "release",
"payload": "",
"payloadType": "date",
"x": 150,
"y": 1080,
"wires": [
[
"052c6324621a0ee4"
]
]
},
{
"id": "4238567a740c868e",
"type": "function",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "released balloons",
"func": "msg.payload[Object.keys(msg.payload)[0]] = 0\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 710,
"y": 1060,
"wires": [
[
"de5035e88890d192"
]
]
},
{
"id": "de5035e88890d192",
"type": "do-return",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "",
"mode": "done",
"saveValue": false,
"x": 910,
"y": 1060,
"wires": []
},
{
"id": "f4d933bac346eff7",
"type": "debug",
"z": "a37ba4fb4c0f75b5",
"g": "9df54a142a4bddf1",
"name": "all balloons are released (msg.payload)",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 780,
"y": 1100,
"wires": []
}
]
[{"id":"a37ba4fb4c0f75b5","type":"tab","label":"each","disabled":false,"info":""},{"id":"13801fdd6b5b4fa2","type":"group","z":"a37ba4fb4c0f75b5","name":"","style":{"label":true},"nodes":["9f805e9c08470329","bd3ea16681f75a48","6ed13f9be5e114b7","ec13c40821918014","3572247be8af7f3d","db011552a95b3c4b","e88ffe5ac5c0e1cc","f6abb27126a0451d","43ac74b2f62b1a00","c64e8966c886ed56","c848fbb8bcf13c73","fa6c84b86112dacf","6d3e7a5685df6118","88413b561f1fa8ad","8633e8cd8755d41e","0b679b604339a0f5","2c7a327d51775f1b","46f9cf59ba916358","fb86275488bfe72d","92577a77fc14f3df","0a01060611f50b89","9dd3cb82ca403cd8","6bd6b4852ebd8cef","2c687a8db5ad2d7d","7fe39e1936da5497"],"x":54,"y":39,"w":1252,"h":622},{"id":"156e48294e15a399","type":"group","z":"a37ba4fb4c0f75b5","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["3df32a9ffbb5242a","a11a09b08407dc50","631d6b526bea7e4d","0a06ba357340e2d3","091b1cb23ef8485e","fa63bd549cae8b41","e33fc812f873369b","333892a0ea4ade46","ba827510167634bd","004c984fdb5923ca","54c16615e721f476","9cb922e4f6891085","7572d26446ddf8f9"],"x":54,"y":1379,"w":1132,"h":342},{"id":"9df54a142a4bddf1","type":"group","z":"a37ba4fb4c0f75b5","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["c712565fe629a8b5","89b76248799543f0","098245f2db6a16ce","59d31a51e31dd8aa","663353f613d517ab","4f69b439ce7b954e","6e060feb4ec85989","04b5a2ec2c7ea1b9","e74cafe822752aee","f657e43da9571001","dc2c9c21b92ad433","9be31c0756c32141","5d2debdf8162371b","d49352494dc53b12","80e1a07a26db735b","e75b5f7903ac8597","944458cb4ec11494","bf491cbe1425c4d2","d562b47c01c791c3","19015160fcdf862f","62b55aab9f60e142","da789c49f0b2f636","36ced97cf601143d","a4704c83cdbea31e","69a43c2e8b7b3aec","052c6324621a0ee4","83fbcfa575479023","4238567a740c868e","de5035e88890d192","f4d933bac346eff7"],"x":54,"y":719,"w":952,"h":622},{"id":"9f805e9c08470329","type":"inject","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"the inject value","payloadType":"str","x":150,"y":220,"wires":[["fa6c84b86112dacf"]]},{"id":"bd3ea16681f75a48","type":"do","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","tasks":["Task0","Task1"],"mode":"each","each":"balloons","eachType":"msg","yield":"value","doneOutput":true,"firstValueOutput":false,"lastValueOutput":false,"outputs":3,"_version":"0.4.1","x":460,"y":220,"wires":[["ec13c40821918014"],["e88ffe5ac5c0e1cc"],["c848fbb8bcf13c73"]]},{"id":"6ed13f9be5e114b7","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"balloons :)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":100,"wires":[]},{"id":"ec13c40821918014","type":"function","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"shout ballons","func":"if (msg._do.keys) {\n const ballonColor = msg._do.keys[msg._do.index]\n const amount = msg.payload[ballonColor]\n \n msg.payload = 'Wow there are ' + amount + ' ' + ballonColor + ' baloons!'\n return msg; \n} else {\n msg.payload = \"Wow it's a \" + msg.payload + ' balloon!'\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":120,"wires":[["6ed13f9be5e114b7","db011552a95b3c4b"]]},{"id":"3572247be8af7f3d","type":"comment","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"Iterate","info":"You can iterate through a collection.\nThis means each value of your collection will walk through all tasks. Then the next value will do the same.\nThe first and last value are marked in msg._do.isFirstMsg / isLastMsg.\n\nIn this example we iterate an array and send a msg in the debugger with the current color. We don't change the value.","x":150,"y":80,"wires":[]},{"id":"c712565fe629a8b5","type":"do","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","tasks":["Task0"],"mode":"each","each":"payload","eachType":"msg","yield":"value","doneOutput":true,"firstValueOutput":"","lastValueOutput":"","outputs":2,"_version":"0.4.1","x":480,"y":820,"wires":[["59d31a51e31dd8aa"],["6e060feb4ec85989"]]},{"id":"89b76248799543f0","type":"do-return","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","mode":"done","saveValue":true,"x":910,"y":800,"wires":[]},{"id":"098245f2db6a16ce","type":"comment","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"Change value","info":"In this example we get each value of an array and want to overwrite it with 'red'.","x":150,"y":760,"wires":[]},{"id":"59d31a51e31dd8aa","type":"change","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint it red","rules":[{"t":"set","p":"payload","pt":"msg","to":"red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":800,"wires":[["89b76248799543f0"]]},{"id":"663353f613d517ab","type":"change","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"array","rules":[{"t":"set","p":"payload","pt":"msg","to":"['white','blue','green', 'red', 'yellow', 'brown']","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":820,"wires":[["c712565fe629a8b5"]]},{"id":"4f69b439ce7b954e","type":"inject","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"painting","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"paint","payload":"","payloadType":"date","x":150,"y":820,"wires":[["663353f613d517ab"]]},{"id":"3df32a9ffbb5242a","type":"inject","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"remove from array","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"remove","payloadType":"date","x":190,"y":1480,"wires":[["631d6b526bea7e4d"]]},{"id":"a11a09b08407dc50","type":"do","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"each value-index","tasks":["Task0"],"mode":"each","each":"payload","eachType":"msg","yield":"indexValue","doneOutput":true,"firstValueOutput":"","lastValueOutput":"","outputs":2,"_version":"0.4.1","x":630,"y":1480,"wires":[["091b1cb23ef8485e"],["fa63bd549cae8b41"]]},{"id":"631d6b526bea7e4d","type":"change","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"ballons :)","rules":[{"t":"set","p":"payload","pt":"msg","to":"['white','blue','green', 'red', 'yellow', 'brown']","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1480,"wires":[["a11a09b08407dc50"]]},{"id":"db011552a95b3c4b","type":"do-return","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","mode":"done","saveValue":false,"x":910,"y":140,"wires":[]},{"id":"e88ffe5ac5c0e1cc","type":"switch","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"is last balloon?","property":"_do.isLastMsg","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":720,"y":220,"wires":[["c64e8966c886ed56"],["43ac74b2f62b1a00"]]},{"id":"f6abb27126a0451d","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"stop watching","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":200,"wires":[]},{"id":"43ac74b2f62b1a00","type":"do-return","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","mode":"done","saveValue":false,"x":1150,"y":240,"wires":[]},{"id":"c64e8966c886ed56","type":"change","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"stop watching","rules":[{"t":"set","p":"payload","pt":"msg","to":"Oh that's the last one! :(","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":200,"wires":[["f6abb27126a0451d","43ac74b2f62b1a00"]]},{"id":"c848fbb8bcf13c73","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"done -> let`s go on with the flow","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":300,"wires":[]},{"id":"0a06ba357340e2d3","type":"do-return","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"","mode":"done","saveValue":true,"x":1110,"y":1440,"wires":[]},{"id":"091b1cb23ef8485e","type":"function","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"only red allowed","func":"const value = Object.values(msg.payload)[0]\n\nif (value !== 'red') msg.payload = { undefined: undefined }\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":1440,"wires":[["0a06ba357340e2d3"]]},{"id":"fa63bd549cae8b41","type":"debug","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"remaining balloons","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":1500,"wires":[]},{"id":"6e060feb4ec85989","type":"debug","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"all balloons are red","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":840,"wires":[]},{"id":"04b5a2ec2c7ea1b9","type":"do","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"each key","tasks":["Task0"],"mode":"each","each":"balloons","eachType":"msg","yield":"key","doneOutput":true,"firstValueOutput":"","lastValueOutput":"","outputs":2,"_version":"0.4.1","x":480,"y":980,"wires":[["dc2c9c21b92ad433"],["5d2debdf8162371b"]]},{"id":"e74cafe822752aee","type":"change","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"object","rules":[{"t":"set","p":"balloons","pt":"msg","to":"{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":980,"wires":[["04b5a2ec2c7ea1b9"]]},{"id":"f657e43da9571001","type":"inject","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"paint","payloadType":"date","x":150,"y":980,"wires":[["e74cafe822752aee"]]},{"id":"dc2c9c21b92ad433","type":"function","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint white stripes","func":"msg.payload = msg.payload + \"_with_white_stripes\" \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":960,"wires":[["9be31c0756c32141"]]},{"id":"9be31c0756c32141","type":"do-return","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","mode":"done","saveValue":true,"x":910,"y":960,"wires":[]},{"id":"5d2debdf8162371b","type":"debug","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"all balloons are painted (msg.balloons)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"balloons","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":1000,"wires":[]},{"id":"e33fc812f873369b","type":"do","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"each key","tasks":["Task0"],"mode":"each","each":"payload","eachType":"msg","yield":"key","doneOutput":true,"firstValueOutput":false,"lastValueOutput":false,"outputs":2,"_version":"0.4.1","x":600,"y":1640,"wires":[["004c984fdb5923ca"],["7572d26446ddf8f9"]]},{"id":"333892a0ea4ade46","type":"change","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"object","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":1640,"wires":[["e33fc812f873369b"]]},{"id":"ba827510167634bd","type":"inject","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"remove keys from object","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"paint","payloadType":"date","x":210,"y":1640,"wires":[["333892a0ea4ade46"]]},{"id":"004c984fdb5923ca","type":"function","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"remove green and lila","func":"let checkThis = msg.payload\n\nif (typeof msg.payload !== 'string') {\n checkThis = Object.keys(msg.payload)[0]\n}\nif (checkThis === 'green' || checkThis === 'lila') msg.payload = undefined \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":1620,"wires":[["54c16615e721f476"]]},{"id":"54c16615e721f476","type":"do-return","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"","mode":"done","saveValue":true,"x":1110,"y":1620,"wires":[]},{"id":"9cb922e4f6891085","type":"comment","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"Remove","info":"Array: If you want to remove an index you have to set the index to undefined.\n\nObject: If you want to delete an key, set the key to undefined.","x":140,"y":1420,"wires":[]},{"id":"7572d26446ddf8f9","type":"debug","z":"a37ba4fb4c0f75b5","g":"156e48294e15a399","name":"remaining balloons","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":1680,"wires":[]},{"id":"fa6c84b86112dacf","type":"change","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"array","rules":[{"t":"set","p":"balloons","pt":"msg","to":"['red','blue','green', 'yellow', 'brown']","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":220,"wires":[["bd3ea16681f75a48"]]},{"id":"6d3e7a5685df6118","type":"inject","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"my payload value","payloadType":"str","x":150,"y":500,"wires":[["8633e8cd8755d41e"]]},{"id":"88413b561f1fa8ad","type":"do","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","tasks":["forgot to look"],"mode":"each","each":"balloons","eachType":"msg","yield":"value","doneOutput":true,"firstValueOutput":true,"lastValueOutput":true,"outputs":4,"_version":"0.4.1","x":460,"y":500,"wires":[["2c687a8db5ad2d7d"],["6bd6b4852ebd8cef"],["fb86275488bfe72d"],["0a01060611f50b89"]]},{"id":"8633e8cd8755d41e","type":"change","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"array","rules":[{"t":"set","p":"balloons","pt":"msg","to":"['red','blue','green', 'yellow', 'brown']","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":500,"wires":[["88413b561f1fa8ad"]]},{"id":"0b679b604339a0f5","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"first balloon spotted","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":380,"wires":[]},{"id":"2c7a327d51775f1b","type":"do-return","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","mode":"done","saveValue":false,"x":930,"y":420,"wires":[]},{"id":"46f9cf59ba916358","type":"do-return","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","mode":"done","saveValue":false,"x":930,"y":500,"wires":[]},{"id":"fb86275488bfe72d","type":"change","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"oh no the last one","rules":[{"t":"set","p":"payload","pt":"msg","to":"'Oh no! I just saw the last balloon. It was a ' & msg.payload & ' one!'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":560,"wires":[["92577a77fc14f3df","9dd3cb82ca403cd8"]]},{"id":"92577a77fc14f3df","type":"do-return","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"","mode":"done","saveValue":false,"x":930,"y":580,"wires":[]},{"id":"0a01060611f50b89","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"done -> let`s go on with the flow","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":620,"wires":[]},{"id":"9dd3cb82ca403cd8","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"last balloon spotted","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":540,"wires":[]},{"id":"6bd6b4852ebd8cef","type":"change","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"missed balloon","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"I didn't noticed the \" & msg.payload & \" balloon!\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":480,"wires":[["46f9cf59ba916358","7fe39e1936da5497"]]},{"id":"2c687a8db5ad2d7d","type":"change","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"spotted first ballon","rules":[{"t":"set","p":"payload","pt":"msg","to":"'Wow! I saw a ' & msg.payload & ' balloon!'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":420,"wires":[["2c7a327d51775f1b","0b679b604339a0f5"]]},{"id":"7fe39e1936da5497","type":"debug","z":"a37ba4fb4c0f75b5","g":"13801fdd6b5b4fa2","name":"missed balloon","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":960,"y":460,"wires":[]},{"id":"d49352494dc53b12","type":"do","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"each key","tasks":["Task0"],"mode":"each","each":"payload","eachType":"msg","yield":"key","doneOutput":true,"firstValueOutput":true,"lastValueOutput":true,"outputs":4,"_version":"0.4.1","x":480,"y":1220,"wires":[["62b55aab9f60e142"],["944458cb4ec11494"],["da789c49f0b2f636"],["d562b47c01c791c3"]]},{"id":"80e1a07a26db735b","type":"change","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"object","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":1220,"wires":[["d49352494dc53b12"]]},{"id":"e75b5f7903ac8597","type":"inject","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"paint","payloadType":"date","x":150,"y":1220,"wires":[["80e1a07a26db735b"]]},{"id":"944458cb4ec11494","type":"function","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint white stripes","func":"msg.payload = msg.payload + \"_with_white_stripes\" \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":1220,"wires":[["bf491cbe1425c4d2"]]},{"id":"bf491cbe1425c4d2","type":"do-return","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","mode":"done","saveValue":true,"x":930,"y":1220,"wires":[]},{"id":"d562b47c01c791c3","type":"debug","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"all balloons are painted","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":1300,"wires":[]},{"id":"19015160fcdf862f","type":"do-return","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","mode":"done","saveValue":true,"x":930,"y":1180,"wires":[]},{"id":"62b55aab9f60e142","type":"function","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint black stripes","func":"msg.payload = msg.payload + \"_with_black_stripes\" \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":1180,"wires":[["19015160fcdf862f"]]},{"id":"da789c49f0b2f636","type":"function","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"paint green stripes","func":"msg.payload = msg.payload + \"_with_green_stripes\" \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":1260,"wires":[["36ced97cf601143d"]]},{"id":"36ced97cf601143d","type":"do-return","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","mode":"done","saveValue":true,"x":930,"y":1260,"wires":[]},{"id":"a4704c83cdbea31e","type":"comment","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"handle first/last value different","info":"In this example we get each value of an array and want to overwrite it with 'red'.","x":200,"y":1180,"wires":[]},{"id":"69a43c2e8b7b3aec","type":"do","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"each key","tasks":["Task0"],"mode":"each","each":"payload","eachType":"msg","yield":"keyValue","doneOutput":true,"firstValueOutput":"","lastValueOutput":"","outputs":2,"_version":"0.4.1","x":480,"y":1080,"wires":[["4238567a740c868e"],["f4d933bac346eff7"]]},{"id":"052c6324621a0ee4","type":"change","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"object","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"red\":10,\"green\":12,\"blue\":15,\"lila\":7,\"purple\":5}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":1080,"wires":[["69a43c2e8b7b3aec"]]},{"id":"83fbcfa575479023","type":"inject","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"release","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"release","payload":"","payloadType":"date","x":150,"y":1080,"wires":[["052c6324621a0ee4"]]},{"id":"4238567a740c868e","type":"function","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"released balloons","func":"msg.payload[Object.keys(msg.payload)[0]] = 0\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":1060,"wires":[["de5035e88890d192"]]},{"id":"de5035e88890d192","type":"do-return","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"","mode":"done","saveValue":false,"x":910,"y":1060,"wires":[]},{"id":"f4d933bac346eff7","type":"debug","z":"a37ba4fb4c0f75b5","g":"9df54a142a4bddf1","name":"all balloons are released (msg.payload)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":1100,"wires":[]}]
{
"name": "do-red",
"version": "0.4.0",
"version": "0.4.1",
"description": "A do-node and corresponding return-node for creating loops and task-lists.",

@@ -42,7 +42,7 @@ "author": "Christian Geiger",

"standard": "^17.1.0",
"svelte-integration-red": "^1.19.6"
"svelte-integration-red": "^1.20.0"
},
"scripts": {
"setup": "cd /home/gitpod/.node-red/ && npm link /workspace/do-red --save && cd /workspace/do-red"
"setup": "echo '---- on gitpod: run node-red once before using npm run setup ---' && npm install && cd /home/gitpod/.node-red/ && npm link /workspace/do-red --save && cd /workspace/do-red"
}
}

@@ -205,3 +205,3 @@ /* global RED */

sourcePort: link.sourcePort,
target: newNode,
target: RED.nodes.node(newNode.id), // since NR 3 is a Node a ProxyObject
x1: link.x1,

@@ -326,3 +326,3 @@ x2: link.x2,

sourcePort: portNumber,
target: RED.nodes.node(newNode.id)
target: RED.nodes.node(newNode.id) // since NR 3 is a Node a ProxyObject
}

@@ -329,0 +329,0 @@ RED.nodes.addLink(link)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc