Hi, this is one part of Speckle that needs to be (1) clarified and (2) improved for this specific usecase. Some parts of the answer are in this thread. Anyway, a tl;dr:
Speckle is immutable storage for object graphs. That means that if you want to change one object within that graph, the change needs to bubble up to the parent - and we need to resave the parent object with its new identity. It’s actually a super cool problem, but one that we haven’t yet gotten to attack - so thanks for pushing us to do this
Depending on your specific usecase:
A) if you only need that data to make its way back into a host application, e.g. Revit, I’d use the trick that excel does: Excel | Speckle Docs
B) if you need a persistent record single source of truth in a Speckle commit, it’s a bit more tricky, but doable. The steps would be:
- get the whole referenced object of that specific commit
- within that object, modify the sub-object you want to add a prop to
- save the new whole object to speckle and create a new commit
For some pseudocode:
let myWholeCommitObject = await SpeckleClient.GetObject( commit.referencedObject );
let objectIWantToChange = myWholeCommitObject["@walls"].firstOrDefault( obj => obj.applicationId == xxx);
objectIWantToChange["foo"] = "bar"; // or whatever else you want to change; it's important that you do not break the reference within the parent object; so if you need to replace an item in the list of walls with a new one, do it carefully :)
let newId = await SpeckleClient.saveObject( myWholeCommitObject );
let newCommit = { referencedObject: newId, etc. };
let newCommitId = await SpeckleClient.CommitCreate(newCommit);
Apologies for possibly mixing up two programming languages above - let me know if I need to clarify the intention!