Just pushed a small update with a stand-alone test file containing some examples of Gun.js based on the tutorials but messing about trying to work out how to be able to retrieve >1 level of hierarchy. That isn't working yet because I haven't worked out the async logic needed, standard recursion doesn't work. I think this logic will be needed to make full use of Gun in Node-RED. If anyone can work out the logic, please do!
Thanks for everyone's feedback so far, it has been really helpful.
The point here is that you wouldn't always know the shape of the data. All of the Gun.js examples seem to assume that you do know the shape and therefore you write code to go get what you want. That isn't a reasonable assumption to me. I don't want to always have to write very specific flows/code to get back a set of data, sometimes I just need a "tell me everything" option. This would be particularly true if trying to use Gun as a context store. The alternative is to use JSON.stringify to wrap the data into a string but that doesn't feel quite right to me.
Thanks for that. I had thought about something of that nature but again haven't really had the time to explore it. But the idea is certainly worth exploring.
Agreed. However, I suspect that would in in a v2 rather than an initial release
I think that my next stage will be to consolidate the current nodes & make sure they work correctly with slash delimited souls (e.g. "daughter/boyfriends") with the single-level hierarchy.
As that probably constitutes a minimum viable product, I'll probably publish that as a v0.1 release.
After that I'll likely look at the "match" node idea.
Sadly, I don't know that the context store is going to go anywhere until I can get a multi-depth hierarchy get working.
I do still have an idea about how settings.js global entries could be interfaced to the custom nodes in order to be able to easily get references to the objects defined in the nodes. It would certainly fall under advanced use case but would, I believe, be robust. But for now, I'm going to just keep that as an idea. Hopefully, we can find better solutions.
@dceejay, I do get the desire to ensure that the core principles of Node-RED are followed but I think we would all agree that Node-RED is not realistically a "no code" framework for advanced cases. But rather a "low code" framework. However, I do want to focus on the simple parts first so that non-coders can leverage gun.js - I'm just not too sure how much use it will be - no reason not to try though
I'm only going by how much work it was to get an editor working. Perhaps I'm wrong. My concern is that whenever internal changes to NR are made, changes to the gun-function node would also need to be made - but truth be told, I'm not sure how often the function feature would actually change. Actually, I don't even know how many lines of code the function node is?
I think that a gun-function node would be in v3 if at all. With @thinkbig1979's idea, it may not be needed. Let's see. Of course, if you wanted to contribute a node to the repo, it would be gratefully received.