abstractAResource <S, T>
Hierarchy
- ANode<S, T>
- AResource
Implements
- IResource<S, T>
Index
Properties
Methods
- addChild
- addFieldDependency
- addRelationship
- clonePropertiesInPlace
- cloneResourceInPlace
- cloneResponseInPlace
- cloneTagsInPlace
- diff
- diffInverse
- diffProperties
- diffTags
- diffUnpack
- findParentsByProperty
- findParentsByTag
- getAncestors
- getBoundaryMembers
- getChild
- getChildren
- getContext
- getDependencies
- getDependency
- getDependencyIndex
- getParents
- getSiblings
- hasAncestor
- isDeepEquals
- isMarkedDeleted
- merge
- remove
- removeDependency
- removeRelationship
- setContext
- synth
- toJSON
- cloneResource
- unSynth
Properties
readonlyparents
readonlyproperties
readonlyresourceId
readonlyresponse
readonlytags
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
addChild
Parameters
onField: string | keyof T
child: UnknownResource
toField: string
Returns { childToParentDependency: Dependency; parentToChildDependency: Dependency }
childToParentDependency: Dependency
parentToChildDependency: Dependency
addFieldDependency
Returns void
addRelationship
Returns { thatToThisDependency: Dependency; thisToThatDependency: Dependency }
thatToThisDependency: Dependency
thisToThatDependency: Dependency
clonePropertiesInPlace
Parameters
sourceResource: T
Returns void
cloneResourceInPlace
Parameters
sourceResource: T
deReferenceResource: (context: string) => Promise<UnknownResource>
Returns Promise<void>
cloneResponseInPlace
Parameters
sourceResource: UnknownResource
Returns void
cloneTagsInPlace
Parameters
sourceResource: UnknownResource
Returns void
diff
Parameters
previous: T
Returns Promise<Diff<UnknownNode, unknown>[]>
diffInverse
Parameters
diff: Diff
deReferenceResource: (context: string) => Promise<UnknownResource>
Returns Promise<void>
diffProperties
Parameters
previous: T
Returns Promise<Diff<UnknownNode, unknown>[]>
diffTags
Parameters
previous: T
Returns Promise<Diff<UnknownResource, DiffValueTypeTagUpdate>[]>
diffUnpack
findParentsByProperty
Parameters
filters: { key: string; value: unknown }[]
Returns UnknownResource[]
findParentsByTag
Parameters
filters: { key: string; value: string }[]
Returns UnknownResource[]
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[]
getBoundaryMembers
Returns UnknownResource[]
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.
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[]
getSiblings
Returns {}
[p string]: Dependency[]
inheritedhasAncestor
To check if given node is an ancestor of self.
Parameters
node: UnknownNode
The other node.
Returns boolean
isDeepEquals
Parameters
optionalother: UnknownResource
Returns boolean
isMarkedDeleted
To check if self is marked as deleted. A deleted node will be removed from the graph after the transaction.
Returns boolean
merge
remove
To mark self as deleted. A deleted node will be removed from the graph after the transaction.
- A node cannot be deleted if it has dependencies.
Parameters
force: boolean = false
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
staticcloneResource
Type parameters
- T: UnknownResource
Parameters
sourceResource: T
deReferenceResource: (context: string) => Promise<UnknownResource>
Returns Promise<T>
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.
Type parameters
Parameters
deserializationClass: any
resource: S
deReferenceResource: (context: string) => Promise<UnknownResource>
Returns Promise<T>
Resources