API > @blocksuite/store > Schema
Class: Schema ​
Constructors ​
constructor ​
new Schema():
Schema
Returns ​
Properties ​
flavourSchemaMap ​
readonlyflavourSchemaMap: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 ​
getversions():object
Defined In ​
packages/store/src/schema/schema.ts:15
Methods ​
_matchFlavour ​
private_matchFlavour(childFlavour,parentFlavour):boolean
Parameters ​
| Parameter | Type |
|---|---|
childFlavour | string |
parentFlavour | string |
Returns ​
boolean
Defined In ​
packages/store/src/schema/schema.ts:218
_upgradeBlockVersions ​
private_upgradeBlockVersions(rootData):void
Parameters ​
| Parameter | Type |
|---|---|
rootData | Doc |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:176
_validateParent ​
private_validateParent(child,parent):boolean
Parameters ​
| Parameter | Type |
|---|---|
child | object |
child.model | `{ flavour: string; role: "root" |
child.onUpgrade? | function |
child.transformer? | function |
child.version | number |
parent | object |
parent.model | `{ flavour: string; role: "root" |
parent.onUpgrade? | function |
parent.transformer? | function |
parent.version | number |
Returns ​
boolean
Defined In ​
packages/store/src/schema/schema.ts:225
_validateRole ​
private_validateRole(child,parent):void
Parameters ​
| Parameter | Type |
|---|---|
child | object |
child.model | `{ flavour: string; role: "root" |
child.onUpgrade? | function |
child.transformer? | function |
child.version | number |
parent | object |
parent.model | `{ flavour: string; role: "root" |
parent.onUpgrade? | function |
parent.transformer? | function |
parent.version | number |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:190
register ​
register(
blockSchema):Schema
Parameters ​
| Parameter | Type |
|---|---|
blockSchema | {model: `{ flavour: string; role: "root" |
Returns ​
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 ​
| Parameter | Type |
|---|---|
flavour | string |
oldVersion | number |
blockData | Map< unknown > |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:154
upgradePage ​
upgradePage(
oldPageVersion,oldBlockVersions,pageData):void
Parameters ​
| Parameter | Type |
|---|---|
oldPageVersion | number |
oldBlockVersions | Record< string, number > |
pageData | Doc |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:124
upgradeWorkspace ​
upgradeWorkspace(
rootData):void
Parameters ​
| Parameter | Type |
|---|---|
rootData | Doc |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:110
validate ​
validate(
flavour,parentFlavour?,childFlavours?):void
Parameters ​
| Parameter | Type |
|---|---|
flavour | string |
parentFlavour? | string |
childFlavours? | string[] |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:46
validateSchema ​
validateSchema(
child,parent):void
Parameters ​
| Parameter | Type |
|---|---|
child | object |
child.model | `{ flavour: string; role: "root" |
child.onUpgrade? | function |
child.transformer? | function |
child.version | number |
parent | object |
parent.model | `{ flavour: string; role: "root" |
parent.onUpgrade? | function |
parent.transformer? | function |
parent.version | number |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:97