MCPcopy Create free account
hub / github.com/editablejs/editable / flushDocument

Function flushDocument

packages/yjs-websocket/src/server/mongodb/utils.ts:183–193  ·  view source on GitHub ↗
(
  adapter: MongoAdapter,
  docName: string,
  stateAsUpdate: Uint8Array,
  stateVector: Uint8Array,
)

Source from the content-addressed store, hash-verified

181 * Merge all MongoDB documents of the same yjs document together.
182 */
183export const flushDocument = async (
184 adapter: MongoAdapter,
185 docName: string,
186 stateAsUpdate: Uint8Array,
187 stateVector: Uint8Array,
188): Promise<number> => {
189 const clock = await storeUpdate(adapter, docName, stateAsUpdate)
190 await writeStateVector(adapter, docName, stateVector, clock)
191 await clearUpdatesRange(adapter, docName, 0, clock)
192 return clock
193}

Callers

nothing calls this directly

Calls 3

storeUpdateFunction · 0.85
writeStateVectorFunction · 0.85
clearUpdatesRangeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…