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, object>

Defined in

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

Accessors

versions

get versions(): object

Returns

object

Defined in

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

Methods

isValid()

isValid(child, parent): boolean

Parameters

child: string

parent: string

Returns

boolean

Defined in

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


register()

register(blockSchema): Schema

Parameters

blockSchema: object[]

Returns

Schema

Defined in

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


toJSON()

toJSON(): object

Returns

object

Defined in

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


upgradeBlock()

upgradeBlock(flavour, oldVersion, blockData): void

Parameters

flavour: string

oldVersion: number

blockData: YMap<unknown>

Returns

void

Defined in

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


upgradeCollection()

upgradeCollection(rootData): void

Parameters

rootData: Doc

Returns

void

Defined in

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


upgradeDoc()

upgradeDoc(oldPageVersion, oldBlockVersions, docData): void

Parameters

oldPageVersion: number

oldBlockVersions: Record<string, number>

docData: Doc

Returns

void

Defined in

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


validate()

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

Parameters

flavour: string

parentFlavour?: string

childFlavours?: string[]

Returns

void

Defined in

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


validateSchema()

validateSchema(child, parent): void

Parameters

child

child.model = ...

child.model.children?: string[] = ContentSchema

child.model.flavour: string = FlavourSchema

child.model.parent?: string[] = ParentSchema

child.model.props? = ...

child.model.role: "root" | "hub" | "content" = RoleSchema

child.model.toModel? = ...

child.onUpgrade? = ...

child.transformer? = ...

child.version: number = ...

parent

parent.model = ...

parent.model.children?: string[] = ContentSchema

parent.model.flavour: string = FlavourSchema

parent.model.parent?: string[] = ParentSchema

parent.model.props? = ...

parent.model.role: "root" | "hub" | "content" = RoleSchema

parent.model.toModel? = ...

parent.onUpgrade? = ...

parent.transformer? = ...

parent.version: number = ...

Returns

void

Defined in

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