Replies: 3 comments
-
Love how you snuck this in there. |
Beta Was this translation helpful? Give feedback.
0 replies
-
We should add a color option to the catalog |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, you can only define an event schema when using an
eventTrigger
on a job:And then when sending an event, that type/schema information is lost and the payload can very easily be wrongly typed:
We should introduce a new concept called an "EventCatalog" that centralizes event schema definitions, and makes both eventTrigger and sendEvent typesafe.
Defining an Event Catalog
The above defines two events, each with a payload schema type using Zod.
Sending events
Now events are send through the event catalog, and the type of the payload field is automatically inferred from the event name. Now, both the event name and the payload will produce type errors if they don't exist in the catalog.
Event triggers will work in a similar way, and will go through the event catalog as well:
Beta Was this translation helpful? Give feedback.
All reactions