BlockSuite API Documentation / @blocksuite/store / Schema
Class: Schema
Defined in: packages/framework/store/src/schema/schema.ts:7
Constructors
new Schema()
new Schema():
Schema
Returns
Schema
Properties
flavourSchemaMap
readonly
flavourSchemaMap:Map
<string
, {model
: {children
:string
[];flavour
:string
;isFlatData
:boolean
;parent
:string
[];props
: (...args
) =>Record
<string
,any
>;role
:"root"
|"hub"
|"content"
;toModel
: (...args
) =>BlockModel
<object
>; };transformer
: (...args
) =>BaseBlockTransformer
<object
>;version
:number
; }>
Defined in: packages/framework/store/src/schema/schema.ts:8
Accessors
versions
Get Signature
get versions():
object
Defined in: packages/framework/store/src/schema/schema.ts:74
Returns
object
Methods
get()
get(
flavour
):undefined
| {model
: {children
:string
[];flavour
:string
;isFlatData
:boolean
;parent
:string
[];props
: (...args
) =>Record
<string
,any
>;role
:"root"
|"hub"
|"content"
;toModel
: (...args
) =>BlockModel
<object
>; };transformer
: (...args
) =>BaseBlockTransformer
<object
>;version
:number
; }
Defined in: packages/framework/store/src/schema/schema.ts:23
Parameters
flavour
string
Returns
undefined
| { model
: { children
: string
[]; flavour
: string
; isFlatData
: boolean
; parent
: string
[]; props
: (...args
) => Record
<string
, any
>; role
: "root"
| "hub"
| "content"
; toModel
: (...args
) => BlockModel
<object
>; }; transformer
: (...args
) => BaseBlockTransformer
<object
>; version
: number
; }
isValid()
isValid(
child
,parent
):boolean
Defined in: packages/framework/store/src/schema/schema.ts:149
Parameters
child
string
parent
string
Returns
boolean
register()
register(
blockSchema
):Schema
Defined in: packages/framework/store/src/schema/schema.ts:163
Parameters
blockSchema
object
[]
Returns
Schema
safeValidate()
safeValidate(
flavour
,parentFlavour
?,childFlavours
?):boolean
Defined in: packages/framework/store/src/schema/schema.ts:10
Parameters
flavour
string
parentFlavour?
string
childFlavours?
string
[]
Returns
boolean
toJSON()
toJSON():
object
Defined in: packages/framework/store/src/schema/schema.ts:171
Returns
object
validate()
validate(
flavour
,parentFlavour
?,childFlavours
?):void
Defined in: packages/framework/store/src/schema/schema.ts:27
Parameters
flavour
string
parentFlavour?
string
childFlavours?
string
[]
Returns
void
validateSchema()
validateSchema(
child
,parent
):void
Defined in: packages/framework/store/src/schema/schema.ts:186
Parameters
child
model
{ children
: string
[]; flavour
: string
; isFlatData
: boolean
; parent
: string
[]; props
: (...args
) => Record
<string
, any
>; role
: "root"
| "hub"
| "content"
; toModel
: (...args
) => BlockModel
<object
>; } = ...
model.children?
string
[] = ContentSchema
model.flavour
string
= FlavourSchema
model.isFlatData?
boolean
= ...
model.parent?
string
[] = ParentSchema
model.props?
(...args
) => Record
<string
, any
> = ...
model.role
"root"
| "hub"
| "content"
= RoleSchema
model.toModel?
(...args
) => BlockModel
<object
> = ...
transformer?
(...args
) => BaseBlockTransformer
<object
> = ...
version
number
= ...
parent
model
{ children
: string
[]; flavour
: string
; isFlatData
: boolean
; parent
: string
[]; props
: (...args
) => Record
<string
, any
>; role
: "root"
| "hub"
| "content"
; toModel
: (...args
) => BlockModel
<object
>; } = ...
model.children?
string
[] = ContentSchema
model.flavour
string
= FlavourSchema
model.isFlatData?
boolean
= ...
model.parent?
string
[] = ParentSchema
model.props?
(...args
) => Record
<string
, any
> = ...
model.role
"root"
| "hub"
| "content"
= RoleSchema
model.toModel?
(...args
) => BlockModel
<object
> = ...
transformer?
(...args
) => BaseBlockTransformer
<object
> = ...
version
number
= ...
Returns
void