Class: InMemoryDependencyGraph
Represents the base class for implementing a concrete dependency graph.
Hierarchy
↳
InMemoryDependencyGraph
Table of contents
Constructors
Properties
Methods
- addDependency
- deleteResource
- extractDependenciesFromDoc
- getDependenciesForCollection
- getDependenciesOfCollection
- getDependencyGraphNode
- getDependsOnCollection
- isDependency
- isDependencyForAnyResourceOfCollection
- isDirectDependency
- populate
- purgeDependentOn
- safeGetDependencyGraphNode
- setEditorExtractor
- setPayload
- setSchema
- compareResources
Constructors
constructor
• new InMemoryDependencyGraph(): InMemoryDependencyGraph
Returns
Inherited from
DependencyGraphBase.constructor
Properties
collections
• Private
collections: DependencyGraphCollections
= {}
Defined in
src/dependency-graph/in-memory.ts:11
editorExtractor
• Protected
Optional
editorExtractor: EditorExtractor
The function that takes care of extracting the dependencies from a field of type richText
.
Inherited from
DependencyGraphBase.editorExtractor
Defined in
src/dependency-graph/base.ts:42
globals
• Private
globals: DependencyGraphGlobals
= {}
Defined in
src/dependency-graph/in-memory.ts:12
payload
• Protected
payload: Payload
Payload instance
Inherited from
Defined in
src/dependency-graph/base.ts:37
schema
• Protected
schema: DependencyGraphSchema
Schema of the dependency graph
Inherited from
Defined in
src/dependency-graph/base.ts:32
Methods
addDependency
▸ addDependency(source
, target
): void
Add target as a direct dependency of source.
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
target | DependencyGraphResource |
Returns
void
Overrides
DependencyGraphBase.addDependency
Defined in
src/dependency-graph/in-memory.ts:108
deleteResource
▸ deleteResource(resource
): void
Deletes a resource from the dependency graph.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
Returns
void
Overrides
DependencyGraphBase.deleteResource
Defined in
src/dependency-graph/in-memory.ts:76
extractDependenciesFromDoc
▸ extractDependenciesFromDoc(source
, doc
, schemas
): Promise
\<void
>
Used to extract dependencies from a document based on schemas. The function will automatically populate the dependency graph.
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
doc | any |
schemas | DependencySchema [] |
Returns
Promise
\<void
>
Inherited from
DependencyGraphBase.extractDependenciesFromDoc
Defined in
src/dependency-graph/base.ts:199
getDependenciesForCollection
▸ getDependenciesForCollection(resource
, collection
): DependencyGraphResource
[]
Get dependencies from resource
that is of collection
. This function traverses from bottom to up, using dependecyFor
.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
collection | string |
Returns
Overrides
DependencyGraphBase.getDependenciesForCollection
Defined in
src/dependency-graph/in-memory.ts:203
getDependenciesOfCollection
▸ getDependenciesOfCollection(resource
, collection
): DependencyGraphResource
[]
Get dependencies of resource
that is of collection
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
collection | string |
Returns
Overrides
DependencyGraphBase.getDependenciesOfCollection
Defined in
src/dependency-graph/in-memory.ts:259
getDependencyGraphNode
▸ getDependencyGraphNode(resource
): undefined
| DependencyGraphNode
Extracts the node from the dependency graph.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
Returns
undefined
| DependencyGraphNode
DependencyGraphNode
, if doesn't exists it will be undefined
Defined in
src/dependency-graph/in-memory.ts:20
getDependsOnCollection
▸ getDependsOnCollection(resource
, collection
): DependencyGraphResource
[]
Get dependencies from resource
that is of collection
. This function traverses from up to bottom, using dependentOn
.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
collection | string |
Returns
Overrides
DependencyGraphBase.getDependsOnCollection
Defined in
src/dependency-graph/in-memory.ts:231
isDependency
▸ isDependency(source
, target
): boolean
Is target a dependency for source?
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
target | DependencyGraphResource |
Returns
boolean
Overrides
DependencyGraphBase.isDependency
Defined in
src/dependency-graph/in-memory.ts:159
isDependencyForAnyResourceOfCollection
▸ isDependencyForAnyResourceOfCollection(target
, collection
): boolean
Is target a dependency for any resource of collection given?
Parameters
Name | Type |
---|---|
target | DependencyGraphResource |
collection | string |
Returns
boolean
Overrides
DependencyGraphBase.isDependencyForAnyResourceOfCollection
Defined in
src/dependency-graph/in-memory.ts:178
isDirectDependency
▸ isDirectDependency(source
, target
): boolean
Is target a direct dependency for source?
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
target | DependencyGraphResource |
Returns
boolean
Overrides
DependencyGraphBase.isDirectDependency
Defined in
src/dependency-graph/in-memory.ts:146
populate
▸ populate(): Promise
\<void
>
Used at Payload initialization to populate the dependency graph. You shouldn't call this function by yourself.
Returns
Promise
\<void
>
Inherited from
Defined in
src/dependency-graph/base.ts:151
purgeDependentOn
▸ purgeDependentOn(resource
): void
The function purges the dependentsOn for a resource and removes for that dependencies the dependencyFor.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
Returns
void
Overrides
DependencyGraphBase.purgeDependentOn
Defined in
src/dependency-graph/in-memory.ts:126
safeGetDependencyGraphNode
▸ safeGetDependencyGraphNode(resource
): DependencyGraphNode
Extracts dependency graph node, and if it doesn't exist, it will create it.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
Returns
Defined in
src/dependency-graph/in-memory.ts:45
setEditorExtractor
▸ setEditorExtractor(editorExtractor
): DependencyGraphBase
Parameters
Name | Type |
---|---|
editorExtractor | EditorExtractor |
Returns
Inherited from
DependencyGraphBase.setEditorExtractor
Defined in
src/dependency-graph/base.ts:54
setPayload
▸ setPayload(payload
): DependencyGraphBase
Parameters
Name | Type |
---|---|
payload | Payload |
Returns
Inherited from
DependencyGraphBase.setPayload
Defined in
src/dependency-graph/base.ts:49
setSchema
▸ setSchema(schema
): DependencyGraphBase
Parameters
Name | Type |
---|---|
schema | DependencyGraphSchema |
Returns
Inherited from
Defined in
src/dependency-graph/base.ts:44
compareResources
▸ compareResources(first
, second
): boolean
Compares two resources with each other
Parameters
Name | Type |
---|---|
first | DependencyGraphResource |
second | DependencyGraphResource |
Returns
boolean
true
if the resources are the same, false
otherwise
Inherited from
DependencyGraphBase.compareResources