(valueId: Id, value: Value)
| 473 | ); |
| 474 | |
| 475 | const getValidatedValue = (valueId: Id, value: Value): ValueOrUndefined => |
| 476 | hasValuesSchema |
| 477 | ? ifNotUndefined( |
| 478 | mapGet(valuesSchemaMap, valueId), |
| 479 | (valueSchema) => |
| 480 | isNull(value) |
| 481 | ? valueSchema[ALLOW_NULL] |
| 482 | ? value |
| 483 | : valueInvalid(valueId, value, valueSchema[DEFAULT]) |
| 484 | : getCellOrValueType(value) === valueSchema[TYPE] |
| 485 | ? encodeIfJson(value) |
| 486 | : isJsonType(valueSchema[TYPE]) && isEncodedJson(value) |
| 487 | ? value |
| 488 | : valueInvalid(valueId, value, valueSchema[DEFAULT]), |
| 489 | () => valueInvalid(valueId, value), |
| 490 | ) |
| 491 | : isUndefined(getCellOrValueType(value)) |
| 492 | ? valueInvalid(valueId, value) |
| 493 | : encodeIfJson(value); |
| 494 | |
| 495 | const addDefaultsToRow = (row: Row, tableId: Id, rowId?: Id): Row => { |
| 496 | ifNotUndefined( |
no test coverage detected
searching dependent graphs…