effect-state-machine
ReferenceGenerated API

Graph API

Generated reference for the public Graph module.

effect-state-machine API


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

DefinitionMetadata

options?

Readonly<{ mapSource?: ... | ...; }>

Returns

Graph

See

SourceLocation.Mapper for mapping generated positions through source maps.

Since

0.1.0

filtering

focus

const focus: {(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

FocusDepth

Returns

(graph) => Graph

Call Signature

(graph, center, depth): Graph

Parameters
graph

Graph

center

string

depth

FocusDepth

Returns

Graph

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

readonly id: string

Defined in: packages/core/src/Graph.ts:13

title

readonly title: string

Defined in: packages/core/src/Graph.ts:14

description?

readonly optional description?: string

Defined in: packages/core/src/Graph.ts:15

kind

readonly kind: "state" | "child" | "invoke" | "regions" | "final"

Defined in: packages/core/src/Graph.ts:16

location?

readonly optional location?: Location

Defined in: packages/core/src/Graph.ts:17

invocation?

readonly optional invocation?: Readonly<{ name: string; kind?: ... | ... | ... | ...; lanes?: ... | ...; concurrency?: ... | ... | ...; description?: ... | ...; retry?: ... | ...; outcomes?: ... | ...; }>

Defined in: packages/core/src/Graph.ts:18

timer?

readonly optional timer?: Readonly<{ duration?: unknown; name?: ... | ...; description?: ... | ...; targets: readonly ...[]; }>

Defined in: packages/core/src/Graph.ts:43

regions?

readonly optional regions?: Readonly<{ slots: readonly ...[]; }>

Defined in: packages/core/src/Graph.ts:49

region?

readonly optional region?: Readonly<{ parent: string; slot: string; tag: string; }>

Defined in: packages/core/src/Graph.ts:52

child?

readonly optional child?: 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

readonly id: string

Defined in: packages/core/src/Graph.ts:98

source

readonly source: string

Defined in: packages/core/src/Graph.ts:99

target

readonly target: string

Defined in: packages/core/src/Graph.ts:100

location?

readonly optional location?: Location

Defined in: packages/core/src/Graph.ts:101

event?

readonly optional event?: Readonly<{ tag: string; description?: ... | ...; }>

Defined in: packages/core/src/Graph.ts:102

outcome?

readonly optional outcome?: Readonly<{ kind: ... | ... | ... | ...; name?: ... | ...; description?: ... | ...; }>

Defined in: packages/core/src/Graph.ts:106

description?

readonly optional description?: string

Defined in: packages/core/src/Graph.ts:111

branch?

readonly optional branch?: 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

readonly source: string

Defined in: packages/core/src/Graph.ts:132

event

readonly event: Readonly<{ tag: string; description?: string; }>

Defined in: packages/core/src/Graph.ts:133

description?

readonly optional description?: 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

readonly id: string

Defined in: packages/core/src/Graph.ts:147

description?

readonly optional description?: string

Defined in: packages/core/src/Graph.ts:148

nodes

readonly nodes: readonly Node[]

Defined in: packages/core/src/Graph.ts:149

edges

readonly edges: readonly Edge[]

Defined in: packages/core/src/Graph.ts:150

ignores

readonly ignores: readonly Ignore[]

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?

readonly optional activeNode?: string

Defined in: packages/core/src/Graph.ts:169

traversedEdges

readonly traversedEdges: readonly string[]

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

readonly source: string

Defined in: packages/core/src/Graph.ts:180

target

readonly target: string

Defined in: packages/core/src/Graph.ts:181

event?

readonly optional event?: string

Defined in: packages/core/src/Graph.ts:182

branchIndex?

readonly optional branchIndex?: 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> = Lane extends string ? `${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

const activity: {(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

Graph

activeNode

string | undefined

transitions

readonly TransitionActivity[]

Returns

ActivityOverlay

Since

0.1.0