ModelGraph
Type Alias: ModelGraph
ModelGraph =
object
Defined in: compiler/src/definition.ts:106
Defined relationship for one model
Properties
ancestors?
optionalancestors?:string[]
Defined in: compiler/src/definition.ts:110
Model names of the parent of the parent, etc...
behaviors?
optionalbehaviors?:ModelGraphBehaviorDefinition[]
Defined in: compiler/src/definition.ts:202
Behavior attributes — properties whose type is a class marked with
@Behavior(). The Behavior class is referenced by Identifier so that
the Behavior's actions can be looked up in the top-level behaviors
map of the module.
binaries?
optionalbinaries?:ModelGraphBinaryDefinition[]
Defined in: compiler/src/definition.ts:195
Binaries attribute, in the model you can declare attributes as Binary, so users can upload binaries that will be linked to this object with some metadata
children?
optionalchildren?:string[]
Defined in: compiler/src/definition.ts:182
References to every model that declare this model as a parent
dependents?
optionaldependents?:ModelRelationDependent[]
Defined in: compiler/src/definition.ts:189
Reverse index: every relation targeting this model whose policy is not NONE
Computed at build time for the models of the same module. Contains relations are not listed: their owner
applies them to the models it lists.
indexes?
optionalindexes?:object[]
Defined in: compiler/src/definition.ts:177
Attributes tagged @Index / @Unique: an index (unique with @Unique) in the relational stores. The attributes
sharing a name (@Index <name>) form one composite index, in declaration order
attribute
attribute:
string
name?
optionalname?:string
unique?
optionalunique?:boolean
links?
optionallinks?:ModelRelation[]
Defined in: compiler/src/definition.ts:123
This contains links to other models. These links are low cardinality as ids and their selected attributes are stored in the current model.
maps?
optionalmaps?:object[]
Defined in: compiler/src/definition.ts:153
Maps are deduplication of data in your model
They are managed automatically by a service like ModelMapper
They are useful in NoSQL environment like DynamoDB or Firebase
attribute
attribute:
string
Attribute in the model
cascadeDelete
cascadeDelete:
boolean
@CascadeDelete (or @OnDelete CASCADE): deleting this model deletes the mapped models, the ones whose
targetLink targets it
model
model:
string
Target model
targetAttributes
targetAttributes:
string[]
Target model attributes to duplicate
targetLink
targetLink:
string
parent?
optionalparent?:Omit<ModelRelation,"type"|"ownership">
Defined in: compiler/src/definition.ts:116
If the model has a parent
onDelete is the policy applied to this model when the parent is deleted: CASCADE when omitted
polymorphicLinks?
optionalpolymorphicLinks?:object[]
Defined in: compiler/src/definition.ts:125
Polymorphic references; absent models means any registered target. No cascade is implied.
attribute
attribute:
string
models?
optionalmodels?:string[]
queries?
optionalqueries?:object[]
Defined in: compiler/src/definition.ts:133
Target other models with a new query This is usually our foreign keys
This will generate queries for you: SELECT * FROM 'model' WHERE 'targetAttribute' = 'this[attribute]'
attribute
attribute:
string
Attribute in the model
model
model:
string
Targeted model
targetAttribute?
optionaltargetAttribute?:string
Targeted model attribute