Skip to main content

Class: DependencyGraphBase

Represents the base class for implementing a concrete dependency graph.

Hierarchy​

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new DependencyGraphBase(): DependencyGraphBase

Returns​

DependencyGraphBase

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​

NameType
sourceDependencyGraphResource
targetDependencyGraphResource

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​

NameType
resourceDependencyGraphResource

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​

NameType
sourceDependencyGraphResource
docany
schemasDependencySchema[]

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​

NameType
resourceDependencyGraphResource
collectionstring

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​

NameType
resourceDependencyGraphResource
collectionstring

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​

NameType
resourceDependencyGraphResource
collectionstring

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​

NameType
sourceDependencyGraphResource
targetDependencyGraphResource

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​

NameType
targetDependencyGraphResource
collectionstring

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​

NameType
sourceDependencyGraphResource
targetDependencyGraphResource

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​

NameType
resourceDependencyGraphResource

Returns​

void | Promise\<void>

Defined in​

src/dependency-graph/base.ts:83


setEditorExtractor​

▸ setEditorExtractor(editorExtractor): DependencyGraphBase

Parameters​

NameType
editorExtractorEditorExtractor

Returns​

DependencyGraphBase

Defined in​

src/dependency-graph/base.ts:54


setPayload​

▸ setPayload(payload): DependencyGraphBase

Parameters​

NameType
payloadPayload

Returns​

DependencyGraphBase

Defined in​

src/dependency-graph/base.ts:49


setSchema​

▸ setSchema(schema): DependencyGraphBase

Parameters​

NameType
schemaDependencyGraphSchema

Returns​

DependencyGraphBase

Defined in​

src/dependency-graph/base.ts:44


compareResources​

▸ compareResources(first, second): boolean

Compares two resources with each other

Parameters​

NameType
firstDependencyGraphResource
secondDependencyGraphResource

Returns​

boolean

true if the resources are the same, false otherwise

Defined in​

src/dependency-graph/base.ts:18