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

Function setValidTable

src/store/index.ts:660–691  ·  view source on GitHub ↗
(
    tableId: Id,
    table: Table,
    forceDel?: boolean,
  )

Source from the content-addressed store, hash-verified

658 ) as TablesMap;
659
660 const setValidTable = (
661 tableId: Id,
662 table: Table,
663 forceDel?: boolean,
664 ): TableMap =>
665 ifTransformed(
666 table,
667 () =>
668 forceDel
669 ? table
670 : ifNotUndefined(
671 middleware[2],
672 (willSetTable) =>
673 whileMutating(() =>
674 willSetTable(tableId, structuredClone(table)),
675 ),
676 () => table,
677 ),
678 (validTable) =>
679 mapMatch(
680 mapEnsure(tablesMap, tableId, () => {
681 tableIdsChanged(tableId, 1);
682 mapSet(tablePoolFunctions, tableId, getPoolFunctions());
683 mapSet(tableCellIds, tableId, mapNew());
684 return mapNew();
685 }),
686 validTable,
687 (tableMap, rowId, row) => setValidRow(tableId, tableMap, rowId, row),
688 (tableMap, rowId) => delValidRow(tableId, tableMap, rowId),
689 ),
690 objIsEqual,
691 ) as TableMap;
692
693 const setValidRow = (
694 tableId: Id,

Callers 3

setValidTablesFunction · 0.70
delValidTableFunction · 0.70
setTableFunction · 0.70

Calls 11

mapMatchFunction · 0.90
mapEnsureFunction · 0.90
mapSetFunction · 0.90
getPoolFunctionsFunction · 0.90
mapNewFunction · 0.90
ifTransformedFunction · 0.70
whileMutatingFunction · 0.70
tableIdsChangedFunction · 0.70
setValidRowFunction · 0.70
delValidRowFunction · 0.70
willSetTableFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…