Skip to content

BlockSuite API Documentation / @blocksuite/store / defineBlockSchema

Function: defineBlockSchema()

defineBlockSchema<Flavour, Role, Props, Metadata, Model, Transformer>(options): Object

Type parameters

Flavour extends string

Role extends "root" | "hub" | "content"

Props extends object

Metadata extends Readonly<Object>

Model extends BlockModel<Props>

Transformer extends BaseBlockTransformer<Props>

Parameters

options

options.flavour: Flavour

options.metadata: Metadata

options.onUpgrade?

options.props?

options.toModel?

options.transformer?

Returns

Object

model

model: Object & Metadata

Type declaration

flavour

flavour: Flavour

props

props: PropsGetter<Props>

onUpgrade?

optional onUpgrade: (data, previousVersion, latestVersion) => void

Parameters

data: Props

previousVersion: number

latestVersion: number

Returns

void

transformer?

optional transformer: () => Transformer

Returns

Transformer

version

version: number

Source

packages/framework/store/src/schema/base.ts:73