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

Function setValidRow

src/store/index.ts:693–726  ·  view source on GitHub ↗
(
    tableId: Id,
    tableMap: TableMap,
    rowId: Id,
    row: Row,
    forceDel?: boolean,
  )

Source from the content-addressed store, hash-verified

691 ) as TableMap;
692
693 const setValidRow = (
694 tableId: Id,
695 tableMap: TableMap,
696 rowId: Id,
697 row: Row,
698 forceDel?: boolean,
699 ): RowMap =>
700 ifTransformed(
701 row,
702 () =>
703 forceDel
704 ? row
705 : ifNotUndefined(
706 middleware[3],
707 (willSetRow) =>
708 whileMutating(() =>
709 willSetRow(tableId, rowId, structuredClone(row)),
710 ),
711 () => row,
712 ),
713 (validRow) =>
714 mapMatch(
715 mapEnsure(tableMap, rowId, () => {
716 rowIdsChanged(tableId, rowId, 1);
717 return mapNew();
718 }),
719 validRow,
720 (rowMap, cellId, cell) =>
721 setValidCell(tableId, rowId, rowMap, cellId, cell),
722 (rowMap, cellId) =>
723 delValidCell(tableId, tableMap, rowId, rowMap, cellId, forceDel),
724 ),
725 objIsEqual,
726 ) as RowMap;
727
728 const applyRowDirectly = (
729 tableId: Id,

Callers 4

setValidTableFunction · 0.70
delValidRowFunction · 0.70
setRowFunction · 0.70
addRowFunction · 0.70

Calls 9

mapMatchFunction · 0.90
mapEnsureFunction · 0.90
mapNewFunction · 0.90
ifTransformedFunction · 0.70
whileMutatingFunction · 0.70
rowIdsChangedFunction · 0.70
setValidCellFunction · 0.70
delValidCellFunction · 0.70
willSetRowFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…