01f757a239
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
499 B
TypeScript
15 lines
499 B
TypeScript
export type Visibility = "draft" | "internal" | "public";
|
|
|
|
/** The legal one-step visibility moves from `v`, per the backend state machine
|
|
* (Draft<->Internal, Internal<->Public; no skipping). */
|
|
export function adjacentTransitions(v: Visibility): { forward?: Visibility; back?: Visibility } {
|
|
switch (v) {
|
|
case "draft":
|
|
return { forward: "internal" };
|
|
case "internal":
|
|
return { forward: "public", back: "draft" };
|
|
case "public":
|
|
return { back: "internal" };
|
|
}
|
|
}
|