close

parseStepName

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

Step names are stored as machine-readable identifiers like step//./src/workflows/order//processPayment. This function parses them into components suitable for display in a UI.

import { parseStepName } from "workflow/observability"; 

const parsed = parseStepName("step//./src/workflows/order//processPayment"); 
// parsed?.shortName → "processPayment"
// parsed?.moduleSpecifier → "./src/workflows/order"
// parsed?.functionName → "processPayment"

API Signature

Parameters

ParameterTypeDescription
namestringThe machine-readable step name (e.g. from step.stepName)

Returns

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

PropertyDescription
shortNameThe display name — the last segment of the function name. For nested steps like processOrder/chargeCard, this is "chargeCard".
moduleSpecifierThe module the step is defined in — a relative path (./src/workflows/order) or a package specifier (@myorg/tasks@2.0.0).
functionNameThe full function name including nesting (e.g. processOrder/chargeCard).

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

On this page

GitHubEdit this page on GitHub