Creates a ChannelWrite that specifies how to write values to channels. This is used to define how nodes send output to channels.
writeTo(channels: string[], writes: Record<string, unknown>): ChannelWrite| Name | Type | Description |
|---|---|---|
channels* | string[] | Array of channel names to write to |
writes | Record<string, unknown> | Optional map of channel names to values or transformations |
// Write to multiple channels
const write = Channel.writeTo(["output", "state"]);
// Write with specific values
const write = Channel.writeTo(["output"], {
state: "completed",
result: calculateResult()
});
// Write with a transformation function
const write = Channel.writeTo(["output"], {
result: (x) => processResult(x)
});