import { isInlineData } from 'vega-lite/build/src/data' ; import { DATASET_RECEIVE } from '../actions/dataset' ; export function constructLogString ( inputLogs ) { const outputLogs = [ ] ; for ( const inputLog of inputLogs ) { const type = inputLog . action . type ; let payload = inputLog . action . payload ; if ( type === DATASET_RECEIVE && isInlineData ( payload . data ) ) { payload = { ... payload , data : { name : 'source' } } ; } outputLogs . push ( { timestamp : inputLog . timestamp , ISOString : new Date ( inputLog . timestamp ) . toISOString ( ) , type , payload : JSON . stringify ( payload ) } ) ; } return outputLogs ; } ;