Skip to main content

Interface: IAuditableItemGraphComponent

Interface describing an auditable item graph contract.

Extends​

  • IComponent

Methods​

create()​

create(vertex): Promise<string>

Create a new graph vertex.

Parameters​

vertex​

Omit<IAuditableItemGraphVertex, "id">

The vertex to create.

Returns​

Promise<string>

The id of the new graph item.


update()​

update(vertex): Promise<void>

Update a graph vertex (PUT - full replacement of vertex state). Concurrent updates for the same vertex are serialized via Mutex on the vertex id. Multi-replica deployments are not coordinated.

Parameters​

vertex​

IAuditableItemGraphVertex

The vertex to update.

Returns​

Promise<void>

A promise that resolves when the vertex has been updated.

Throws​

GeneralError If a bypass vertex is being switched back to audited.


updatePartial()​

updatePartial(partial): Promise<void>

Partially update a graph vertex (PATCH); only properties that are not undefined are applied. Sub-lists use explicit { add, remove } patch objects. Serialized with update() via Mutex on the same vertex id.

Parameters​

partial​

IAuditableItemGraphPartialVertex

The partial vertex update (must include id).

Returns​

Promise<void>

A promise that resolves when the partial update has been applied.

Throws​

GeneralError If a bypass vertex is being switched back to audited.


get()​

get(id, options?): Promise<IAuditableItemGraphVertex>

Get a graph vertex.

Parameters​

id​

string

The id of the vertex to get.

options?​

Additional options for the get operation.

includeDeleted?​

boolean

Whether to include deleted aliases, resource, edges, defaults to false.

verifySignatureDepth?​

VerifyDepth

How many signatures to verify, defaults to "none".

Returns​

Promise<IAuditableItemGraphVertex>

The vertex if found.

Throws​

NotFoundError if the vertex is not found.


getChangesets()​

getChangesets(id, cursor?, limit?, options?): Promise<{ changesets: IAuditableItemGraphChangesetList; cursor?: string; }>

Get a graph vertex changeset list.

Parameters​

id​

string

The id of the vertex to get.

cursor?​

string

The optional cursor to get next chunk.

limit?​

number

Limit the number of entities to return.

options?​

Additional options for the get operation.

verifySignatureDepth?​

VerifyDepth

How many signatures to verify, defaults to "none".

Returns​

Promise<{ changesets: IAuditableItemGraphChangesetList; cursor?: string; }>

The changeset if found, always empty for a bypass vertex.

Throws​

NotFoundError if the vertex is not found.


getChangeset()​

getChangeset(id, options?): Promise<IAuditableItemGraphChangeset>

Get a graph vertex changeset.

Parameters​

id​

string

The id of the vertex to get.

options?​

Additional options for the get operation.

verifySignatureDepth?​

VerifyDepth

How many signatures to verify, defaults to "none".

Returns​

Promise<IAuditableItemGraphChangeset>

The changeset if found.

Throws​

NotFoundError if the vertex or changeset is not found, a bypass vertex never has changesets.


getVersion()​

getVersion(id, version): Promise<IAuditableItemGraphVertex>

Get a graph vertex at a specific version.

Parameters​

id​

string

The id of the vertex.

version​

number

The version number to retrieve.

Returns​

Promise<IAuditableItemGraphVertex>

The vertex reconstructed at that version.

Throws​

NotFoundError if the vertex or version is not found, a bypass vertex never has versions.


getVersions()​

getVersions(id, options?): Promise<IAuditableItemGraphVertexVersionList>

Get all versions of a graph vertex.

Parameters​

id​

string

The id of the vertex.

options?​

Additional options for the operation.

after?​

string

Only return versions created after this ISO 8601 timestamp (exclusive).

before?​

string

Only return versions created before this ISO 8601 timestamp (exclusive).

Returns​

Promise<IAuditableItemGraphVertexVersionList>

The list of vertex versions, a bypass vertex returns a single baseline entry for its current state when that falls within the requested range.

Throws​

NotFoundError if the vertex is not found.


removeProof()​

removeProof(id): Promise<void>

Remove the proof for an item.

Parameters​

id​

string

The id of the vertex to remove the proof from.

Returns​

Promise<void>

A promise that resolves when the proof has been removed from all changesets.

Throws​

NotFoundError if the vertex is not found.


query()​

query(options?, conditions?, orderBy?, orderByDirection?, properties?, cursor?, limit?): Promise<{ entries: IAuditableItemGraphVertexList; cursor?: string; }>

Query the graph for vertices.

Parameters​

options?​

The query options.

id?​

string

The optional id to look for.

idMode?​

"id" | "alias" | "both"

Look in id, alias or both, defaults to both.

idExact?​

boolean

Find only exact matches, default to false meaning partial matching.

resourceTypes?​

string[]

Include vertices with specific resource types.

conditions?​

EntityCondition<IAuditableItemGraphVertex>

Conditions to use in the query.

orderBy?​

"dateCreated" | "dateModified"

The order for the results, defaults to dateCreated.

orderByDirection?​

SortDirection

The direction for the order, defaults to descending.

properties?​

keyof IAuditableItemGraphVertex[]

The properties to return, if not provided defaults to id, dateCreated, aliases and object.

cursor?​

string

The cursor to request the next chunk of entities.

limit?​

number

The maximum number of entities to return, a page can contain fewer so follow the cursor until it is absent to read them all.

Returns​

Promise<{ entries: IAuditableItemGraphVertexList; cursor?: string; }>

The entities, which can be partial if a limited keys list was provided.