Type Alias Event

Event:
    | JourneyStarted
    | AttemptStarted
    | InputAdapterSupplied
    | InputAdapterFailed
    | OptionalInputAbsent
    | ServiceProvided
    | ServiceProviderFailed
    | GlobalMetadataSet
    | StepSucceeded
    | StepFailed
    | StepSkipped
    | StepAbnormalTermination
    | HookCalled
    | ContributionCommitted
    | ContributionsDiscarded
    | DataOverwritten
    | JourneyAborted
    | StepRetrying
    | StepRescuing
    | StepRescued
    | StepGivenUp
    | JourneySucceeded
    | JourneyFailed
    | StepInfo
    | StepWarning
    | StepError
    | JourneyInfo
    | JourneyWarning
    | JourneyError

One event of a journey's event stream: a discriminated union on kind, one member per kind of event. Only itinera makes events.

Every event carries its kind, a sequence number, increasing from 1 within the journey, a timestamp, the journey ID and the workflow name; what else it carries depends on its kind. Engine events carry keys, never the values of the data bag. Events are frozen, data included, so a reporter cannot change what the next one reads. They carry no format of their own: each reporter writes them as it chooses.

import type { Event } from "itinera/event";

export function summary(event: Event): string {
if (event.kind === "step_failed") {
return `${event.step} failed: ${event.reason.code}`;
}
if (event.kind === "journey_aborted") {
return `aborted: ${event.abort.reason}`;
}
return `${event.kind} at ${event.timestamp}`;
}