Graph API
Generated reference for the public Graph module.
effect-state-machine API / Graph
Graph
configuration
FocusDepth
FocusDepth =
1|2|"full"
Defined in: packages/core/src/Graph.ts:160
Number of outgoing transition levels retained by focus.
Since
0.1.0
converting
fromDefinition()
fromDefinition(
definition,options?):Graph
Defined in: packages/core/src/Graph.ts:350
Projects a machine definition into graphable nodes, edges, ignores, and child graphs.
Details
Schema titles and descriptions become presentation metadata, and authored source references are resolved best-effort. The projection is synchronous and never runs the initializer, guards, reducers, Effects, or child machines.
Parameters
definition
options?
Readonly<{ mapSource?: ... | ...; }>
Returns
See
SourceLocation.Mapper for mapping generated positions through source maps.
Since
0.1.0
filtering
focus
constfocus: {(center,depth): (graph) =>Graph; (graph,center,depth):Graph; }
Defined in: packages/core/src/Graph.ts:197
Derives an outgoing, depth-bounded view without changing the source graph.
Details
Node and edge order remain stable. "full" returns the original graph by identity, while an
unknown center returns an empty projection with the original graph metadata.
Call Signature
(
center,depth): (graph) =>Graph
Parameters
center
string
depth
Returns
(graph) => Graph
Call Signature
(
graph,center,depth):Graph
Parameters
graph
center
string
depth
Returns
Since
0.1.0
models
Node
Defined in: packages/core/src/Graph.ts:12
Renderer-independent description of one machine node.
Since
0.1.0
Properties
id
readonlyid:string
Defined in: packages/core/src/Graph.ts:13
title
readonlytitle:string
Defined in: packages/core/src/Graph.ts:14
description?
readonlyoptionaldescription?:string
Defined in: packages/core/src/Graph.ts:15
kind
readonlykind:"state"|"child"|"invoke"|"regions"|"final"
Defined in: packages/core/src/Graph.ts:16
location?
readonlyoptionallocation?:Location
Defined in: packages/core/src/Graph.ts:17
invocation?
readonlyoptionalinvocation?:Readonly<{name:string;kind?: ... | ... | ... | ...;lanes?: ... | ...;concurrency?: ... | ... | ...;description?: ... | ...;retry?: ... | ...;outcomes?: ... | ...; }>
Defined in: packages/core/src/Graph.ts:18
timer?
readonlyoptionaltimer?:Readonly<{duration?:unknown;name?: ... | ...;description?: ... | ...;targets: readonly ...[]; }>
Defined in: packages/core/src/Graph.ts:43
regions?
readonlyoptionalregions?:Readonly<{slots: readonly ...[]; }>
Defined in: packages/core/src/Graph.ts:49
region?
readonlyoptionalregion?:Readonly<{parent:string;slot:string;tag:string; }>
Defined in: packages/core/src/Graph.ts:52
child?
readonlyoptionalchild?:Readonly<{name:string;description?: ... | ...;definition:Graph;forwards: readonly ...[]; }>
Defined in: packages/core/src/Graph.ts:57
Edge
Defined in: packages/core/src/Graph.ts:97
Directed transition between two graph nodes.
Since
0.1.0
Properties
id
readonlyid:string
Defined in: packages/core/src/Graph.ts:98
source
readonlysource:string
Defined in: packages/core/src/Graph.ts:99
target
readonlytarget:string
Defined in: packages/core/src/Graph.ts:100
location?
readonlyoptionallocation?:Location
Defined in: packages/core/src/Graph.ts:101
event?
readonlyoptionalevent?:Readonly<{tag:string;description?: ... | ...; }>
Defined in: packages/core/src/Graph.ts:102
outcome?
readonlyoptionaloutcome?:Readonly<{kind: ... | ... | ... | ...;name?: ... | ...;description?: ... | ...; }>
Defined in: packages/core/src/Graph.ts:106
description?
readonlyoptionaldescription?:string
Defined in: packages/core/src/Graph.ts:111
branch?
readonlyoptionalbranch?:Readonly<{kind:"guard";index:number;name:string;description?: ... | ...; }> |Readonly<{kind:"otherwise";index:number; }>
Defined in: packages/core/src/Graph.ts:112
Ignore
Defined in: packages/core/src/Graph.ts:131
Event that a node explicitly accepts without producing a transition edge.
Since
0.1.0
Properties
source
readonlysource:string
Defined in: packages/core/src/Graph.ts:132
event
readonlyevent:Readonly<{tag:string;description?:string; }>
Defined in: packages/core/src/Graph.ts:133
description?
readonlyoptionaldescription?:string
Defined in: packages/core/src/Graph.ts:137
Graph
Defined in: packages/core/src/Graph.ts:146
Read-only, renderer-independent projection of a machine definition.
Since
0.1.0
Properties
id
readonlyid:string
Defined in: packages/core/src/Graph.ts:147
description?
readonlyoptionaldescription?:string
Defined in: packages/core/src/Graph.ts:148
nodes
readonlynodes: readonlyNode[]
Defined in: packages/core/src/Graph.ts:149
edges
readonlyedges: readonlyEdge[]
Defined in: packages/core/src/Graph.ts:150
ignores
readonlyignores: readonlyIgnore[]
Defined in: packages/core/src/Graph.ts:151
ActivityOverlay
Defined in: packages/core/src/Graph.ts:168
Renderer-neutral activity markers for an active node and traversed edges.
Since
0.1.0
Properties
activeNode?
readonlyoptionalactiveNode?:string
Defined in: packages/core/src/Graph.ts:169
traversedEdges
readonlytraversedEdges: readonlystring[]
Defined in: packages/core/src/Graph.ts:170
TransitionActivity
Defined in: packages/core/src/Graph.ts:179
Runtime transition identity used to match an authored graph edge.
Since
0.1.0
Properties
source
readonlysource:string
Defined in: packages/core/src/Graph.ts:180
target
readonlytarget:string
Defined in: packages/core/src/Graph.ts:181
event?
readonlyoptionalevent?:string
Defined in: packages/core/src/Graph.ts:182
branchIndex?
readonlyoptionalbranchIndex?:number
Defined in: packages/core/src/Graph.ts:183
Other
RegionStatePath
RegionStatePath<
Parent,Slot,Tag> =`${Parent}/${Slot}/${Tag}`
Defined in: packages/core/src/Graph.ts:78
Structural path of a state nested below a top-level region owner.
Type Parameters
Parent
Parent extends string = string
Slot
Slot extends string = string
Tag
Tag extends string = string
WorkPath
WorkPath<
Owner,Name,Lane> =Laneextendsstring?`${Owner}/work/${Name}/${Lane}`:`${Owner}/work/${Name}`
Defined in: packages/core/src/Graph.ts:85
Structural identity of declared work, optionally narrowed to one named lane.
Type Parameters
Owner
Owner extends string = string
Name
Name extends string = string
Lane
Lane extends string | undefined = undefined
transforming
activity
constactivity: {(activeNode,transitions): (graph) =>ActivityOverlay; (graph,activeNode,transitions):ActivityOverlay; }
Defined in: packages/core/src/Graph.ts:239
Matches runtime transition activity to graph edge identifiers without changing topology.
Details
Event tags and branch indices narrow a match only when supplied. An unknown active node is omitted from the returned overlay.
Call Signature
(
activeNode,transitions): (graph) =>ActivityOverlay
Parameters
activeNode
string | undefined
transitions
readonly TransitionActivity[]
Returns
(graph) => ActivityOverlay
Call Signature
(
graph,activeNode,transitions):ActivityOverlay
Parameters
graph
activeNode
string | undefined
transitions
readonly TransitionActivity[]
Returns
Since
0.1.0