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>

Source

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

Accessors

versions

get versions(): object

Returns

object

Source

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

Methods

_matchFlavour()

private _matchFlavour(childFlavour, parentFlavour): boolean

Parameters

childFlavour: string

parentFlavour: string

Returns

boolean

Source

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


_upgradeBlockVersions()

private _upgradeBlockVersions(rootData): void

Parameters

rootData: Doc

Returns

void

Source

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


_validateParent()

private _validateParent(child, parent): boolean

Parameters

child

child.model= undefined

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

child.model.flavour: string= FlavourSchema

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

child.model.props?= undefined

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

child.model.toModel?= undefined

child.onUpgrade?= undefined

child.transformer?= undefined

child.version: number= undefined

parent

parent.model= undefined

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

parent.model.flavour: string= FlavourSchema

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

parent.model.props?= undefined

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

parent.model.toModel?= undefined

parent.onUpgrade?= undefined

parent.transformer?= undefined

parent.version: number= undefined

Returns

boolean

Source

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


_validateRole()

private _validateRole(child, parent): void

Parameters

child

child.model= undefined

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

child.model.flavour: string= FlavourSchema

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

child.model.props?= undefined

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

child.model.toModel?= undefined

child.onUpgrade?= undefined

child.transformer?= undefined

child.version: number= undefined

parent

parent.model= undefined

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

parent.model.flavour: string= FlavourSchema

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

parent.model.props?= undefined

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

parent.model.toModel?= undefined

parent.onUpgrade?= undefined

parent.transformer?= undefined

parent.version: number= undefined

Returns

void

Source

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


register()

register(blockSchema): Schema

Parameters

blockSchema: object[]

Returns

Schema

Source

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


toJSON()

toJSON(): object

Returns

object

Source

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


upgradeBlock()

upgradeBlock(flavour, oldVersion, blockData): void

Parameters

flavour: string

oldVersion: number

blockData: Map<unknown>

Returns

void

Source

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


upgradeCollection()

upgradeCollection(rootData): void

Parameters

rootData: Doc

Returns

void

Source

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


upgradeDoc()

upgradeDoc(oldPageVersion, oldBlockVersions, docData): void

Parameters

oldPageVersion: number

oldBlockVersions: Record<string, number>

docData: Doc

Returns

void

Source

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


validate()

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

Parameters

flavour: string

parentFlavour?: string

childFlavours?: string[]

Returns

void

Source

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


validateSchema()

validateSchema(child, parent): void

Parameters

child

child.model= undefined

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

child.model.flavour: string= FlavourSchema

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

child.model.props?= undefined

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

child.model.toModel?= undefined

child.onUpgrade?= undefined

child.transformer?= undefined

child.version: number= undefined

parent

parent.model= undefined

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

parent.model.flavour: string= FlavourSchema

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

parent.model.props?= undefined

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

parent.model.toModel?= undefined

parent.onUpgrade?= undefined

parent.transformer?= undefined

parent.version: number= undefined

Returns

void

Source

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