Skip to content
1 min read · 90 words

Type Alias: TransitionResult

ts
type TransitionResult =
  | {
      ok: true;
      revision: number;
    }
  | {
      actual: {
        digest: string;
        state: PlanState;
      };
      ok: false;
      reason: "state_mismatch" | "digest_mismatch";
    }
  | {
      from: PlanState;
      ok: false;
      reason: "illegal_transition";
      to: PlanState;
    };

Defined in: src/batteries/orchestration/store.ts:216

The outcome of a transition call. On success it carries the new revision; on failure it names whether the plan was not in the expected state, its digest had moved, or the request was not a legal pair — carrying the actual state/digest so a caller that lost can read what happened.

Union Members

Type Literal

ts
{
  ok: true;
  revision: number;
}

Type Literal

ts
{
  actual: {
    digest: string;
    state: PlanState;
  }
  ok: false;
  reason: "state_mismatch" | "digest_mismatch";
}

Type Literal

ts
{
  from: PlanState;
  ok: false;
  reason: "illegal_transition";
  to: PlanState;
}

For a BYO store handed a request the type system did not police (e.g. over a wire).