Variable EventKindConst

EventKind: ClosedSet<
    {
        AttemptStarted: "attempt_started";
        ContributionCommitted: "contribution_committed";
        ContributionsDiscarded: "contributions_discarded";
        DataOverwritten: "data_overwritten";
        GlobalMetadataSet: "global_metadata_set";
        HookCalled: "hook_called";
        InputAdapterFailed: "input_adapter_failed";
        InputAdapterSupplied: "input_adapter_supplied";
        JourneyAborted: "journey_aborted";
        JourneyError: "journey_error";
        JourneyFailed: "journey_failed";
        JourneyInfo: "journey_info";
        JourneyStarted: "journey_started";
        JourneySucceeded: "journey_succeeded";
        JourneyWarning: "journey_warning";
        OptionalInputAbsent: "optional_input_absent";
        ServiceProvided: "service_provided";
        ServiceProviderFailed: "service_provider_failed";
        StepAbnormalTermination: "step_abnormal_termination";
        StepError: "step_error";
        StepFailed: "step_failed";
        StepGivenUp: "step_given_up";
        StepInfo: "step_info";
        StepRescued: "step_rescued";
        StepRescuing: "step_rescuing";
        StepRetrying: "step_retrying";
        StepSkipped: "step_skipped";
        StepSucceeded: "step_succeeded";
        StepWarning: "step_warning";
    },
> = ...

The kind of an event, one per event of the specification's catalogue and per event a step or hook emits. Each value is written as the specification names the event, in snake_case, such as "step_failed", and is the kind of every event of that kind.

import assert from "node:assert/strict";
import { type EmittedKind, type Event, EventKind } from "itinera/event";

export function isLast(event: Event): boolean {
return (
event.kind === EventKind.JourneySucceeded ||
event.kind === EventKind.JourneyFailed ||
event.kind === EventKind.JourneyAborted
);
}

function fromAStep(kind: EmittedKind): boolean {
return kind.startsWith("step_");
}

assert.equal(EventKind.JourneyAborted, "journey_aborted");
assert.ok(EventKind.has("step_failed"));
assert.ok(!EventKind.has("step_started"));
assert.equal(EventKind.values.length, 29);
assert.ok(fromAStep(EventKind.StepWarning));