| 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( |