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

Function setValidTablesSchema

src/store/index.ts:541–566  ·  view source on GitHub ↗
(tablesSchema: TablesSchema)

Source from the content-addressed store, hash-verified

539 };
540
541 const setValidTablesSchema = (tablesSchema: TablesSchema): TablesSchemaMap =>
542 mapMatch(
543 tablesSchemaMap,
544 tablesSchema,
545 (_tablesSchema, tableId, tableSchema) => {
546 const rowDefaulted = mapNew();
547 const rowNonDefaulted = setNew();
548 mapMatch(
549 mapEnsure<Id, IdMap<CellSchema>>(tablesSchemaMap, tableId, mapNew),
550 tableSchema,
551 (tableSchemaMap, cellId, cellSchema) => {
552 mapSet(tableSchemaMap, cellId, cellSchema);
553 ifNotUndefined(
554 cellSchema[DEFAULT],
555 (def) => mapSet(rowDefaulted, cellId, def),
556 () => setAdd(rowNonDefaulted, cellId) as any,
557 );
558 },
559 );
560 mapSet(tablesSchemaRowCache, tableId, [rowDefaulted, rowNonDefaulted]);
561 },
562 (_tablesSchema, tableId) => {
563 mapSet(tablesSchemaMap, tableId);
564 mapSet(tablesSchemaRowCache, tableId);
565 },
566 );
567
568 const setValidValuesSchema = (valuesSchema: ValuesSchema): ValuesSchemaMap =>
569 mapMatch(

Callers 2

setTablesSchemaFunction · 0.70
delTablesSchemaFunction · 0.70

Calls 6

mapMatchFunction · 0.90
mapNewFunction · 0.90
setNewFunction · 0.90
mapEnsureFunction · 0.90
mapSetFunction · 0.90
setAddFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…