Class: DependencyGraphBase
Represents the base class for implementing a concrete dependency graph.
Hierarchy
DependencyGraphBase
Table of contents
Constructors
Properties
Methods
- addDependency
- deleteResource
- extractDependenciesFromDoc
- getDependenciesForCollection
- getDependenciesOfCollection
- getDependsOnCollection
- isDependency
- isDependencyForAnyResourceOfCollection
- isDirectDependency
- populate
- purgeDependentOn
- setEditorExtractor
- setPayload
- setSchema
- compareResources
Constructors
constructor
• new DependencyGraphBase(): DependencyGraphBase
Returns
Properties
editorExtractor
• Protected
Optional
editorExtractor: EditorExtractor
The function that takes care of extracting the dependencies from a field of type richText
.
Defined in
src/dependency-graph/base.ts:42
payload
• Protected
payload: Payload
Payload instance
Defined in
src/dependency-graph/base.ts:37
schema
• Protected
schema: DependencyGraphSchema
Schema of the dependency graph
Defined in
src/dependency-graph/base.ts:32
Methods
addDependency
▸ addDependency(source
, target
): void
| Promise
\<void
>
Add target as a direct dependency of source.
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
target | DependencyGraphResource |
Returns
void
| Promise
\<void
>
Defined in
src/dependency-graph/base.ts:72
deleteResource
▸ deleteResource(resource
): void
| Promise
\<void
>
Deletes a resource from the dependency graph.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
Returns
void
| Promise
\<void
>
Defined in
src/dependency-graph/base.ts:64
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
>
Defined in
src/dependency-graph/base.ts:199
getDependenciesForCollection
▸ getDependenciesForCollection(resource
, collection
): DependencyGraphResource
[] | Promise
\<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
DependencyGraphResource
[] | Promise
\<DependencyGraphResource
[]>
Defined in
src/dependency-graph/base.ts:132
getDependenciesOfCollection
▸ getDependenciesOfCollection(resource
, collection
): DependencyGraphResource
[] | Promise
\<DependencyGraphResource
[]>
Get dependencies of resource
that is of collection
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
collection | string |
Returns
DependencyGraphResource
[] | Promise
\<DependencyGraphResource
[]>
Defined in
src/dependency-graph/base.ts:122
getDependsOnCollection
▸ getDependsOnCollection(resource
, collection
): DependencyGraphResource
[] | Promise
\<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
DependencyGraphResource
[] | Promise
\<DependencyGraphResource
[]>
Defined in
src/dependency-graph/base.ts:142
isDependency
▸ isDependency(source
, target
): boolean
| Promise
\<boolean
>
Is target a dependency for source?
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
target | DependencyGraphResource |
Returns
boolean
| Promise
\<boolean
>
Defined in
src/dependency-graph/base.ts:102
isDependencyForAnyResourceOfCollection
▸ isDependencyForAnyResourceOfCollection(target
, collection
): boolean
| Promise
\<boolean
>
Is target a dependency for any resource of collection given?
Parameters
Name | Type |
---|---|
target | DependencyGraphResource |
collection | string |
Returns
boolean
| Promise
\<boolean
>
Defined in
src/dependency-graph/base.ts:112
isDirectDependency
▸ isDirectDependency(source
, target
): boolean
| Promise
\<boolean
>
Is target a direct dependency for source?
Parameters
Name | Type |
---|---|
source | DependencyGraphResource |
target | DependencyGraphResource |
Returns
boolean
| Promise
\<boolean
>
Defined in
src/dependency-graph/base.ts:91
populate
▸ populate(): Promise
\<void
>
Used at Payload initialization to populate the dependency graph. You shouldn't call this function by yourself.
Returns
Promise
\<void
>
Defined in
src/dependency-graph/base.ts:151
purgeDependentOn
▸ purgeDependentOn(resource
): void
| Promise
\<void
>
The function purges the dependentsOn for a resource and removes for that dependencies the dependencyFor.
Parameters
Name | Type |
---|---|
resource | DependencyGraphResource |
Returns
void
| Promise
\<void
>
Defined in
src/dependency-graph/base.ts:83
setEditorExtractor
▸ setEditorExtractor(editorExtractor
): DependencyGraphBase
Parameters
Name | Type |
---|---|
editorExtractor | EditorExtractor |
Returns
Defined in
src/dependency-graph/base.ts:54
setPayload
▸ setPayload(payload
): DependencyGraphBase
Parameters
Name | Type |
---|---|
payload | Payload |
Returns
Defined in
src/dependency-graph/base.ts:49
setSchema
▸ setSchema(schema
): DependencyGraphBase
Parameters
Name | Type |
---|---|
schema | DependencyGraphSchema |
Returns
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