UNPKG

@awarns/tracing

Version:

AwarNS Framework package that eases the tracing and debugging of complex task execution workflows

36 lines 1.03 kB
import { deserialize, serialize } from '@awarns/core/utils/serialization'; import { AbstractTimeSeriesStore, } from '@awarns/persistence/stores/timeseries'; const DOC_TYPE = 'trace'; class TracesStoreDB extends AbstractTimeSeriesStore { constructor() { super(DOC_TYPE, docFrom, traceFrom); } } function docFrom(trace) { const { id, timestamp, chainId, type, name, result, content } = trace; const stringifiedContent = serialize(content); return { id, timestamp: timestamp.getTime(), chainId, type, name, result, stringifiedContent, }; } function traceFrom(doc) { const { id, timestamp, chainId, type, name, result, stringifiedContent } = doc; const content = deserialize(stringifiedContent); return { id, timestamp: new Date(timestamp), chainId, type, name, result, content, }; } export const localTracesStore = new TracesStoreDB(); //# sourceMappingURL=store.js.map