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:13

Accessors ​

versions ​

get versions(): object

Defined In ​

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

Methods ​

_matchFlavour ​

private _matchFlavour(childFlavour, parentFlavour): boolean

Parameters ​

ParameterType
childFlavourstring
parentFlavourstring

Returns ​

boolean

Defined In ​

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


_upgradeBlockVersions ​

private _upgradeBlockVersions(rootData): void

Parameters ​

ParameterType
rootDataDoc

Returns ​

void

Defined In ​

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


_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:225


_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:190


register ​

register(blockSchema): Schema

Parameters ​

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

Returns ​

Schema

Defined In ​

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


toJSON ​

toJSON(): object

Returns ​

object

Defined In ​

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


upgradeBlock ​

upgradeBlock( flavour, oldVersion, blockData): void

Parameters ​

ParameterType
flavourstring
oldVersionnumber
blockDataMap< unknown >

Returns ​

void

Defined In ​

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


upgradePage ​

upgradePage( oldPageVersion, oldBlockVersions, pageData): void

Parameters ​

ParameterType
oldPageVersionnumber
oldBlockVersionsRecord< string, number >
pageDataDoc

Returns ​

void

Defined In ​

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


upgradeWorkspace ​

upgradeWorkspace(rootData): void

Parameters ​

ParameterType
rootDataDoc

Returns ​

void

Defined In ​

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


validate ​

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

Parameters ​

ParameterType
flavourstring
parentFlavour?string
childFlavours?string[]

Returns ​

void

Defined In ​

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


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:97