github unnoq/orpc v0.40.0

latest releases: v1.8.7, v1.8.6, v1.8.5...
6 months ago

🚨 Breaking Changes 🚨

  • The order of arguments passed into option callbacks in RPCLink has changed.

🌟 Event Source / SSE Support 🌟

Streaming support is now built-in—no extra configuration needed!

const streaming = os
  .output(eventIterator(z.object({ message: z.string() })))
  .handler(async function* ({ input, lastEventId }) {
    try {
      while (true) {
        yield withEventMeta({ message: 'Hello, world!' },  { id: 'event-id', retry: 1000 })
        await new Promise(resolve => setTimeout(resolve, 1000))
      }
    } finally {
       // cleanup logic here
    }
  })
 
 const result = await client.streaming(
  { prompt: 'Hello' },
  { lastEventId: 'you also can pass initial last event id here' }
 )
 
// Process the incoming stream of events using async iteration
for await (const event of result) {
  console.log(event)
}

// To close the connection manually, call result.return()

   🚨 Breaking Changes

   🚀 Features

  • server: Enhance error handling for malformed requests  -  by @unnoq in #145 (9125e)

   🐞 Bug Fixes

  • server: Ensure .concat respect extra context from original  -  by @unnoq in #149 (6affc)
    View changes on GitHub

Don't miss a new orpc release

NewReleases is sending notifications on new releases.