API > @blocksuite/store > Schema
Class: Schema ​
Constructors ​
constructor ​
new Schema():
Schema
Returns ​
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 ​
Parameter | Type |
---|---|
childFlavour | string |
parentFlavour | string |
Returns ​
boolean
Defined In ​
packages/store/src/schema/schema.ts:220
_upgradeBlockVersions ​
private
_upgradeBlockVersions(rootData
):void
Parameters ​
Parameter | Type |
---|---|
rootData | Doc |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:178
_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:227
_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:192
register ​
register(
blockSchema
):Schema
Parameters ​
Parameter | Type |
---|---|
blockSchema | {model : `{ flavour: string; role: "root" |
Returns ​
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 ​
Parameter | Type |
---|---|
flavour | string |
oldVersion | number |
blockData | Map < unknown > |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:156
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:126
upgradeWorkspace ​
upgradeWorkspace(
rootData
):void
Parameters ​
Parameter | Type |
---|---|
rootData | Doc |
Returns ​
void
Defined In ​
packages/store/src/schema/schema.ts:112
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:48
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:99