Manta Developers
GitHub
Menu

@manta-eu/client/shared/action-graph

Reference for @manta-eu/client/shared/action-graph as it is on main.

Type Aliases

ActionDeletion

ActionDeletion = Omit<ActionInput, "properties">


ActionGraphInput

ActionGraphInput = object

Properties

graph

graph: object

@graph

@graph: readonly ActionGraphNode[]


ActionGraphNode

ActionGraphNode = object & Record<string, unknown>

Type Declaration

@id

@id: string

@type

@type: string | readonly [string, ...string[]]


ActionGraphql

ActionGraphql = (document, variables, options?) => Promise<unknown>

Sends a GraphQL document to Manta, scoped to the datastore the caller works in.

Parameters

document

string

variables

Record<string, unknown>

options?
signal?

AbortSignal

Returns

Promise<unknown>


ActionOutcome

ActionOutcome = { planGraphIri: string; status: "done"; } | { message: string; planGraphIri: string; status: "pending"; workflowId?: string; } | { message: string; status: "failed"; subcode?: number; }


AwaitRunArgs

AwaitRunArgs = object

Properties

formatError?

optional formatError?: (raw) => string

Parameters
raw

string

Returns

string

pendingMessage

pendingMessage: string

planGraphIri

planGraphIri: string

pollIntervalMs

pollIntervalMs: number

signal?

optional signal?: AbortSignal

timeoutMs

timeoutMs: number

workflowId?

optional workflowId?: string


EntityOutcome

EntityOutcome = object

Properties

endedAt?

optional endedAt?: string

errorMessage?

optional errorMessage?: string

generated

generated: object[]

iri

iri: string

types

types: string[]

skippedReason?

optional skippedReason?: string

startedAt?

optional startedAt?: string

used

used: string


ExecuteActionGraphVariables

ExecuteActionGraphVariables = object

Properties

input

input: ActionGraphInput


FollowPendingAction

FollowPendingAction = (pending) => Promise<Exclude<ActionOutcome, PendingAction>>

Parameters

pending

PendingAction

Returns

Promise<Exclude<ActionOutcome, PendingAction>>


GraphOp

GraphOp = { input: ActionInput; op: "add"; } | { input: ActionInput; op: "update"; } | { input: ActionDeletion; op: "delete"; }


GraphRun

GraphRun = object

results lines up with the ops sent; outcome is the whole change as one.

Properties

outcome

outcome: ActionOutcome

results

results: OpResult[]


GraphRunOptions

GraphRunOptions = object

Properties

follow?

optional follow?: FollowPendingAction

Takes over a run still going when timeoutMs ends.

formatError?

optional formatError?: (raw) => string

Parameters
raw

string

Returns

string

graphql

graphql: ActionGraphql

onError?

optional onError?: (cause) => void

Hears why a finished plan’s outcomes could not be read; its ops then stay pending.

Parameters
cause

unknown

Returns

void

pendingMessage?

optional pendingMessage?: string

pollIntervalMs?

optional pollIntervalMs?: number

readOptions

readOptions: Options

readOutcomes?

optional readOutcomes?: (planGraphIri) => Promise<EntityOutcome[]>

Reads a finished plan’s per-entity outcomes; planOutcomes over readOptions unless given.

Parameters
planGraphIri

string

Returns

Promise<EntityOutcome[]>

signal?

optional signal?: AbortSignal

timeoutMs?

optional timeoutMs?: number


GraphStart

GraphStart = { planGraphIri: string; status: "started"; workflowId?: string; } | { code?: GQLExecuteActionErrorCode | null; message: string; status: "refused"; } | { message: string; status: "unknown"; }


OpResult

OpResult = { created?: string; planGraphIri: string; status: "done"; } | { message: string; planGraphIri: string; status: "pending"; } | { message: string; skipped?: boolean; status: "failed"; subcode?: number; }


OutcomeRead

OutcomeRead = object

An op’s own outcome, and whether the plan’s outcomes could be read at all.

Properties

known

known: boolean

outcome

outcome: EntityOutcome | undefined


PendingAction

PendingAction = Extract<ActionOutcome, { status: "pending"; }>

Variables

actionShapeKey

const actionShapeKey: "m:actionShape" = "m:actionShape"

Manta resolves the m: prefix against the realm it runs as, so the key holds in every realm.


maxGraphNodes

const maxGraphNodes: 101 = 101

Manta takes at most this many entities in one plan.


nothingToSendMessage

const nothingToSendMessage: "Nothing in this change is something Manta can send." = "Nothing in this change is something Manta can send."


PlanOutcomeSchema

const PlanOutcomeSchema: object

Type Declaration

@type

readonly @type: "prov:Activity"

endedAt

readonly endedAt: object = ProvActivitySchema.endedAtTime

endedAt.@id

readonly @id: "prov:endedAtTime"

endedAt.@optional

readonly @optional: true

endedAt.@type

readonly @type: "xsd:dateTime"

errorMessage

readonly errorMessage: object = ProvActivitySchema.errorMessage

errorMessage.@id

readonly @id: "m:errorMessage"

errorMessage.@optional

readonly @optional: true

generated

readonly generated: object

generated.@array

readonly @array: true = true

generated.@id

readonly @id: "prov:generated"

generated.@optional

readonly @optional: true = true

generated.@schema

readonly @schema: object

generated.@schema.types

readonly types: object

generated.@schema.types.@array

readonly @array: true = true

generated.@schema.types.@id

readonly @id: "rdf:type" = rdf.type

generated.@schema.types.@optional

readonly @optional: true = true

generated.@schema.types.@type

readonly @type: "ldkit:IRI" = ldkit.IRI

runPlan

readonly runPlan: object

runPlan.@id

readonly @id: "m:runPlan"

runPlan.@type

readonly @type: "ldkit:IRI" = ldkit.IRI

skippedReason

readonly skippedReason: object = ProvActivitySchema.skippedReason

skippedReason.@id

readonly @id: "m:skippedReason"

skippedReason.@optional

readonly @optional: true

startedAt

readonly startedAt: object

startedAt.@id

readonly @id: "prov:startedAtTime"

startedAt.@optional

readonly @optional: true = true

startedAt.@type

readonly @type: "xsd:dateTime"

used

readonly used: object

used.@array

readonly @array: true = true

used.@id

readonly @id: "prov:used"

used.@optional

readonly @optional: true = true

used.@type

readonly @type: "ldkit:IRI" = ldkit.IRI


rejectedWithoutReason

const rejectedWithoutReason: "Manta rejected the action without saying why." = "Manta rejected the action without saying why."


skippedMessage

const skippedMessage: "Not sent, because a change it depends on was not made." = "Not sent, because a change it depends on was not made."


twiceMessage

const twiceMessage: "Not sent, because this change touches the same entity twice in different ways." = "Not sent, because this change touches the same entity twice in different ways."


unconfirmedMessage

const unconfirmedMessage: "Manta is still sending the change; the channel has not confirmed it yet." = "Manta is still sending the change; the channel has not confirmed it yet."


unreachableMessage

const unreachableMessage: "Manta could not be reached." = "Manta could not be reached."

Functions

actionGraphInput()

actionGraphInput(nodes): ActionGraphInput

Parameters

nodes

readonly ActionGraphNode[]

Returns

ActionGraphInput


adding()

adding(input): GraphOp

Parameters

input

GQLExecuteActionUpdateInput

Returns

GraphOp


awaitRun()

awaitRun(graphql, args): Promise<ActionOutcome>

Polls the plan’s run until it completes or fails, or reports it pending once timeoutMs ends.

Parameters

graphql

ActionGraphql

args

AwaitRunArgs

Returns

Promise<ActionOutcome>


channelErrorMessage()

channelErrorMessage(raw): string

The message a channel’s error carries for a person, out of the raw error Manta recorded.

Parameters

raw

string

Returns

string


channelErrorSubcode()

channelErrorSubcode(raw): number | undefined

Parameters

raw

string

Returns

number | undefined


deleting()

deleting(input): GraphOp

Parameters

input

ActionDeletion

Returns

GraphOp


graphNode()

graphNode(op): ActionGraphNode

@id and @type come from the op’s subject and type, never from whatever its properties hold.

Parameters

op

GraphOp

Returns

ActionGraphNode


graphOutcome()

graphOutcome(results): ActionOutcome

The whole change as one outcome: a failure first, then a run still going, else done.

Parameters

results

readonly OpResult[]

Returns

ActionOutcome


mentions()

mentions(op): string[]

Every IRI an op’s node points at, its own subject included.

Parameters

op

GraphOp

Returns

string[]


opResult()

opResult(op, planGraphIri, run, __namedParameters, formatError?): OpResult

What one op did, read off its entity’s own activity in the plan’s run.

Parameters

op

GraphOp

planGraphIri

string

run

ActionOutcome

__namedParameters

OutcomeRead

formatError?

(raw) => string

Returns

OpResult


planOutcomes()

planOutcomes(planGraphIri, readOptions): Promise<EntityOutcome[]>

Every entity’s own run inside the plan: the subject it used, what it created, or why it failed or was skipped.

Parameters

planGraphIri

string

readOptions

Options

Returns

Promise<EntityOutcome[]>


resultFor()

resultFor(ops, run, subjectIri): OpResult | undefined

What happened to the op on subjectIri, for a caller that keyed its ops by subject.

Parameters

ops

readonly GraphOp[]

run

GraphRun

subjectIri

string

Returns

OpResult | undefined


runActionGraph()

runActionGraph(ops, options): Promise<GraphRun>

Sends ops as one plan, or as few as Manta’s per-plan cap allows, and reads back what each did. Past the cap, an entity that points at one an earlier plan did not make is skipped, as Manta skips it inside one plan.

Parameters

ops

readonly GraphOp[]

options

GraphRunOptions

Returns

Promise<GraphRun>


startActionGraph()

startActionGraph(graphql, nodes, options?): Promise<GraphStart>

Parameters

graphql

ActionGraphql

nodes

readonly ActionGraphNode[]

options?
signal?

AbortSignal

Returns

Promise<GraphStart>


updating()

updating(input): GraphOp

Parameters

input

GQLExecuteActionUpdateInput

Returns

GraphOp


withCreatedReferences()

withCreatedReferences(value, created): unknown

A node may point at one an earlier plan of the same change created; it goes out under the created IRI.

Parameters

value

unknown

created

ReadonlyMap<string, string>

Returns

unknown