(
withHashes: boolean,
encoded = false,
)
| 421 | ]; |
| 422 | |
| 423 | const getTransactionMergeableChangesImpl = ( |
| 424 | withHashes: boolean, |
| 425 | encoded = false, |
| 426 | ): MergeableChanges<typeof withHashes> => { |
| 427 | const [ |
| 428 | [tableStampMaps, tablesHlc, tablesHash], |
| 429 | [valueStampMaps, valuesHlc, valuesHash], |
| 430 | ] = contentStampMap; |
| 431 | |
| 432 | const newStamp = withHashes ? stampNewWithHash : stampNew; |
| 433 | |
| 434 | const tablesObj: TablesStamp<typeof withHashes>[0] = {}; |
| 435 | collForEach(touchedCells, (touchedTable, tableId) => |
| 436 | ifNotUndefined( |
| 437 | mapGet(tableStampMaps, tableId), |
| 438 | ([rowStampMaps, tableHlc, tableHash]) => { |
| 439 | const tableObj: TableStamp<typeof withHashes>[0] = {}; |
| 440 | collForEach(touchedTable, (touchedRow, rowId) => |
| 441 | ifNotUndefined( |
| 442 | mapGet(rowStampMaps, rowId), |
| 443 | ([cellStampMaps, rowHlc, rowHash]) => { |
| 444 | const rowObj: RowStamp<typeof withHashes>[0] = {}; |
| 445 | collForEach(touchedRow, (cellId) => { |
| 446 | ifNotUndefined( |
| 447 | mapGet(cellStampMaps, cellId), |
| 448 | ([cell, time, hash]) => |
| 449 | (rowObj[cellId] = newStamp( |
| 450 | encoded ? cell : decodeIfJson(cell), |
| 451 | time, |
| 452 | hash, |
| 453 | )), |
| 454 | ); |
| 455 | }); |
| 456 | tableObj[rowId] = newStamp(rowObj, rowHlc, rowHash); |
| 457 | }, |
| 458 | ), |
| 459 | ); |
| 460 | tablesObj[tableId] = newStamp(tableObj, tableHlc, tableHash); |
| 461 | }, |
| 462 | ), |
| 463 | ); |
| 464 | |
| 465 | const valuesObj: ValuesStamp<typeof withHashes>[0] = {}; |
| 466 | collForEach(touchedValues, (valueId) => |
| 467 | ifNotUndefined( |
| 468 | mapGet(valueStampMaps, valueId), |
| 469 | ([value, time, hash]) => |
| 470 | (valuesObj[valueId] = newStamp( |
| 471 | encoded ? value : decodeIfJson(value), |
| 472 | time, |
| 473 | hash, |
| 474 | )), |
| 475 | ), |
| 476 | ); |
| 477 | |
| 478 | return [ |
| 479 | newStamp(tablesObj, tablesHlc, tablesHash), |
| 480 | newStamp(valuesObj, valuesHlc, valuesHash), |
no test coverage detected
searching dependent graphs…