Skip to main content

Function: createStageIds()

createStageIds<W>(workflow): StageIdConstants<W>

Defined in: packages/workflow-engine/src/core/stage-ids.ts:92

Create a type-safe stage ID constants object from a workflow

Extracts all stage IDs from a workflow and creates a frozen object with SCREAMING_SNAKE_CASE keys for autocomplete and type safety.

Type Parameters​

W​

W extends Workflow<any, any, any>

Parameters​

workflow​

W

Returns​

StageIdConstants<W>

Example​

import { certificateWorkflow } from "./certificate-workflow";

export const STAGE_IDS = createStageIds(certificateWorkflow);
// = {
// DATA_EXTRACTION: "data-extraction",
// GUIDELINES: "guidelines",
// LEGAL_GUIDANCE: "legal-guidance",
// GENERATOR: "generator",
// } as const

// Use in code with autocomplete:
const data = ctx.require(STAGE_IDS.DATA_EXTRACTION);