title: object-node to element-node conversion fails?
body: <p>I am trying to set a default capability on a role in JavaScript like so:</p>
  
  <pre><code>declareUpdate(); 
  var sec = require('/MarkLogic/security.xqy'); 
  var pid = 3223704;
  var role = 'scc-proj-' + pid + '-member';
  sec.roleSetDefaultPermissions("scc-proj-3223704-member",(xdmp.permission("scc-proj-3223704-member", "read")));
  </code></pre>
  
  <p>This gives an error:</p>
  
  <pre><code>[javascript] XDMP-AS: $permissions as element(sec:permission)* -- Invalid coercion: object-node{"capability": text{"read"}, "roleId": text{"12999117528518422097...} as element(sec:permission)
  </code></pre>
  
  <p>If I look into it seems that <code>xdmp.permissions()</code> gives back an object node while <code>sec.roleSetDefaultPermissions()</code> expects an element node. So seems there is some type conversion not working...</p>
  
  <p>The XQuery equivalent works okay.</p>
  
  <ol>
  <li>Can this be fixed in javascript?</li>
  <li>As a workaround can I run the XQuery from a javascript with xdmp.eval or invoke?</li>
  </ol>