inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
440 stars 43 forks source link

Add ability to declare and send events without payloads #313

Closed jpwilliams closed 1 year ago

jpwilliams commented 1 year ago

Summary

Add the ability to declare and send events without payloads. It's possible for some events to rightfully have no payload, in which case just the name can suffice.

// Previously would have failed
inngest.send({ name: "my.event" });

// Typing a no-data event means providing an empty object
new EventSchemas()
  .fromRecord<{ "my.event": {} }>()
  .fromUnion<{ name: "my.event" }>()
  .fromZod({ "my.event": {} })
  .fromZod([z.object({ name: z.literal("my.event") })]);

Checklist

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 2334a8aa8f6ebccb4e9eac490359a4dba3a36334

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | inngest | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR