github unnoq/orpc v1.0.0-beta.4

latest releases: v1.8.8, v1.8.7, v1.8.6...
5 months ago

🚨 Breaking Changes 🚨

Event Iterator Keep Alive

We move configs for Event Iterator Keep Alive from .handle to handler options (define when creating handler)

Rename internal APIs

  • HandlerPlugin -> StandardHandlerPlugin
  • ClientOptions -> FriendlyClientOptions
  • ClientOptionsOut -> ClientOptions
  • ClientPlugin -> StandardLinkPlugin
  • StandardHandleOptions -> FriendlyStandardHandleOptions

🚀 Features 🚀

Body Limit Plugin

The Body Limit Plugin restricts the size of the request body.

const handler = new RPCHandler(router, {
  plugins: [
    new BodyLimitPlugin({
      maxBodySize: 1024 * 1024, // 1MB
    }),
  ],
})

No need manually check prefix

export async function fetch(request: Request): Promise<Response> {
-  const url = new URL(request.url)
-
-  if (url.pathname.startsWith('/rpc')) {
    const { response } = await handler.handle(request, {
      prefix: '/rpc',
      context: {} // Provide initial context if needed
    })

    if (response)
      return response
-  }

  return new Response('Not found', { status: 404 })
}

No significant changes

    View changes on GitHub

Don't miss a new orpc release

NewReleases is sending notifications on new releases.