Dependency
Index
Constructors
constructor
Parameters
from: UnknownNode
The node this dependency points from.
to: UnknownNode
The node this dependency points to.
Returns Dependency
Properties
readonlyfrom
The node this dependency points from.
readonlyto
The node this dependency points to.
Methods
addBehavior
To declare an ordering rule: when
onActionhappens toonFieldoffrom, thenforActionontoFieldoftomust have been applied first. Adding the same behavior twice is a no-op.Parameters
onField: string
onAction: DiffAction
toField: string
forAction: DiffAction
Returns void
addChildRelationship
To mark
toas the child offrom.Parameters
onField: string
toField: string
Returns void
addParentRelationship
To mark
toas the parent offrom.Parameters
onField: string
toField: string
Returns void
getRelationship
The relationship between the two nodes, if one was declared.
Returns { onField: string; toField: string; type: DependencyRelationship } | undefined
hasMatchingBehavior
Whether any behavior matches every argument given. Arguments left out match anything.
Parameters
optionalonField: string
optionalonAction: DiffAction
optionaltoField: string
optionalforAction: DiffAction
Returns boolean
isChildRelationship
Whether
tois a child offrom.Returns boolean
isEqual
Whether both dependencies connect the same two nodes, in the same direction.
Parameters
dependency: Dependency
Returns boolean
isParentRelationship
Whether
tois a parent offrom.Returns boolean
removeBehavior
To drop an ordering rule.
Parameters
onField: string
onAction: DiffAction
toField: string
forAction: DiffAction
Returns void
The edge between two nodes in Octo's graph.
A dependency is directed, and carries two things: an optional parent/child relationship, and a set of behaviors. A behavior states an ordering rule - "when this field of
fromis added, the matching action ontomust have run first" - and it is those rules that let Octo order a transaction correctly instead of guessing.Models create dependencies through
addChild()andaddRelationship(); you rarely construct one.Functions/Dependency
Definition of Dependencies.