feat(sdk): restore session runtime operations (#33777)

This commit is contained in:
Kit Langton
2026-06-25 20:23:01 +02:00
committed by GitHub
parent 44806777ca
commit f44423609b
20 changed files with 1100 additions and 93 deletions

View File

@@ -395,7 +395,9 @@ describe("HttpApiCodegen.generate", () => {
api(
HttpApiEndpoint.get("subscribe", "/event", {
query: { after: Schema.optional(Schema.Number) },
success: HttpApiSchema.StreamSse({ data: Schema.Struct({ type: Schema.String }) }),
success: HttpApiSchema.StreamSse({
data: Schema.Struct({ type: Schema.String, count: Schema.NumberFromString }),
}),
}),
),
),
@@ -416,7 +418,7 @@ describe("HttpApiCodegen.generate", () => {
return new Response(
new ReadableStream({
start(controller) {
controller.enqueue(encoder.encode('data: {"type":"ready"}\r'))
controller.enqueue(encoder.encode('data: {"type":"ready","count":"1"}\r'))
controller.enqueue(encoder.encode("\n\r\n"))
controller.close()
},
@@ -430,7 +432,7 @@ describe("HttpApiCodegen.generate", () => {
expect(requests).toBe(0)
const received = []
for await (const event of events) received.push(event)
expect(received).toEqual([{ type: "ready" }])
expect(received).toEqual([{ type: "ready", count: "1" }])
expect(requests).toBe(1)
expect(url).toBe("https://example.com/event?after=2")
} finally {