Is saving flows (per tab) in database any easier in node-red 1.0?

I've been playing with node-red for awhile now as a hobby but dreaming I could use it on my day job where we create RESTful json apis using node.js.

After looking pretty hard I've not found good solutions to:

a. All the flows in one giant json file (we will have hundreds of flows created by different teams where we have to restrict access who can access and edit which flows - having all that in one single giant json file is a non-starter)

b. Storing the flows in a database instead of the file system (I've studied the storage api and tried out e.g. node-red-flows-mongo but am I right the save part of the storage api assumes you are saving all the flows at once i.e. "a" above).

I know a lot has been happening re the editor/run-time split and the 1.0 beta release - is there anything with this work that would provide hooks I could plug-in to customize the above?

e.g. I wish the editor and storage api had something where the user would save their changes to the flow on a single tab and POST the json for just that flow to be saved.

The closest I see to that is saveLibraryEntry but I confess I've not tried to use the library features at all... is it conceivable I could save each of my tabs flows as individual "library entries" as database records, and then have my "getFlows" query those to dynamically aggregate back together the giant all-flows json?

Or can anybody think of anything better?

There is nothing new in this area in 1.0. the runtime/editor split work was in 0.20 and there hasn't been any new changes to that since.

The storage API gives you everything you need to save things however you want. Yes it's a single call to save your flows, but you can split up the json you given and store the different parts wherever and however you want.

There are no plans to change the editor to only deploy the current tab.

After 1.0 is done, there is scope to think more about how we can better accommodate multiple users trying edit the same set of flows at the same time. Just depends whether anyone interested in that is interested enough to help make it happen. Otherwise it sits on the backlog along with everything else and waits it's turn.

Thanks (and node-red is awesome btw my frustration is that it's soooo close to being exactly what my work project needs but with little things like the above being show stoppers).

I did think about splitting the big json up behind the saveFlows call - but I'd have no way of knowing what really changed in the big json right so I'd have no option but to split it up and rewrite everything on every save.

Or is there some meta-data with each of the tabs/flows e.g. modified by, modified datetime something like that? Or are there ways I could incorporate such "meta data" myself?

I should have said btw I am "interested enough to help make it happen" and I'm experienced with node.js and browser javascript it's just I'm new to understanding the node-red design (I've looked a bit at the node-red code but there's quite a bit to it!! :slight_smile:)

1 Like