chore: fix payloads of events in TSDocs + description of emitEventStep (#14132)

This commit is contained in:
Shahed Nasser
2025-11-26 18:00:21 +02:00
committed by GitHub
parent c3cebdfe80
commit e8990133e5
2 changed files with 102 additions and 82 deletions

View File

@@ -30,6 +30,8 @@ type Input = {
* The data payload that the subscriber receives in the `data` property
* of its first parameter. Use this property to pass data relevant for the
* subscriber, such as the ID of a created record.
*
* If you pass an array of objects, the event will be emitted once per each object in the array.
*/
data:
| ((context: StepExecutionContext) => Promise<Record<any, any>>)
@@ -46,12 +48,30 @@ export const emitEventStepId = "emit-event-step"
* If the workflow fails, it won't emit the event at all.
*
* @example
* To emit a single event with a data payload:
*
* ```ts
* emitEventStep({
* eventName: "custom.created",
* data: {
* id: "123"
* }
* })
* ```
*
* To emit an event multiple times with different data payloads, pass an array of objects to the `data` property:
*
* ```ts
* emitEventStep({
* eventName: "custom.created",
* data: [
* // emit will be emitted three times, once per each object in the array
* { id: "123" },
* { id: "456" },
* { id: "789" }
* ]
* })
* ```
*/
export const emitEventStep = createStep(
emitEventStepId,