---
changelog:
  category: Release
  version: 1.12.0
date: '2025-11-30T03:56:45Z'
seo:
  description: >-
    You can configure default options for all query/mutation utilities using
    experimental_defaults. These options are spread merged with user-provided
    options…
title: v1.12.0
type: changelog
---
### Tanstack Query Default Options [docs](https://orpc.dev/docs/integrations/tanstack-query#default-options)

You can configure default options for all query/mutation utilities using experimental_defaults. These options are [spread merged](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) with user-provided options, allowing you to set defaults while still enabling customization on a per-call basis.

```ts
const orpc = createTanstackQueryUtils(client, {
  experimental_defaults: {
    planet: {
      find: {
        queryOptions: {
          staleTime: 60 * 1000, // 1 minute
          retry: 3,
        },
      },
      list: {
        infiniteOptions: {
          staleTime: 30 * 1000,
        },
      },
      create: {
        mutationOptions: {
          onSuccess: (output, input, _, ctx) => {
            ctx.client.invalidateQueries({ queryKey: orpc.planet.key() })
          },
        },
      },
    },
  },
})

// These will automatically use the default options
const query = useQuery(orpc.planet.find.queryOptions({ input: { id: 123 } }))
const mutation = useMutation(orpc.planet.create.mutationOptions())

// User-provided options override defaults
const customQuery = useQuery(orpc.planet.find.queryOptions({
  input: { id: 123 },
  staleTime: 0, // overrides the default
}))
```

### Cloudflare Durable Object Publisher Adapter [docs](https://orpc.dev/docs/helpers/publisher#cloudflare-durable-object)

Building real-time features on [Cloudflare Workers](https://workers.cloudflare.com/) has never been easier, thanks to our publisher helpers:
 
```ts
import { DurablePublisher, PublisherDurableObject } from '@orpc/experimental-publisher-durable-object'

export class PublisherDO extends PublisherDurableObject {
  constructor(ctx: DurableObjectState, env: Env) {
    super(ctx, env, {
      resume: {
        retentionSeconds: 60 * 2, // Retain events for 2 minutes to support resume
      },
    })
  }
}

export default {
  async fetch(request, env) {
    const publisher = new DurablePublisher<{
      'something-updated': {
        id: string
      }
    }>(env.PUBLISHER_DO, {
      prefix: 'publisher1', // avoid conflict with other keys
      customJsonSerializers: [] // optional custom serializers
    })
  },
}
```

> [!NOTE]
> Full example at [Cloudflare Worker Playground](https://github.com/middleapi/orpc/blob/main/playgrounds/cloudflare-worker/worker/routers/message-v2.ts)

### NestJS Integration Upgraded [docs](https://orpc.dev/docs/openapi/integrations/implement-contract-in-nest)

NestJS Integration now supports oRPC plugins, custom error responses, custom send-response behavior, and global context type-safe.

```ts
declare module '@orpc/nest' {
  /**
   * Extend oRPC global context to make it type-safe inside your handlers/middlewares
   */
  interface ORPCGlobalContext {
    request: Request
  }
}

@Module({
  imports: [
    ORPCModule.forRootAsync({ // or use .forRoot for static config
      useFactory: (request: Request) => ({
        interceptors: [
          onError((error) => {
            console.error(error)
          }),
        ],
        context: { request }, // oRPC context, accessible from middlewares, etc.
        eventIteratorKeepAliveInterval: 5000, // 5 seconds
        customJsonSerializers: [],
        plugins: [
          new SmartCoercionPlugin({
            schemaConverters: [
              new ZodToJsonSchemaConverter(),
            ],
          }),
        ], // almost oRPC plugins are compatible
      }),
      inject: [REQUEST],
    }),
  ],
  controllers: [AuthController, PlanetController, ReferenceController, OtherController],
  providers: [PlanetService, ReferenceService],
})
```

### &nbsp;&nbsp;&nbsp;🚀 Features

- **nest**: Custom send response, global context, plugins, custom error response &nbsp;-&nbsp; by @dinwwwh in https://github.com/middleapi/orpc/issues/1256 [<samp>(56695)</samp>](https://github.com/middleapi/orpc/commit/56695f32)
- **publisher**: Cloudflare durable object adapter &nbsp;-&nbsp; by @dinwwwh in https://github.com/middleapi/orpc/issues/1253 [<samp>(e565e)</samp>](https://github.com/middleapi/orpc/commit/e565e67e)
- **tanstack-query**: Default query/mutation options &nbsp;-&nbsp; by @dinwwwh in https://github.com/middleapi/orpc/issues/1260 [<samp>(1fe44)</samp>](https://github.com/middleapi/orpc/commit/1fe4418e)

### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes

- Clone util should clone symbol properties of object &nbsp;-&nbsp; by @Copilot in https://github.com/middleapi/orpc/issues/1258 [<samp>(b4897)</samp>](https://github.com/middleapi/orpc/commit/b4897a01)

> [!TIP]
> If you find oRPC valuable and would like to support its development, you can do so [here](https://github.com/sponsors/dinwwwh).

##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/middleapi/orpc/compare/v1.11.3...v1.12.0)
