hydrateResourceIO

Hydrates (deserializes) the data fields of a resource returned by the World SDK: a workflow run, step, hook, or event. Workflow data is serialized using the devalue format, so this is required before displaying step input/output in a user interface.

The function dispatches on the resource shape: steps get input/output hydrated, hooks get metadata, events get eventData, and runs get input/output.

import { getWorld } from "workflow/runtime";
import { hydrateResourceIO, observabilityRevivers } from "workflow/observability";
declare const runId: string; // @setup
declare const stepId: string; // @setup

const world = await getWorld();
const step = await world.steps.get(runId, stepId);
const hydrated = hydrateResourceIO(step, observabilityRevivers);
console.log(hydrated.input, hydrated.output);

API signature

Parameters

ParameterTypeDescription
resourceWorkflowRun | Step | Hook | EventThe resource with serialized data fields
reviversReviversReviver functions for deserialization. Use observabilityRevivers for standard use.

Returns

The same resource with its data fields hydrated into plain JavaScript values.

Encrypted data fields pass through as raw Uint8Array values rather than being decrypted. See Encrypted Data.

Examples

Display a run's steps with hydrated I/O

import { getWorld } from "workflow/runtime";
import { hydrateResourceIO, observabilityRevivers } from "workflow/observability";
declare const runId: string; // @setup

const world = await getWorld();
const steps = await world.steps.list({ runId, resolveData: "all" });

for (const step of steps.data) {
  const hydrated = hydrateResourceIO(step, observabilityRevivers);
  console.log(step.stepName, hydrated.input, hydrated.output);
}