Skip to content

BlockSuite API Documentation / @blocksuite/store / Schema

Class: Schema

Constructors

new Schema()

new Schema(): Schema

Returns

Schema

Properties

flavourSchemaMap

readonly flavourSchemaMap: Map<string, { model: { children: string[]; flavour: string; parent: string[]; props: (...args) => Record<string, any>; role: "root" | "hub" | "content"; toModel: (...args) => BlockModel<object, SignaledProps<object>>; }; transformer: (...args) => BaseBlockTransformer<object>; version: number; }>

Defined in

packages/framework/store/src/schema/schema.ts:10

Accessors

versions

Get Signature

get versions(): object

Returns

object

Defined in

packages/framework/store/src/schema/schema.ts:59

Methods

isValid()

isValid(child, parent): boolean

Parameters

child

string

parent

string

Returns

boolean

Defined in

packages/framework/store/src/schema/schema.ts:134


register()

register(blockSchema): Schema

Parameters

blockSchema

object[]

Returns

Schema

Defined in

packages/framework/store/src/schema/schema.ts:148


toJSON()

toJSON(): object

Returns

object

Defined in

packages/framework/store/src/schema/schema.ts:156


validate()

validate(flavour, parentFlavour?, childFlavours?): void

Parameters

flavour

string

parentFlavour?

string

childFlavours?

string[]

Returns

void

Defined in

packages/framework/store/src/schema/schema.ts:12


validateSchema()

validateSchema(child, parent): void

Parameters

child
model

{ children: string[]; flavour: string; parent: string[]; props: (...args) => Record<string, any>; role: "root" | "hub" | "content"; toModel: (...args) => BlockModel<object, SignaledProps<object>>; } = ...

model.children

string[] = ContentSchema

model.flavour

string = FlavourSchema

model.parent

string[] = ParentSchema

model.props

(...args) => Record<string, any> = ...

model.role

"root" | "hub" | "content" = RoleSchema

model.toModel

(...args) => BlockModel<object, SignaledProps<object>> = ...

transformer

(...args) => BaseBlockTransformer<object> = ...

version

number = ...

parent
model

{ children: string[]; flavour: string; parent: string[]; props: (...args) => Record<string, any>; role: "root" | "hub" | "content"; toModel: (...args) => BlockModel<object, SignaledProps<object>>; } = ...

model.children

string[] = ContentSchema

model.flavour

string = FlavourSchema

model.parent

string[] = ParentSchema

model.props

(...args) => Record<string, any> = ...

model.role

"root" | "hub" | "content" = RoleSchema

model.toModel

(...args) => BlockModel<object, SignaledProps<object>> = ...

transformer

(...args) => BaseBlockTransformer<object> = ...

version

number = ...

Returns

void

Defined in

packages/framework/store/src/schema/schema.ts:171