Skip to content

BlockSuite API Documentation / @blocksuite/store / Schema

Class: Schema ​

Contents ​

Constructors ​

new Schema(undefined) ​

new Schema(): Schema

Returns ​

Schema

Properties ​

flavourSchemaMap ​

readonly flavourSchemaMap: Map<string, Object>

Source ​

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

Accessors ​

versions ​

get versions(): Object

Returns ​

Object

Source ​

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

Methods ​

_matchFlavour() ​

private _matchFlavour(childFlavour, parentFlavour): boolean

Parameters ​

• childFlavour: string

• parentFlavour: string

Returns ​

boolean

Source ​

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


_upgradeBlockVersions() ​

private _upgradeBlockVersions(rootData): void

Parameters ​

• rootData: Doc

Returns ​

void

Source ​

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


_validateParent() ​

private _validateParent(child, parent): boolean

Parameters ​

• child: Object

• child.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; }= undefined

• child.onUpgrade?: (...args) => void= undefined

• child.transformer?: (...args) => BaseBlockTransformer<object>= undefined

• child.version: number= undefined

• parent: Object

• parent.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; }= undefined

• parent.onUpgrade?: (...args) => void= undefined

• parent.transformer?: (...args) => BaseBlockTransformer<object>= undefined

• parent.version: number= undefined

Returns ​

boolean

Source ​

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


_validateRole() ​

private _validateRole(child, parent): void

Parameters ​

• child: Object

• child.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; }= undefined

• child.onUpgrade?: (...args) => void= undefined

• child.transformer?: (...args) => BaseBlockTransformer<object>= undefined

• child.version: number= undefined

• parent: Object

• parent.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; }= undefined

• parent.onUpgrade?: (...args) => void= undefined

• parent.transformer?: (...args) => BaseBlockTransformer<object>= undefined

• parent.version: number= undefined

Returns ​

void

Source ​

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


register() ​

register(blockSchema): Schema

Parameters ​

• blockSchema: Object[]

Returns ​

Schema

Source ​

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


toJSON() ​

toJSON(): Object

Returns ​

Object

Source ​

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


upgradeBlock() ​

upgradeBlock(flavour, oldVersion, blockData): void

Parameters ​

• flavour: string

• oldVersion: number

• blockData: Map<unknown>

Returns ​

void

Source ​

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


upgradePage() ​

upgradePage(oldPageVersion, oldBlockVersions, pageData): void

Parameters ​

• oldPageVersion: number

• oldBlockVersions: Record<string, number>

• pageData: Doc

Returns ​

void

Source ​

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


upgradeWorkspace() ​

upgradeWorkspace(rootData): void

Parameters ​

• rootData: Doc

Returns ​

void

Source ​

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


validate() ​

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

Parameters ​

• flavour: string

• parentFlavour?: string

• childFlavours?: string[]

Returns ​

void

Source ​

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


validateSchema() ​

validateSchema(child, parent): void

Parameters ​

• child: Object

• child.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; }= undefined

• child.onUpgrade?: (...args) => void= undefined

• child.transformer?: (...args) => BaseBlockTransformer<object>= undefined

• child.version: number= undefined

• parent: Object

• parent.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; }= undefined

• parent.onUpgrade?: (...args) => void= undefined

• parent.transformer?: (...args) => BaseBlockTransformer<object>= undefined

• parent.version: number= undefined

Returns ​

void

Source ​

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


Generated using typedoc-plugin-markdown and TypeDoc