Is there a way to get the source associations of a node? assocs returns only the target association.
I found org.alfresco.repo.jscript.ScriptNode.getSourceAssocs() in the code but I don't understand how the java object is hooked to the javascript object.
I assume you have a dev/labs build as getSourceAssocs was only added to the JavaScript ScriptNode API in the last month or so. That is why it is not documented yet
You want something like this
var sourceAssocs = node.sourceAssocs;
This returns a map of assoc qname to a list of nodes. Basically it works identically to the node.assocs Target Associations API that you have already used but it returns source assocs instead.