Skip to content

v0.35.0

Compare
Choose a tag to compare
@github-actions github-actions released this 05 Feb 14:01
· 179 commits to main since this release

🚨 Breaking Changes 🚨

  • Handlers have been rewritten to use native APIs in both fetch and Node.js' HTTP server.
  • The options onStart, onSuccess, onError, and onFinish have been removed—use the new interceptors (onStart, onError, etc.) instead.
  • OpenAPIServerHandler and OpenAPIServerlessHandler has been removed now OpenAPIHandler optimized for both.

🌟 Plugins 🌟

We're introducing two plugins: CORSPlugin and ResponseHeadersPlugin.

const openAPIHandler = new OpenAPIHandler(router, {
  schemaCoercers: [new ZodCoercer()],
  interceptors: [
    onError((error) => {
      console.error(error);
    }),
  ],
  plugins: [
    new CORSPlugin({ origin: 'http://localhost:3000' }),
    new ResponseHeadersPlugin(),
  ],
});

export interface ORPCContext extends ResponseHeadersPluginContext {
  // ResponseHeadersPluginContext is injected
  user?: z.infer<typeof UserSchema>;
  db?: any;
}

const pub = os
  .$context<ORPCContext>()
  .use(({ context, next }) => {
    context.resHeaders?.set('x-custom-header', 'custom-value');
    return next();
  });

   🚨 Breaking Changes

   🚀 Features

   🐞 Bug Fixes

    View changes on GitHub