(
tableId: Id,
rowId: Id | undefined,
cellId: Id,
cell: Cell,
)
| 427 | ); |
| 428 | |
| 429 | const getValidatedCell = ( |
| 430 | tableId: Id, |
| 431 | rowId: Id | undefined, |
| 432 | cellId: Id, |
| 433 | cell: Cell, |
| 434 | ): CellOrUndefined => |
| 435 | hasTablesSchema |
| 436 | ? ifNotUndefined( |
| 437 | mapGet(mapGet(tablesSchemaMap, tableId), cellId), |
| 438 | (cellSchema) => |
| 439 | isNull(cell) |
| 440 | ? cellSchema[ALLOW_NULL] |
| 441 | ? cell |
| 442 | : cellInvalid(tableId, rowId, cellId, cell, cellSchema[DEFAULT]) |
| 443 | : getCellOrValueType(cell) === cellSchema[TYPE] |
| 444 | ? encodeIfJson(cell) |
| 445 | : isJsonType(cellSchema[TYPE]) && isEncodedJson(cell) |
| 446 | ? cell |
| 447 | : cellInvalid( |
| 448 | tableId, |
| 449 | rowId, |
| 450 | cellId, |
| 451 | cell, |
| 452 | cellSchema[DEFAULT], |
| 453 | ), |
| 454 | () => cellInvalid(tableId, rowId, cellId, cell), |
| 455 | ) |
| 456 | : isUndefined(getCellOrValueType(cell)) |
| 457 | ? cellInvalid(tableId, rowId, cellId, cell) |
| 458 | : encodeIfJson(cell); |
| 459 | |
| 460 | const validateValues = (values: Values, skipDefaults?: 1): boolean => |
| 461 | objValidate( |
no test coverage detected
searching dependent graphs…