parseWorkflowName

Parse a machine-readable workflow name into display-friendly components.

Workflow names are stored as machine-readable identifiers like workflow//./src/workflows/order//processOrder. This function parses them into components suitable for display in a UI — for example when listing runs from the World SDK, where run.workflowName holds the machine-readable form.

import { parseWorkflowName } from "workflow/observability"; 

const parsed = parseWorkflowName("workflow//./src/workflows/order//processOrder"); 
// parsed?.shortName → "processOrder"
// parsed?.moduleSpecifier → "./src/workflows/order"
// parsed?.functionName → "processOrder"

API Signature

Parameters

ParameterTypeDescription
namestringThe machine-readable workflow name (e.g. from run.workflowName)

Returns

{ shortName: string; moduleSpecifier: string; functionName: string } | null

PropertyDescription
shortNameThe display name. For default exports, falls back to the module's short name (e.g. "order" for ./src/workflows/order).
moduleSpecifierThe module the workflow is defined in — a relative path (./src/workflows/order) or a package specifier (@myorg/flows@1.0.0).
functionNameThe full exported function name.

Returns null when the input is not a valid workflow name.

Example: List Runs with Display Names

import { getWorld } from "workflow/runtime";
import { parseWorkflowName } from "workflow/observability"; 

const world = await getWorld();
const runs = await world.runs.list({ resolveData: "none" });

for (const run of runs.data) {
  const parsed = parseWorkflowName(run.workflowName); 
  console.log(`${parsed?.shortName ?? run.workflowName}: ${run.status}`);
}

On this page

Edit this page on GitHub