File tree Expand file tree Collapse file tree 2 files changed +102
-82
lines changed
core-flows/src/common/steps Expand file tree Collapse file tree 2 files changed +102
-82
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ type Input = {
3030 * The data payload that the subscriber receives in the `data` property
3131 * of its first parameter. Use this property to pass data relevant for the
3232 * subscriber, such as the ID of a created record.
33+ *
34+ * If you pass an array of objects, the event will be emitted once per each object in the array.
3335 */
3436 data :
3537 | ( ( context : StepExecutionContext ) => Promise < Record < any , any > > )
@@ -46,12 +48,30 @@ export const emitEventStepId = "emit-event-step"
4648 * If the workflow fails, it won't emit the event at all.
4749 *
4850 * @example
51+ * To emit a single event with a data payload:
52+ *
53+ * ```ts
4954 * emitEventStep({
5055 * eventName: "custom.created",
5156 * data: {
5257 * id: "123"
5358 * }
5459 * })
60+ * ```
61+ *
62+ * To emit an event multiple times with different data payloads, pass an array of objects to the `data` property:
63+ *
64+ * ```ts
65+ * emitEventStep({
66+ * eventName: "custom.created",
67+ * data: [
68+ * // emit will be emitted three times, once per each object in the array
69+ * { id: "123" },
70+ * { id: "456" },
71+ * { id: "789" }
72+ * ]
73+ * })
74+ * ```
5575 */
5676export const emitEventStep = createStep (
5777 emitEventStepId ,
You can’t perform that action at this time.
0 commit comments