UNPKG

@prefecthq/prefect-ui-library

Version:

This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.

19 lines (17 loc) 893 B
import { FlowRunHistoryResponse } from '@/models/api/FlowRunHistoryResponse' import { RunHistory } from '@/models/RunHistory' import { MapFunction } from '@/services/Mapper' export const mapFlowRunHistoryResponseToRunHistory: MapFunction<FlowRunHistoryResponse, RunHistory> = function(source) { return new RunHistory({ intervalStart: this.map('string', source.interval_start, 'Date'), intervalEnd: this.map('string', source.interval_end, 'Date'), states: this.map('StateHistoryResponse', source.states, 'StateHistory'), }) } export const mapRunHistoryToFlowRunHistoryResponse: MapFunction<RunHistory, FlowRunHistoryResponse> = function(source) { return { interval_start: this.map('Date', source.intervalStart, 'string'), interval_end: this.map('Date', source.intervalEnd, 'string'), states: this.map('StateHistory', source.states, 'StateHistoryResponse'), } }