I've been working through this over the last year plus in node, and ended up deciding with my team earlier this year to build a library that makes this easier to understand and work with.
It's early yet, and explicit I/O mapping is not quite there at the moment, but you're welcome to check it out. Feedback is welcome.
I'm building some software on using it is kind of cumbersome