Environment
Hierarchy
- AModel<IEnvironment, Environment>
- Environment
Index
Constructors
Properties
Methods
- addAnchor
- addChild
- addRelationship
- diff
- diffProperties
- getAncestors
- getAnchor
- getAnchorIndex
- getAnchors
- getBoundaryMembers
- getChild
- getChildren
- getContext
- getDependencies
- getDependency
- getDependencyIndex
- getParents
- getSiblings
- hasAncestor
- removeAllAnchors
- removeAnchor
- removeDependency
- removeRelationship
- setContext
- synth
- unSynth
Constructors
constructor
Parameters
environmentName: string
Returns Environment
Properties
readonlyNODE_NAME
The unique name of the node. All nodes with same name are of the same category.
readonlyNODE_TYPE
The type of the node.
readonlyenvironmentName
The name of the environment. An environment must be unique within a Region. But multiple Regions can share the same environment name.
readonlyenvironmentVariables
A set of environment variables to be passed to any Execution running in this environment.
Methods
addAnchor
addChild
To add another node as a child of self.
Parameters
onField: string
The field in self on which the dependency is being defined.
child: UnknownNode
The child node.
toField: string
The field in child on which the dependency is being defined.
Returns { childToParentDependency: Dependency; parentToChildDependency: Dependency }
- childToParentDependency: The dependency edge from child to self.
- parentToChildDependency: The dependency edge from self to child.
childToParentDependency: Dependency
parentToChildDependency: Dependency
addRelationship
To add another node as a sibling of self.
Parameters
to: UnknownNode
The sibling node.
Returns { thatToThisDependency: Dependency; thisToThatDependency: Dependency }
- thatToThisDependency: The dependency edge from sibling to self.
- thisToThatDependency: The dependency edge from self to sibling.
thatToThisDependency: Dependency
thisToThatDependency: Dependency
diff
Compares and calculates the difference between the current version of self node, and the previous version.
- Recursively compares self children too.
Returns Promise<Diff[]>
diffProperties
To compare properties of the current version of self node, vs. the previous version. It is a helper method to the
diff()
method.- This method is called by the () method.
Returns Promise<Diff[]>
getAncestors
To get all ancestors of self.
- Includes parent nodes.
- Might include sibling nodes, if the dependency behaviors dictate the sibling is necessary for self node to exist.
Returns UnknownNode[]
getAnchor
To get an anchor with a given ID and parent.
Parameters
anchorId: string
The ID of the anchor.
optionalparent: UnknownModel
The parent of the anchor.
- If parent is not given, then self is considered the parent of this anchor.
Returns undefined | AAnchor
getAnchorIndex
To get the index of an anchor with a given ID and parent.
Parameters
anchorId: string
The ID of the anchor.
optionalparent: UnknownModel
The parent of the anchor.
- If parent is not given, then self is considered the parent of this anchor.
Returns number
getAnchors
To get all anchors, filtered by anchor properties.
Parameters
filters: { key: string; value: any }[] = []
A set of filters, where
key
is the property name andvalue
is the value to filter by.
Returns AAnchor[]
getBoundaryMembers
To get a boundary (sub graph) of self. A boundary is a group of nodes that must belong together. The boundary consists of all nodes associated with self, which includes parents, grand parents, children, grand children, and siblings.
Returns UnknownNode[]
getChild
To get a child of self that matches the given filters.
Parameters
name: string
The NODE_NAME of the child.
filters: { key: string; value: any }[] = []
A set of filters, to be applied on children, where
key
is the property name andvalue
is the value to filter by.
Returns undefined | UnknownNode
getChildren
To get all children of self.
Parameters
optionalname: string
The NODE_NAME of the children.
Returns {}
All children as an object with the NODE_NAME as the key, and self's dependency to the child as the value.
[key string]: Dependency[]
getContext
To get the context of self. A context is a string representation of self that uniquely identifies self in the graph.
Returns string
getDependencies
To get all dependencies of self.
- Can be filtered to just dependencies with a single node.
Parameters
optionalto: UnknownNode
The other node. If present, will only return dependencies of self with this node.
Returns Dependency[]
getDependency
To get a dependency of self with another node.
Parameters
to: UnknownNode
The other node.
relationship: DependencyRelationship
The relationship between self and the other node.
Returns undefined | Dependency
The dependency with the other node having the given relationship, or
undefined
if not found.
getDependencyIndex
To get the index of a dependency of self with another node.
Parameters
to: UnknownNode
The other node.
relationship: DependencyRelationship
The relationship between self and the other node.
Returns number
The index of the dependency with the other node having the given relationship, or
-1
if not found.
getParents
To get all parent of self.
Parameters
optionalname: string
The NODE_NAME of the parent.
Returns {}
All parents as an object with the NODE_NAME as the key, and self's dependency to the parent as the value.
[key string]: Dependency[]
getSiblings
To get all siblings of self.
Parameters
optionalname: string
The NODE_NAME of the sibling.
Returns {}
All siblings as an object with the NODE_NAME as the key, and self's dependency to the sibling as the value.
[key string]: Dependency[]
hasAncestor
To check if given node is an ancestor of self.
Parameters
node: UnknownNode
The other node.
Returns boolean
removeAllAnchors
To remove all anchors from self.
Returns void
removeAnchor
To remove an anchor from self.
Parameters
anchor: AAnchor
The anchor to remove.
Returns void
removeDependency
To remove a dependency from self.
Parameters
dependencyIndex: number
The index of the dependency to remove.
Returns void
removeRelationship
To remove ALL dependencies from self for the given node.
Parameters
node: UnknownNode
The other node.
Returns void
setContext
To set the context of self. A context is a string representation of self that uniquely identifies self in the graph.
Returns string
synth
Generates a serializable representation of self.
Returns IEnvironment
staticunSynth
Parameters
environment: IEnvironment
deReferenceContext: (context: string) => Promise<UnknownModel>
Returns Promise<Environment>
An Environment model is the logical sub-section of a Region which isolates one runtime environment from another. E.g. qa, staging, production, etc.
Definition of Default Models.