Adds custom key-value metadata to the workflow's backend HASH record
in a single call. This is a convenience wrapper around
search().set(fields) that handles session creation automatically.
Enrichment runs exactly once per workflow execution — the underlying
search session ensures idempotency on replay.
Use enrich for quick one-shot writes. For repeated reads/writes
within the same workflow, prefer acquiring a search() session
handle directly.
Example
import { Durable } from'@hotmeshio/hotmesh';
exportasyncfunctiononboardingWorkflow(userId: string): Promise<void> { // Tag the workflow record with queryable metadata awaitDurable.workflow.enrich({ userId, stage:'verification', startedAt:newDate().toISOString(), });
Adds custom key-value metadata to the workflow's backend HASH record in a single call. This is a convenience wrapper around
search().set(fields)that handles session creation automatically.Enrichment runs exactly once per workflow execution — the underlying search session ensures idempotency on replay.
Use
enrichfor quick one-shot writes. For repeated reads/writes within the same workflow, prefer acquiring asearch()session handle directly.Example