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