GraphQL API: Updating objects in new commit

Hi guys,

So I have created a stream and added objects in my first commit as described here
Happy days! :tada:

Now I would like fetch my commit and objects, make changes to some of the objects and commit the changes back to Speckle using the GraphQL API.

How do I do that?

If I just make the changes to my objects and commit them again, it is all fucked up and the objects are only visible in Dev Mode.

Model link for reference

This looks like we missed this in the hackathon excitement - sorry @chrkong

I’ll get to this asap

Thanks @jonathon, appreciate it!

Without seeing any more details, your second commit’s structure is somewhat different from the original.

When you serialised and sent the amended objects, did you then send a version/commit of just those amended objects?

Yes, I’ve only sent the updated objects as data in the second commit.

If you recreate the structure of the previous commit and replace the objects you have augmented.

What do you mean by recreate the structure?
Do I have to recommit everything from the previous commit?

I have to be careful with what I assert here because of the swiss cheese holes in the non-existant JS SDK.

In broad terms (for the revit connector, let’s say), the exchange with Speckle goes something like this.

  1. You create a list of speckle objects according to a hierarchy; it could be a flat list.
  2. Serializing that to account for detachment and chunking will create additional objects and replace them with references
  3. Sending these objects 1st time will create a copy on the server of every object.
  4. Creating a commit is a separate mutation describing that “packet” of information, a selection says.

The second time you send that same selection, it is equivalent to changing some values in any selected object.
5. That selected list of objects is converted to speckle objects
6. The Transport operation diffs the server’s existing objects (unchanged) from the change. Unchanged objects are replaced with Reference objects
7. A commit is made with an amalgam of those references and changed objects.

The web viewer and receiver connectors handle the reference objects and substitute them for db calls to the original objects.

NOW, how much of that handshaking exists in the JS world? I need to refresh myself on this. I’d appreciate it if @connor, @oguzhankoral, or @Jedd could chime in.

Alright, that is a little bit what I expected happened.

Then what I want to know is what is the structure of the diff?

What I have sent as the second commit in my example, is the objects that got updated, basically I need to wrap them in a diff structure, so Speckle handles them correctly

@jonathon could you guide me to where the 6. The Transport operation diffs the server’s existing objects (unchanged) from the change. happens in the Revit Connector?

I wanted to try to deduce what happens myself, but I can’t find the right code snippets in the speckle-sharp repo.