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
commit f44423609b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 1099 additions and 92 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 {