@awarns/tracing
Version:
AwarNS Framework package that eases the tracing and debugging of complex task execution workflows
21 lines • 928 B
JavaScript
import { CSVExporter } from '@awarns/persistence/exporters';
import { syncedTracesStore } from '../stores';
import { toTimestampWithTimezoneOffset, jsonDateReplacer } from '@awarns/core/utils/date';
export class CSVTracesExporter extends CSVExporter {
constructor(folder, fileName, tracesStore = syncedTracesStore) {
super(folder, fileName);
this.tracesStore = tracesStore;
}
getItemsToExport() {
return this.tracesStore.getAll();
}
formatHeaders() {
return ['id', 'timestamp', 'timezoneOffset', 'chainId', 'type', 'name', 'result', 'content'];
}
formatRow(trace) {
const { id, timestamp, chainId, type, name, result, content } = trace;
const { value, offset } = toTimestampWithTimezoneOffset(timestamp);
return [id, value, offset, chainId, type, name, result, JSON.stringify(content, jsonDateReplacer)];
}
}
//# sourceMappingURL=csv.js.map