MCPcopy
hub / github.com/tinyplex/tinybase / getMergeableRowDiff

Function getMergeableRowDiff

src/mergeable-store/index.ts:538–556  ·  view source on GitHub ↗
(
    otherTableRowHashes: RowHashes,
  )

Source from the content-addressed store, hash-verified

536 };
537
538 const getMergeableRowDiff = (
539 otherTableRowHashes: RowHashes,
540 ): [newRows: TablesStamp, differingRowHashes: RowHashes] => {
541 const newRows: TablesStamp = stampNewObj(contentStampMap[0][1]);
542 const differingRowHashes: RowHashes = {};
543 objForEach(otherTableRowHashes, (otherRowHashes, tableId) =>
544 mapForEach(
545 mapGet(contentStampMap[0][0], tableId)?.[0],
546 (rowId, [rowStampMap, rowHlc, hash]) =>
547 objHas(otherRowHashes, rowId)
548 ? hash !== otherRowHashes[rowId]
549 ? (objEnsure(differingRowHashes, tableId, objNew)[rowId] = hash)
550 : 0
551 : (objEnsure(newRows[0], tableId, stampNewObj)[0][rowId] =
552 stampMapToObjWithoutHash([rowStampMap, rowHlc])),
553 ),
554 );
555 return [newRows, differingRowHashes];
556 };
557
558 const getMergeableCellHashes = (
559 otherTableRowHashes: RowHashes,

Callers

nothing calls this directly

Calls 7

stampNewObjFunction · 0.90
objForEachFunction · 0.90
mapForEachFunction · 0.90
mapGetFunction · 0.90
objHasFunction · 0.90
objEnsureFunction · 0.90
stampMapToObjWithoutHashFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…