Skip to content

API > @blocksuite/store > Schema

Class: Schema ​

Constructors ​

constructor ​

new Schema(): Schema

Returns ​

Schema

Properties ​

flavourSchemaMap ​

readonly flavourSchemaMap: Map< string, {model: { flavour: string; role: "root" | "hub" | "content"; parent?: string[] | undefined; children?: string[] | undefined; props?: ((args_0: InternalPrimitives, ...args_1: unknown[]) => Record<...>) | undefined; toModel?: ((...args: unknown[]) => BaseBlockModel<...>) | undefined; }; onUpgrade: (...args) => void; transformer: (...args) => BaseBlockTransformer< object >; version: number;} >

Defined In ​

packages/store/src/schema/schema.ts:14


proxy ​

readonly proxy: ProxyManager

Defined In ​

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

Accessors ​

versions ​

get versions(): object

Defined In ​

packages/store/src/schema/schema.ts:17

Methods ​

_matchFlavour ​

private _matchFlavour(childFlavour, parentFlavour): boolean

Parameters ​

ParameterType
childFlavourstring
parentFlavourstring

Returns ​

boolean

Defined In ​

packages/store/src/schema/schema.ts:220


_upgradeBlockVersions ​

private _upgradeBlockVersions(rootData): void

Parameters ​

ParameterType
rootDataDoc

Returns ​

void

Defined In ​

packages/store/src/schema/schema.ts:178


_validateParent ​

private _validateParent(child, parent): boolean

Parameters ​

ParameterType
childobject
child.model`{ flavour: string; role: "root"
child.onUpgrade?function
child.transformer?function
child.versionnumber
parentobject
parent.model`{ flavour: string; role: "root"
parent.onUpgrade?function
parent.transformer?function
parent.versionnumber

Returns ​

boolean

Defined In ​

packages/store/src/schema/schema.ts:227


_validateRole ​

private _validateRole(child, parent): void

Parameters ​

ParameterType
childobject
child.model`{ flavour: string; role: "root"
child.onUpgrade?function
child.transformer?function
child.versionnumber
parentobject
parent.model`{ flavour: string; role: "root"
parent.onUpgrade?function
parent.transformer?function
parent.versionnumber

Returns ​

void

Defined In ​

packages/store/src/schema/schema.ts:192


register ​

register(blockSchema): Schema

Parameters ​

ParameterType
blockSchema{model: `{ flavour: string; role: "root"

Returns ​

Schema

Defined In ​

packages/store/src/schema/schema.ts:40


toJSON ​

toJSON(): object

Returns ​

object

Defined In ​

packages/store/src/schema/schema.ts:25


upgradeBlock ​

upgradeBlock( flavour, oldVersion, blockData): void

Parameters ​

ParameterType
flavourstring
oldVersionnumber
blockDataMap< unknown >

Returns ​

void

Defined In ​

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


upgradePage ​

upgradePage( oldPageVersion, oldBlockVersions, pageData): void

Parameters ​

ParameterType
oldPageVersionnumber
oldBlockVersionsRecord< string, number >
pageDataDoc

Returns ​

void

Defined In ​

packages/store/src/schema/schema.ts:126


upgradeWorkspace ​

upgradeWorkspace(rootData): void

Parameters ​

ParameterType
rootDataDoc

Returns ​

void

Defined In ​

packages/store/src/schema/schema.ts:112


validate ​

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

Parameters ​

ParameterType
flavourstring
parentFlavour?string
childFlavours?string[]

Returns ​

void

Defined In ​

packages/store/src/schema/schema.ts:48


validateSchema ​

validateSchema(child, parent): void

Parameters ​

ParameterType
childobject
child.model`{ flavour: string; role: "root"
child.onUpgrade?function
child.transformer?function
child.versionnumber
parentobject
parent.model`{ flavour: string; role: "root"
parent.onUpgrade?function
parent.transformer?function
parent.versionnumber

Returns ​

void

Defined In ​

packages/store/src/schema/schema.ts:99