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

Function setValidValue

src/store/index.ts:844–867  ·  view source on GitHub ↗
(
    valueId: Id,
    value: Value,
    skipMiddleware?: boolean,
  )

Source from the content-addressed store, hash-verified

842 );
843
844 const setValidValue = (
845 valueId: Id,
846 value: Value,
847 skipMiddleware?: boolean,
848 ): void =>
849 ifTransformed(
850 value,
851 () =>
852 ifNotUndefined(
853 skipMiddleware ? undefined : middleware[6],
854 (willSetValue) => whileMutating(() => willSetValue(valueId, value)),
855 () => value,
856 ),
857 (value) => {
858 if (!collHas(valuesMap, valueId)) {
859 valueIdsChanged(valueId, 1);
860 }
861 const oldValue = mapGet(valuesMap, valueId);
862 if (value !== oldValue) {
863 valueChanged(valueId, oldValue, value);
864 mapSet(valuesMap, valueId, value);
865 }
866 },
867 );
868
869 const getNewRowId = (tableId: Id, reuse: 0 | 1): Id => {
870 const [getId] = mapGet(tablePoolFunctions, tableId) as PoolFunctions;

Callers 4

setValidValuesFunction · 0.70
delValidValueFunction · 0.70
setPartialValuesFunction · 0.70
setValueFunction · 0.70

Calls 8

collHasFunction · 0.90
mapGetFunction · 0.90
mapSetFunction · 0.90
ifTransformedFunction · 0.70
whileMutatingFunction · 0.70
valueIdsChangedFunction · 0.70
valueChangedFunction · 0.70
willSetValueFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…