Core 1.0.0-rc.1
Journey Definition Resolver
Source file: packages/core/src/journey-machine/resolve-journey-definition.ts
This file turns authored transition shapes into the one runtime shape the machine actually executes: an ordered array of transitions.
How It Works
- If
journey.transitionsis missing, the resolver returns the journey with an empty transition list. - If transitions were authored as an array, the file treats that as a linear journey declaration. It validates
that every entry is a known step id, checks that the first item matches
journey.initial, and expands the array into implicitgoToNextStepedges. - If transitions were authored as an object graph, the file validates each
from -> event -> edges[]layer and flattens it into ordered transition objects. - The
globalbranch is resolved first and rewritten tofrom: "*". Every other branch keeps its step id. - The original journey object is returned with
transitionsreplaced by that normalized array.
The important guarantee is ordering. send.ts scans transitions in order, so the resolver preserves author intent
while still giving the runtime one deterministic structure to evaluate.
Recommended Reading
- Read Send Pipeline to see how the ordered transition list is consumed.
- Read Transitions Syntax for the public authoring shapes this file accepts.
- Read Quickstart if you want to compare the normalized behavior with authored examples.