Interface EmittedByHook<K>

An event a hook or a service provider emits about its own work.

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}`;
}
interface EmittedByHook<K extends EmittedKind> {
    data?: PlainValue;
    journeyId: JourneyId;
    kind: K;
    message: string;
    sequence: number;
    source: EmitterSource;
    timestamp: Timestamp;
    workflow: WorkflowName;
}

Type Parameters

Hierarchy (View Summary)

Index

data?: PlainValue

The author's data, captured as a value when it was emitted.

journeyId: JourneyId

The journey's ID.

kind: K

The event's kind, which tells what else it carries.

message: string

The author's message.

sequence: number

The event's position in its journey's event stream, from 1.

The hook or service provider that emitted it.

timestamp: Timestamp

When the event was emitted.

workflow: WorkflowName

The workflow's name.