chore: fix payloads of events in TSDocs + description of emitEventStep (#14132)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user