It would be nice to support the following io task in a job run:
const event = await io.waitForNextEvent("✋", { name: "opt-in", filter: { userId: [payload.userId] })
We could also add a continueAfter parameter that would return undefined if the event isn't received in time:
const event = await io.waitForNextEvent("✋", {
name: "opt-in",
filter: { userId: [payload.userId] },
continueAfter: 60 * 10,
});
Type Safety
Currently the event payload type in eventTrigger is inferred via an optionally passed in schema:
eventTrigger({
name: "foo.event",
schema: z.object({
userId: z.string(),
delay: z.number(),
}),
})
We could add support for a schema to waitForNextEvent as well:
const event = await io.waitForNextEvent("✋", {
name: "opt-in",
filter: { userId: [payload.userId] },
continueAfter: 60 * 10,
schema: z.object({ userId: z.string() })
});
Once we add support for an Event Catalog (#251) the event payload type would be automatically inferred based on it's name
TRI-1275
It would be nice to support the following io task in a job run:
We could also add a
continueAfterparameter that would returnundefinedif the event isn't received in time:Type Safety
Currently the event payload type in
eventTriggeris inferred via an optionally passed in schema:We could add support for a schema to
waitForNextEventas well:Once we add support for an Event Catalog (#251) the event payload type would be automatically inferred based on it's name
TRI-1275