@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_.
16 lines (15 loc) • 706 B
text/typescript
import { BlockSchemaResponse } from '@/models/api/BlockSchemaResponse'
import { BlockSchema } from '@/models/BlockSchema'
import { MapFunction } from '@/services/Mapper'
export const mapBlockSchemaResponseToBlockSchema: MapFunction<BlockSchemaResponse, BlockSchema> = function(source) {
return new BlockSchema({
id: source.id,
checksum: source.checksum,
blockTypeId: source.block_type_id,
capabilities: source.capabilities,
created: this.map('string', source.created, 'Date'),
updated: this.map('string', source.updated, 'Date'),
fields: this.map('SchemaResponse', source.fields, 'Schema'),
blockType: this.map('BlockTypeResponse', source.block_type, 'BlockType'),
})
}