got the answer to my own question, at least for the first part.
[{"id":"300dacd9.0ac534","type":"function","z":"c0e2e862.88aff","name":"Build Array","func":"var buffer_size=10; \nif (!context.buffer || context.buffer.length==10) {\n context.buffer = [];\n}\n\nif(context.buffer.length<buffer_size){\n context.buffer.push(msg.payload);\n var t = context.buffer.length;\n node.status({fill:\"blue\",shape:\"ring\",text:t});\n}\n\nif (context.buffer.length==buffer_size){\n msg.payload = context.buffer;\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1130,"y":1040,"wires":[["bf118f20.71866"]]},{"id":"166eb1e7.cc22be","type":"inject","z":"c0e2e862.88aff","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":720,"y":980,"wires":[["3aa4a6a7.603702"]]},{"id":"bf118f20.71866","type":"debug","z":"c0e2e862.88aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1270,"y":1080,"wires":[]},{"id":"3aa4a6a7.603702","type":"function","z":"c0e2e862.88aff","name":"Value injected in the array","func":"if(!context.value){\n context.value = 0; \n}\n\n\nif(msg.payload){\n \n msg.payload = context.value;\n node.status({fill:\"blue\",shape:\"ring\",text:context.value});\n context.value++;\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":920,"y":1020,"wires":[["300dacd9.0ac534"]]}]