In my flow, I used some kind of hashing function in a Change node JSONata. This operation happens multiple times, in multiple flows and each time I have to copy/paste my node and change the paths.
I fear the day I'll change the function, finding all the nodes and updating them. Is there a way to "create" a JSONata function (says $hash()) and use it in multiple nodes?
I found a feature request about that but that's for creating module. I imagine something more like the Function library.
Is this already feasible? If not, is it a good idea?
One approach would be to put that Change node into a Subflow and then use instances of the subflow wherever you need the function - leaving you one place to edit the function.
The possible downside is it would operate on the same message property with all instances - so would you may need to do something around the subflow instances to move what you wanted to hash to a common property and then move it back afterwards.
As for registering custom JSONata functions in the flow, if someone wanted to propose how that would work in practise, then we could certainly consider it.
Right now I used an env var (only parameter I could set in a subflow) to give a path in msg and use a recursive function to change it in place. I stumble upon JSONata Transform and that's very close.
If I can help this project, that would be a pleasure! Could you point me to the first steps?