abstractAOverlay <S, T>
Hierarchy
- AModel<S, T>
- AOverlay
Implements
- IOverlay<S, T>
Index
Properties
Methods
- addAnchor
- addChild
- addFieldDependency
- addRelationship
- deriveDependencyField
- diff
- diffAnchors
- diffProperties
- getAncestors
- getAnchor
- getAnchorIndex
- getAnchors
- getAnchorsMatchingSchema
- getBoundaryMembers
- getChild
- getChildren
- getContext
- getDependencies
- getDependency
- getDependencyIndex
- getModelsMatchingSchema
- getOverlaysMatchingSchema
- getParents
- getResourcesMatchingSchema
- getSiblings
- hasAncestor
- removeAllAnchors
- removeAnchor
- removeDependency
- removeRelationship
- setContext
- synth
- toJSON
- unSynth
Properties
readonlyinheritedanchors
readonlyoverlayId
readonlyproperties
staticreadonlyinheritedNODE_NAME
The name of the node. All nodes with same name are of the same category.
staticreadonlyinheritedNODE_PACKAGE
The package of the node.
staticreadonlyinheritedNODE_SCHEMA
The schema of the node.
staticreadonlyinheritedNODE_TYPE
The type of the node.
Methods
addAnchor
To add an Anchor.
Each node can store multiple anchors for reference. These anchors don't necessarily need to be parented by self, but must be unique, i.e. an anchor, identified by it's parent, cannot be added twice to self's list of anchors.
Parameters
anchor: MatchingAnchor<BaseAnchorSchema> | UnknownAnchor
Returns void
inheritedaddChild
To add another node as a child of self.
Parameters
onField: string | keyof T
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
inheritedaddFieldDependency
To add a behavior on self to order multiple actions of self.
Parameters
behaviors: { forAction: DiffAction; onAction: DiffAction; onField: string | keyof T; toField: string | keyof T }[]
Returns void
inheritedaddRelationship
To add another node as a sibling of self.
Parameters
to: UnknownNode
The sibling node.
Returns { thisToThatDependency: Dependency }
- thisToThatDependency: The dependency edge from self to sibling.
thisToThatDependency: Dependency
inheritedderiveDependencyField
Returns undefined | string
diff
Returns Promise<Diff<UnknownNode, unknown>[]>
diffAnchors
Returns Promise<Diff<UnknownNode, unknown>[]>
diffProperties
Returns Promise<Diff<UnknownNode, unknown>[]>
inheritedgetAncestors
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.
parent: UnknownModel
The parent of the anchor.
- If parent is not given, then self is considered the parent of this anchor.
Returns undefined | UnknownAnchor
getAnchorIndex
To get the index of an anchor with a given ID and parent.
Parameters
anchorId: string
The ID of the anchor.
parent: UnknownModel
The parent of the anchor.
- If parent is not given, then self is considered the parent of this anchor.
Returns number
inheritedgetAnchors
To get all anchors, filtered by anchor properties.
Parameters
filters: { key: string; value: unknown }[] = []
A set of filters, where
key
is the property name andvalue
is the value to filter by.types: Constructable<MatchingAnchor<BaseAnchorSchema> | UnknownAnchor>[] = []
Returns UnknownAnchor[]
inheritedgetAnchorsMatchingSchema
Type parameters
Parameters
from: Constructable<S>
propertyFilters: ObjectKeyValue<S[properties]>[] = []
__namedParameters: { searchBoundaryMembers?: boolean } = {}
optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingAnchor<S>[]>
inheritedgetBoundaryMembers
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[]
inheritedgetChild
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
inheritedgetChildren
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[]
inheritedgetContext
To get the context of self. A context is a string representation of self that uniquely identifies self in the graph.
Returns string
inheritedgetDependencies
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[]
inheritedgetDependency
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.
inheritedgetDependencyIndex
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.
inheritedgetModelsMatchingSchema
Type parameters
- S: object
Parameters
schema: Constructable<S>
filters: ObjectKeyValue<S>[] = []
__namedParameters: { searchBoundaryMembers?: boolean } = {}
optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingModel<S>[]>
inheritedgetOverlaysMatchingSchema
Type parameters
Parameters
schema: Constructable<S>
propertyFilters: ObjectKeyValue<S[properties]>[] = []
__namedParameters: { searchBoundaryMembers?: boolean } = {}
optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingModel<S>[]>
inheritedgetParents
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[]
inheritedgetResourcesMatchingSchema
Type parameters
Parameters
schema: Constructable<S>
propertyFilters: ObjectKeyValue<S[properties]>[] = []
responseFilters: ObjectKeyValue<S[response]>[] = []
__namedParameters: { searchBoundaryMembers?: boolean } = {}
optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingResource<S>[]>
inheritedgetSiblings
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[]
inheritedhasAncestor
To check if given node is an ancestor of self.
Parameters
node: UnknownNode
The other node.
Returns boolean
inheritedremoveAllAnchors
To remove all anchors from self.
Returns void
removeAnchor
To remove an anchor from self.
Parameters
anchor: MatchingAnchor<BaseAnchorSchema> | UnknownAnchor
The anchor to remove.
Returns void
inheritedremoveDependency
To remove a dependency from self.
Parameters
dependencyIndex: number
The index of the dependency to remove.
Returns void
inheritedremoveRelationship
To remove ALL dependencies from self for the given node.
Parameters
node: UnknownNode
The other node.
Returns void
setContext
Returns string
synth
Returns S
inheritedtoJSON
Returns S
staticunSynth
To create self given its serialized representation.
- First argument is the serialized representation.
- Second argument is the
deReferenceContext()
function to resolve other nodes self depends on.
Parameters
deserializationClass: any
overlay: BaseOverlaySchema
deReferenceContext: (context: string) => Promise<UnknownModel>
Returns Promise<UnknownOverlay>
Overlays