refactor(sync): make session events schema-first (#24019)

This commit is contained in:
Kit Langton
2026-04-23 12:43:08 -04:00
committed by GitHub
parent 353532b1c1
commit c50d65b4d6
9 changed files with 141 additions and 81 deletions

View File

@@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach, afterEach, afterAll } from "bun:test"
import { tmpdir } from "../fixture/fixture"
import z from "zod"
import { Schema } from "effect"
import { Bus } from "../../src/bus"
import { Instance } from "../../src/project/instance"
import { SyncEvent } from "../../src/sync"
@@ -43,13 +43,13 @@ describe("SyncEvent", () => {
type: "item.created",
version: 1,
aggregate: "id",
schema: z.object({ id: z.string(), name: z.string() }),
schema: Schema.Struct({ id: Schema.String, name: Schema.String }),
})
const Sent = SyncEvent.define({
type: "item.sent",
version: 1,
aggregate: "item_id",
schema: z.object({ item_id: z.string(), to: z.string() }),
schema: Schema.Struct({ item_id: Schema.String, to: Schema.String }),
})
SyncEvent.init({