feat(sdk): expose live event stream (#34098)

This commit is contained in:
Kit Langton 2026-06-26 21:16:33 +02:00 committed by GitHub
commit 42e6b7db32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 395 additions and 56 deletions

View file

@ -48,6 +48,24 @@ describe("HttpApiCodegen.generate", () => {
)
})
test("allows Promise outputs to use an authoritative imported wire type", () => {
const contract = compileContract(
api(HttpApiEndpoint.get("events", "/event", { success: HttpApiSchema.StreamSse({ data: Schema.Unknown }) })),
)
const output = emitPromise(contract, {
outputTypes: {
"session.events": {
name: "EventWire",
import: 'import type { EventWire } from "./event-wire"',
},
},
})
const types = output.files.find((file) => file.path === "types.ts")?.content
expect(types).toContain('import type { EventWire } from "./event-wire"')
expect(types).toContain("export type SessionEventsOutput = EventWire")
})
test("emits an Effect client against an imported authoritative API", () => {
const output = emitEffectImported(
compileContract(