writeStateAsUpdate = (encoder, doc, targetStateVector = new Map()) => {
  writeClientsStructs(encoder, doc.store, targetStateVector);
  writeDeleteSet(encoder, createDeleteSetFromStructStore(doc.store));
}
Write all the document as a single update message. If you specify the state of the remote client (`targetStateVector`) it will
only write the operations that are missing.

@param {UpdateEncoderV1 | UpdateEncoderV2} encoder
@param {Doc} doc
@param {Map<number,number>} [targetStateVector] The state of the target that receives the update. Leave empty to write all known structs

@function