@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?
optionalformatError?: (raw) =>string
Parameters
raw
string
Returns
string
pendingMessage
pendingMessage:
string
planGraphIri
planGraphIri:
string
pollIntervalMs
pollIntervalMs:
number
signal?
optionalsignal?:AbortSignal
timeoutMs
timeoutMs:
number
workflowId?
optionalworkflowId?:string
EntityOutcome
EntityOutcome =
object
Properties
endedAt?
optionalendedAt?:string
errorMessage?
optionalerrorMessage?:string
generated
generated:
object[]
iri
iri:
string
types
types:
string[]
skippedReason?
optionalskippedReason?:string
startedAt?
optionalstartedAt?:string
used
used:
string
ExecuteActionGraphVariables
ExecuteActionGraphVariables =
object
Properties
input
input:
ActionGraphInput
FollowPendingAction
FollowPendingAction = (
pending) =>Promise<Exclude<ActionOutcome,PendingAction>>
Parameters
pending
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?
optionalfollow?:FollowPendingAction
Takes over a run still going when timeoutMs ends.
formatError?
optionalformatError?: (raw) =>string
Parameters
raw
string
Returns
string
graphql
graphql:
ActionGraphql
onError?
optionalonError?: (cause) =>void
Hears why a finished plan’s outcomes could not be read; its ops then stay pending.
Parameters
cause
unknown
Returns
void
pendingMessage?
optionalpendingMessage?:string
pollIntervalMs?
optionalpollIntervalMs?:number
readOptions
readOptions:
Options
readOutcomes?
optionalreadOutcomes?: (planGraphIri) =>Promise<EntityOutcome[]>
Reads a finished plan’s per-entity outcomes; planOutcomes over readOptions unless given.
Parameters
planGraphIri
string
Returns
Promise<EntityOutcome[]>
signal?
optionalsignal?:AbortSignal
timeoutMs?
optionaltimeoutMs?: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
constactionShapeKey:"m:actionShape"="m:actionShape"
Manta resolves the m: prefix against the realm it runs as, so the key holds in every realm.
maxGraphNodes
constmaxGraphNodes:101=101
Manta takes at most this many entities in one plan.
nothingToSendMessage
constnothingToSendMessage:"Nothing in this change is something Manta can send."="Nothing in this change is something Manta can send."
PlanOutcomeSchema
constPlanOutcomeSchema:object
Type Declaration
@type
readonly@type:"prov:Activity"
endedAt
readonlyendedAt:object=ProvActivitySchema.endedAtTime
endedAt.@id
readonly@id:"prov:endedAtTime"
endedAt.@optional
readonly@optional:true
endedAt.@type
readonly@type:"xsd:dateTime"
errorMessage
readonlyerrorMessage:object=ProvActivitySchema.errorMessage
errorMessage.@id
readonly@id:"m:errorMessage"
errorMessage.@optional
readonly@optional:true
generated
readonlygenerated: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
readonlytypes: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
readonlyrunPlan:object
runPlan.@id
readonly@id:"m:runPlan"
runPlan.@type
readonly@type:"ldkit:IRI"=ldkit.IRI
skippedReason
readonlyskippedReason:object=ProvActivitySchema.skippedReason
skippedReason.@id
readonly@id:"m:skippedReason"
skippedReason.@optional
readonly@optional:true
startedAt
readonlystartedAt:object
startedAt.@id
readonly@id:"prov:startedAtTime"
startedAt.@optional
readonly@optional:true=true
startedAt.@type
readonly@type:"xsd:dateTime"
used
readonlyused: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
constrejectedWithoutReason:"Manta rejected the action without saying why."="Manta rejected the action without saying why."
skippedMessage
constskippedMessage:"Not sent, because a change it depends on was not made."="Not sent, because a change it depends on was not made."
twiceMessage
consttwiceMessage:"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
constunconfirmedMessage:"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
constunreachableMessage:"Manta could not be reached."="Manta could not be reached."
Functions
actionGraphInput()
actionGraphInput(
nodes):ActionGraphInput
Parameters
nodes
readonly ActionGraphNode[]
Returns
adding()
adding(
input):GraphOp
Parameters
input
Returns
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
args
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
Returns
graphNode()
graphNode(
op):ActionGraphNode
@id and @type come from the op’s subject and type, never from whatever its properties hold.
Parameters
op
Returns
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
mentions()
mentions(
op):string[]
Every IRI an op’s node points at, its own subject included.
Parameters
op
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
planGraphIri
string
run
__namedParameters
formatError?
(raw) => string
Returns
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
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
Returns
Promise<GraphRun>
startActionGraph()
startActionGraph(
graphql,nodes,options?):Promise<GraphStart>
Parameters
graphql
nodes
readonly ActionGraphNode[]
options?
signal?
AbortSignal
Returns
Promise<GraphStart>
updating()
updating(
input):GraphOp
Parameters
input
Returns
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