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: Object

options.flavour: Flavour

options.metadata: Metadata

options.onUpgrade?: (data, previousVersion, latestVersion) => void

options.props?: (internalPrimitives) => Props

options.toModel?: () => Model

options.transformer?: () => Transformer

Returns

Object

model

model: Object & Metadata

Type declaration

flavour

flavour: Flavour

props

props: PropsGetter<Props>

role

role: Role

onUpgrade?

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

Parameters

data: Props

previousVersion: number

latestVersion: number

Returns

void

transformer?

transformer?: () => Transformer

Returns

Transformer

version

version: number

Source

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


Generated using TypeDoc and typedoc-plugin-markdown.