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

Function writeSelectRow

src/queries/index.ts:697–728  ·  view source on GitHub ↗
(rootRowId: Id)

Source from the content-addressed store, hash-verified

695 synchronizeTransactions(queryId, rootStore, selectJoinWhereStore);
696
697 const writeSelectRow = (rootRowId: Id) => {
698 const getJoinCell = (arg1: Id | true, arg2?: Id, arg3?: Id) => {
699 const joinedTableId = isTrue(arg1) ? arg2 : arg1;
700 const joinedCellId = isTrue(arg1) ? arg3 : arg2;
701 if (isUndefined(joinedCellId)) {
702 return rootStore.getCell(tableId, rootRowId, arg1 as Id);
703 }
704 if (joinedTableId === tableId && !isTrue(arg1)) {
705 return rootStore.getCell(tableId, rootRowId, joinedCellId);
706 }
707 const join = mapGet(joins, joinedTableId as Id) as JoinClause;
708 return isUndefined(join)
709 ? undefined
710 : join[5].getCell(
711 join[0],
712 mapGet(join[4], rootRowId)?.[0] as Id,
713 joinedCellId,
714 );
715 };
716 selectJoinWhereStore.transaction(() =>
717 arrayEvery(wheres, (where) => where(getJoinCell))
718 ? mapForEach(selects, (asCellId, tableCellGetter) =>
719 (selectJoinWhereStore as ProtectedStore)._[5](
720 queryId,
721 rootRowId,
722 asCellId,
723 tableCellGetter(getJoinCell, rootRowId),
724 ),
725 )
726 : selectJoinWhereStore.delRow(queryId, rootRowId),
727 );
728 };
729
730 const listenToTable = (
731 rootRowId: Id,

Callers 1

listenToTableFunction · 0.70

Calls 5

arrayEveryFunction · 0.90
mapForEachFunction · 0.90
whereFunction · 0.70
transactionMethod · 0.65
delRowMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…