From 8a2c34b8a99161bf47c72df8eed3f5d3b6a19f5f Mon Sep 17 00:00:00 2001 From: David Khourshid Date: Sat, 16 Mar 2024 10:48:15 -0400 Subject: [PATCH] Add changeset --- .changeset/soft-readers-attend.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .changeset/soft-readers-attend.md diff --git a/.changeset/soft-readers-attend.md b/.changeset/soft-readers-attend.md new file mode 100644 index 0000000..30babd5 --- /dev/null +++ b/.changeset/soft-readers-attend.md @@ -0,0 +1,28 @@ +--- +'@statelyai/agent': patch +--- + +The `createSchemas(…)` function has been removed. The `defineEvents(…)` function should be used instead, as it is a simpler way of defining events and event schemas using Zod: + +```ts +import { defineEvents } from '@statelyai/agent'; +import { z } from 'zod'; +import { setup } from 'xstate'; + +const events = defineEvents({ + inc: z.object({ + by: z.number().describe('Increment amount'), + }), +}); + +const machine = setup({ + types: { + events: events.types, + }, + schema: { + events: events.schemas, + }, +}).createMachine({ + // ... +}); +```