@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_.
17 lines (15 loc) • 679 B
text/typescript
import { sortStringArray } from '@prefecthq/prefect-design'
import { NotificationResponse } from '@/models/api/NotificationResponse'
import { Notification } from '@/models/Notification'
import { MapFunction } from '@/services/Mapper'
export const mapNotificationResponseToNotification: MapFunction<NotificationResponse, Notification> = function(source) {
return new Notification({
id: source.id,
created: this.map('string', source.created, 'Date'),
updated: this.map('string', source.updated, 'Date'),
isActive: source.is_active,
stateNames: source.state_names,
tags: sortStringArray(source.tags),
blockDocumentId: source.block_document_id,
})
}