Class: Model
The root model element.
Extends
Constructors
new Model()
new Model(
entities
:List
<EntityModel
<any
,any
>>,values
:List
<ValueObjectModel
<any
>>,sequences
:List
<SequenceModel
>,conversions
:Map
<Newable
<unknown
>,ConversionModel
>):Model
Parameters
Parameter | Type |
---|---|
entities | List <EntityModel <any , any >> |
values | List <ValueObjectModel <any >> |
sequences | List <SequenceModel > |
conversions | Map <Newable <unknown >, ConversionModel > |
Returns
Overrides
Defined in
packages/verse-core/src/model/model.ts:115
Accessors
entities
get
entities():List
<EntityModel
<any
,any
>>
Returns
List
<EntityModel
<any
, any
>>
Defined in
packages/verse-core/src/model/model.ts:151
parent
get
parent():never
Returns the parent model element.
Returns
never
The parent model element.
Overrides
Defined in
packages/verse-core/src/model/model.ts:163
sequences
get
sequences():List
<SequenceModel
>
Returns
List
<SequenceModel
>
Defined in
packages/verse-core/src/model/model.ts:159
values
get
values():List
<ValueObjectModel
<any
>>
Returns
List
<ValueObjectModel
<any
>>
Defined in
packages/verse-core/src/model/model.ts:155
Methods
accept()
accept<
T
,S
>(visitor
:ModelVisitor
<T
,S
>,state
?:S
):T
Accepts a visitor and returns the result of visiting this model element.
Type Parameters
Type Parameter | Default type |
---|---|
T | - |
S | unknown |
Parameters
Parameter | Type | Description |
---|---|---|
visitor | ModelVisitor <T , S > | The visitor to accept. |
state ? | S | An optional state to pass to the visitor. |
Returns
T
The result of visiting this model element.
Overrides
Defined in
packages/verse-core/src/model/model.ts:264
addSequence()
addSequence(
sequence
:SequenceModel
):Model
Parameters
Parameter | Type |
---|---|
sequence | SequenceModel |
Returns
Defined in
packages/verse-core/src/model/model.ts:229
conversion()
conversion(
ctor
?:Newable
<unknown
>):undefined
|ConversionModel
Parameters
Parameter | Type |
---|---|
ctor ? | Newable <unknown > |
Returns
undefined
| ConversionModel
Defined in
packages/verse-core/src/model/model.ts:235
entity()
entity(klass)
entity(
klass
:Newable
<unknown
>):EntityModel
<any
,any
>
Parameters
Parameter | Type |
---|---|
klass | Newable <unknown > |
Returns
EntityModel
<any
, any
>
Defined in
packages/verse-core/src/model/model.ts:167
entity(name)
entity(
name
:string
):EntityModel
<any
,any
>
Parameters
Parameter | Type |
---|---|
name | string |
Returns
EntityModel
<any
, any
>
Defined in
packages/verse-core/src/model/model.ts:168
entityByLabel()
entityByLabel(
label
:string
):EntityModel
<any
,any
>
Parameters
Parameter | Type |
---|---|
label | string |
Returns
EntityModel
<any
, any
>
Defined in
packages/verse-core/src/model/model.ts:183
equals()
equals(
other
:unknown
):boolean
Checks if the current object is equal to the provided object.
Parameters
Parameter | Type | Description |
---|---|---|
other | unknown | The object to compare with. |
Returns
boolean
Whether the objects are equal or not.
Overrides
Defined in
packages/verse-core/src/model/model.ts:277
hashCode()
hashCode():
number
Returns the hash code of this object.
Returns
number
The hash code.
Overrides
Defined in
packages/verse-core/src/model/model.ts:288
rewrite()
rewrite(
rewriter
:ModelRewriter
):Model
Rewrite method for processing a given model with a rewriter.
Parameters
Parameter | Type | Description |
---|---|---|
rewriter | ModelRewriter | The rewriter to use for rewriting the model. |
Returns
The rewritten model.
Overrides
Defined in
packages/verse-core/src/model/model.ts:268
sequence()
sequence(
name
:string
):SequenceModel
Parameters
Parameter | Type |
---|---|
name | string |
Returns
Defined in
packages/verse-core/src/model/model.ts:217
toJSON()
toJSON():
string
Returns a JSON representation of this model element.
Returns
string
The JSON representation.
Inherited from
Defined in
packages/verse-core/src/model/model.ts:82
toObject()
toObject(): {
conversions
: [Newable
<unknown
>, {read
:string
;write
:string
; }][];entities
: {concurrency
:undefined
| {version
:string
; };conditions
:Condition
[];data
:undefined
|List
<object
>;foreignKeys
: {onDelete
:undefined
|OnDelete
;properties
:string
[];references
:string
; }[];key
:undefined
|string
[];label
:string
;name
:string
;properties
:object
[];table
:undefined
|string
; }[];sequences
: {increment
:number
;name
:string
;start
:number
; }[];values
: {name
:string
;properties
:object
[]; }[]; }
Returns this instance as a plain object.
Returns
{conversions
: [Newable
<unknown
>, {read
: string
;write
: string
; }][];entities
: {concurrency
: undefined
| {version
: string
; };conditions
: Condition
[];data
: undefined
| List
<object
>;foreignKeys
: {onDelete
: undefined
| OnDelete
;properties
: string
[];references
: string
; }[];key
: undefined
| string
[];label
: string
;name
: string
;properties
: object
[];table
: undefined
| string
; }[];sequences
: {increment
: number
;name
: string
;start
: number
; }[];values
: {name
: string
;properties
: object
[]; }[]; }
The plain object.
conversions
conversions: [
Newable
<unknown
>, {read
:string
;write
:string
; }][]
entities
entities: {
concurrency
:undefined
| {version
:string
; };conditions
:Condition
[];data
:undefined
|List
<object
>;foreignKeys
: {onDelete
:undefined
|OnDelete
;properties
:string
[];references
:string
; }[];key
:undefined
|string
[];label
:string
;name
:string
;properties
:object
[];table
:undefined
|string
; }[]
sequences
sequences: {
increment
:number
;name
:string
;start
:number
; }[]
values
values: {
name
:string
;properties
:object
[]; }[]
Overrides
Defined in
packages/verse-core/src/model/model.ts:255
value()
value(
name
:string
):ValueObjectModel
<any
>
Parameters
Parameter | Type |
---|---|
name | string |
Returns
ValueObjectModel
<any
>
Defined in
packages/verse-core/src/model/model.ts:205
withConversion()
withConversion(
ctor
:Newable
<unknown
>,conversion
:ConversionModel
):Model
Parameters
Parameter | Type |
---|---|
ctor | Newable <unknown > |
conversion | ConversionModel |
Returns
Defined in
packages/verse-core/src/model/model.ts:243
withEntities()
withEntities(
entities
:List
<EntityModel
<any
,any
>>):Model
Parameters
Parameter | Type |
---|---|
entities | List <EntityModel <any , any >> |