This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
inngest@2.6.0
Minor Changes
#20221053ed Thanks @djfarrelly! - Add support for Fastify, either via a custom .route() or using a Fastify plugin
import Fastify from "fastify";
import inngestFastify, { serve } from "inngest/fastify";
import { functions, inngest } from "./inngest";
const fastify = Fastify({
logger: true,
});
// The lead maintainer of Fastify recommends using this as a plugin:
fastify.register(inngestFastify, {
client: inngest,
functions,
options: {},
});
// We do also export `serve()` if you want to use it directly, though.
fastify.route({
method: ["GET", "POST", "PUT"],
handler: serve(inngest, functions),
url: "/api/inngest",
});
fastify.listen({ port: 3000 }, function (err, address) {
if (err) {
fastify.log.error(err);
process.exit(1);
}
});
// Previously we supported this
new EventSchemas().fromZod({
"test.event": {
data: z.object({ a: z.string() }),
b: z.number() }),
},
});
// Now we ALSO support this
new EventSchemas().fromZod([
z.object({
name: z.literal("test.event"),
data: z.object({ a: z.string() }),
b: z.number() }),
}),
]);
This should help if you wish to declare your events piece-by-piece instead of in a single object.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
inngest@2.6.0
Minor Changes
#202
21053ed
Thanks @djfarrelly! - Add support for Fastify, either via a custom.route()
or using a Fastify plugin#298
4984aa8
Thanks [@z.object({](https://github.com/z.object({), [@z.object({](https://github.com/z.object({)! - Add the ability to provide Zod schemas usingz.object()
instead of requiring a record formatThis should help if you wish to declare your events piece-by-piece instead of in a single object.
You can use the exported
LiteralZodEventSchema
type to provide some autocomplete when writing your events, too.