Skip to main content

GraphStore

@forge/monorepo


@forge/monorepo / backend/src / GraphStore

Interface: GraphStore

Defined in: backend/src/persistence/index.ts:1666

Methods

deleteSourceGraph()

deleteSourceGraph(input): Promise<{ pruned: number; }>

Defined in: backend/src/persistence/index.ts:1695

Parameters

input

TenantScope & object

Returns

Promise<{ pruned: number; }>


fingerprint()

fingerprint(input): Promise<string>

Defined in: backend/src/persistence/index.ts:1752

A stable serialisation of the whole graph, for the determinism assertion — AC-6.

On the port rather than built by the test, so every adapter is held to it. A test that serialised the graph itself would prove the reference adapter deterministic and say nothing about Postgres, where row order is the thing most likely to differ.

Parameters

input

TenantScope

Returns

Promise<string>


getCommunity()

getCommunity(input): Promise<StoredCommunity | null>

Defined in: backend/src/persistence/index.ts:1738

Parameters

input

TenantScope & object

Returns

Promise<StoredCommunity | null>


getEntities()

getEntities(input): Promise<readonly KnowledgeEntity[]>

Defined in: backend/src/persistence/index.ts:1702

Entities by exact id, for a query-side resolver that has already normalised.

Parameters

input

TenantScope & object

Returns

Promise<readonly KnowledgeEntity[]>


getEntity()

getEntity(input): Promise<KnowledgeEntity | null>

Defined in: backend/src/persistence/index.ts:1699

Parameters

input

TenantScope & object

Returns

Promise<KnowledgeEntity | null>


getSettings()

getSettings(input): Promise<GraphSettings>

Defined in: backend/src/persistence/index.ts:1667

Parameters

input

TenantScope

Returns

Promise<GraphSettings>


isSourceEnabled()

isSourceEnabled(input): Promise<boolean>

Defined in: backend/src/persistence/index.ts:1674

Parameters

input

TenantScope & object

Returns

Promise<boolean>


listCommunities()

listCommunities(input): Promise<Page<StoredCommunity>>

Defined in: backend/src/persistence/index.ts:1736

Parameters

input

TenantScope & PageRequest & object

Returns

Promise<Page<StoredCommunity>>


listEnabledSources()

listEnabledSources(input): Promise<Page<{ sourceId: string; sourceType: "file" | "artifact" | "message" | "external"; }>>

Defined in: backend/src/persistence/index.ts:1675

Parameters

input

TenantScope & PageRequest

Returns

Promise<Page<{ sourceId: string; sourceType: "file" | "artifact" | "message" | "external"; }>>


listEntities()

listEntities(input): Promise<Page<KnowledgeEntity>>

Defined in: backend/src/persistence/index.ts:1717

Parameters

input

TenantScope & PageRequest & object

Returns

Promise<Page<KnowledgeEntity>>


neighbours()

neighbours(input): Promise<readonly KnowledgeRelationship[]>

Defined in: backend/src/persistence/index.ts:1720

Every edge touching any of entityIds, in either direction. The traversal primitive.

Parameters

input

TenantScope & object

Returns

Promise<readonly KnowledgeRelationship[]>


replaceCommunities()

replaceCommunities(input): Promise<{ summariesKept: number; written: number; }>

Defined in: backend/src/persistence/index.ts:1732

Replaces the whole community hierarchy — REQ-064 (#270), task #272.

Whole rather than per level, because clustering is global: an entity moving between communities can change every level above it, and a partial write would leave a hierarchy whose levels disagree about who is in what. Summaries already written are carried over for communities whose fingerprint is unchanged, which is what makes re-summarisation incremental — the expensive half — while clustering stays global and cheap.

Parameters

input

TenantScope & object

Returns

Promise<{ summariesKept: number; written: number; }>


replaceSourceGraph()

replaceSourceGraph(input): Promise<{ entities: number; pruned: number; relationships: number; }>

Defined in: backend/src/persistence/index.ts:1687

Replaces one source's contribution to the graph.

Replace rather than append, for the reason replaceSource is: re-indexing a changed document must not leave its old claims in the graph. Entities and edges no source names any more are pruned by this call.

Refuses a row with empty provenance rather than storing an untraceable claim.

Parameters

input

TenantScope & object

Returns

Promise<{ entities: number; pruned: number; relationships: number; }>


resolveEntities()

resolveEntities(input): Promise<readonly KnowledgeEntity[]>

Defined in: backend/src/persistence/index.ts:1715

Entities whose normalised name matches, across every type — REQ-064 (#270), task #273.

A query says "the retry budget" and the graph holds concept:retry budget; the type is not in the question and cannot be. So resolution is by name, and the caller supplies names already normalised by normaliseName.

That the id is type:normalisedName is what makes this a suffix match rather than a second stored column, and it is why query-side and index-side resolution agree by construction: the id was built by the same function the caller just called. A separate normalised_name column would be a second copy to drift.

Parameters

input

TenantScope & object

Returns

Promise<readonly KnowledgeEntity[]>


setCommunitySummary()

setCommunitySummary(input): Promise<void>

Defined in: backend/src/persistence/index.ts:1741

Records a generated summary against the fingerprint it was written for.

Parameters

input

TenantScope & object

Returns

Promise<void>


setEnabled()

setEnabled(input): Promise<GraphSettings>

Defined in: backend/src/persistence/index.ts:1668

Parameters

input

TenantScope & object

Returns

Promise<GraphSettings>


setSourceEnabled()

setSourceEnabled(input): Promise<void>

Defined in: backend/src/persistence/index.ts:1671

Marks one source. Independent of the tenant switch — see GraphSettings.

Parameters

input

TenantScope & object

Returns

Promise<void>