If you want to stick with the JS api then you could do something like this:
let sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let selectedLayers = doc.selectedLayers.layers
console.log(doc.sketchObject.isDocumentEdited())
let copy = selectedLayers[0].duplicate()
let detached = copy.detach({recursively: true})
detached.parent = nil
console.log(detached)
console.log(doc.sketchObject.isDocumentEdited())
doc.sketchObject.isDocumentEdited()
This can check if the document is marked as edited.
let copy = selectedLayers[0].duplicate()
let detached = copy.detach({recursively: true})
You can copy the symbolInstance using .duplicate()
. Once you have a copy you can detach the symbolInstance to turn it into a group. Be sure to pass in the recursive boolean to ensure that any sublayers aren't symbols either.
https://developer.sketch.com/reference/api/#detach-the-instance
To ensure that the document isn't modified you will want to remove the copied+detached object from the document. Be sure to do this step last because if you specify the copy's parent as nil then try to detach the detach method doesn't work.
Once you are all done you can check out the sublayers' frames.