Interface StepHookSource

A hook of a step policy, with the step and attempt that triggered it.

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

function author(source: ContributionSource): string {
switch (source.kind) {
case "step":
return `${source.step}, attempt ${source.attempt.toString()}`;
case "step hook":
return `${source.policy}, ${source.hook}, for ${source.step}`;
case "workflow hook":
return `${source.policy}, ${source.hook}`;
}
}

export function committed(event: Event): string | undefined {
return event.kind === "contribution_committed"
? `${event.key} from ${author(event.source)}`
: undefined;
}
interface StepHookSource {
    attempt: Attempt;
    hook:
        | "on step success"
        | "on step failure"
        | "on step retry"
        | "on step abnormal termination";
    kind: "step hook";
    policy: PolicyName;
    step: StepName;
}

Hierarchy (View Summary)

Index

attempt: Attempt

The attempt.

hook:
    | "on step success"
    | "on step failure"
    | "on step retry"
    | "on step abnormal termination"

The hook.

kind: "step hook"

Who it is.

policy: PolicyName

The policy's name.

step: StepName

The step's name.