@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_.
26 lines (24 loc) • 963 B
text/typescript
import { BlockDataType } from '@/mocks/blockDocumentData'
import { BlockDocument } from '@/models/BlockDocument'
import { createObjectLevelCan } from '@/models/ObjectLevelCan'
import { MockFunction } from '@/services/Mocker'
export const randomBlockDocument: MockFunction<BlockDocument, [Partial<BlockDocument>?]> = function(overrides = {}, type?: BlockDataType) {
const blockType = this.create('blockType', [overrides.blockType])
const blockSchema = this.create('blockSchema', [overrides.blockSchema])
const data = this.create('blockDocumentData', [type])
return new BlockDocument({
id: this.create('string'),
created: this.create('date'),
updated: this.create('date'),
isAnonymous: this.create('boolean'),
name: this.create('noun'),
data,
blockSchemaId: blockSchema.id,
blockSchema,
blockTypeId: blockType.id,
blockType,
blockDocumentReferences: {},
can: createObjectLevelCan(),
...overrides,
})
}