Skip to main content

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

ParameterType
entitiesList<EntityModel<any, any>>
valuesList<ValueObjectModel<any>>
sequencesList<SequenceModel>
conversionsMap<Newable<unknown>, ConversionModel>

Returns

Model

Overrides

AbstractModel.constructor

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

AbstractModel.parent

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 ParameterDefault type
T-
Sunknown

Parameters

ParameterTypeDescription
visitorModelVisitor<T, S>The visitor to accept.
state?SAn optional state to pass to the visitor.

Returns

T

The result of visiting this model element.

Overrides

AbstractModel.accept

Defined in

packages/verse-core/src/model/model.ts:264


addSequence()

addSequence(sequence: SequenceModel): Model

Parameters

ParameterType
sequenceSequenceModel

Returns

Model

Defined in

packages/verse-core/src/model/model.ts:229


conversion()

conversion(ctor?: Newable<unknown>): undefined | ConversionModel

Parameters

ParameterType
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
ParameterType
klassNewable<unknown>
Returns

EntityModel<any, any>

Defined in

packages/verse-core/src/model/model.ts:167

entity(name)

entity(name: string): EntityModel<any, any>

Parameters
ParameterType
namestring
Returns

EntityModel<any, any>

Defined in

packages/verse-core/src/model/model.ts:168


entityByLabel()

entityByLabel(label: string): EntityModel<any, any>

Parameters

ParameterType
labelstring

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

ParameterTypeDescription
otherunknownThe object to compare with.

Returns

boolean

Whether the objects are equal or not.

Overrides

AbstractModel.equals

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

AbstractModel.hashCode

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

ParameterTypeDescription
rewriterModelRewriterThe rewriter to use for rewriting the model.

Returns

Model

The rewritten model.

Overrides

AbstractModel.rewrite

Defined in

packages/verse-core/src/model/model.ts:268


sequence()

sequence(name: string): SequenceModel

Parameters

ParameterType
namestring

Returns

SequenceModel

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

AbstractModel.toJSON

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

AbstractModel.toObject

Defined in

packages/verse-core/src/model/model.ts:255


value()

value(name: string): ValueObjectModel<any>

Parameters

ParameterType
namestring

Returns

ValueObjectModel<any>

Defined in

packages/verse-core/src/model/model.ts:205


withConversion()

withConversion(ctor: Newable<unknown>, conversion: ConversionModel): Model

Parameters

ParameterType
ctorNewable<unknown>
conversionConversionModel

Returns

Model

Defined in

packages/verse-core/src/model/model.ts:243


withEntities()

withEntities(entities: List<EntityModel<any, any>>): Model

Parameters

ParameterType
entitiesList<EntityModel<any, any>>

Returns

Model

Defined in

packages/verse-core/src/model/model.ts:195