@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_.
35 lines (27 loc) • 1.1 kB
text/typescript
import { SchemaValue } from '@/types/schemas'
export type BlockDocumentReferenceValue = {
$ref: {
block_document_id: string,
},
}
export function isBlockDocumentReferenceValue(value: SchemaValue): value is BlockDocumentReferenceValue {
return typeof value === 'object' && value !== null && '$ref' in value
}
export type BlockDocumentValue = {
blockTypeSlug: string,
blockDocumentId: string | null,
}
export function isBlockDocumentValue(value: SchemaValue): value is BlockDocumentValue {
return typeof value === 'object' && value !== null && 'blockTypeSlug' in value && 'blockDocumentId' in value
}
export type BlockDocumentRequestData = Record<string, unknown | BlockDocumentReferenceValue>
export type BlockDocumentCreateNamedRequest = {
name: string,
data: BlockDocumentRequestData,
block_schema_id: string,
block_type_id: string,
}
export type BlockDocumentCreateAnonymousRequest = Omit<BlockDocumentCreateNamedRequest, 'name'> & {
is_anonymous: boolean,
}
export type BlockDocumentCreateRequest = BlockDocumentCreateNamedRequest | BlockDocumentCreateAnonymousRequest