Skip to content

Commit add5acf

Browse files
authored
feat(server)!: improve hibernation naming conventions (#686)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated naming conventions for internal plugin context and symbols to improve clarity. No changes to functionality or user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 274e703 commit add5acf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

packages/server/src/hibernation/plugin.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Context } from '../context'
33
import type { Router } from '../router'
44
import { experimental_HibernationEventIterator } from '@orpc/standard-server'
55

6-
export interface experimental_HibernationContext {
6+
export interface experimental_HibernationPluginContext {
77
iterator?: experimental_HibernationEventIterator<any>
88
}
99

@@ -13,7 +13,7 @@ export interface experimental_HibernationContext {
1313
* @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
1414
*/
1515
export class experimental_HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
16-
readonly HIBERNATION_CONTEXT_SYMBOL = Symbol('HIBERNATION_CONTEXT')
16+
readonly CONTEXT_SYMBOL = Symbol('ORPC_HIBERNATION_CONTEXT')
1717

1818
order = 2_000_000 // make sure execute after the batch plugin
1919

@@ -22,12 +22,12 @@ export class experimental_HibernationPlugin<T extends Context> implements Standa
2222
options.clientInterceptors ??= []
2323

2424
options.interceptors.unshift(async (options) => {
25-
const hibernationContext: experimental_HibernationContext = {}
25+
const hibernationContext: experimental_HibernationPluginContext = {}
2626

2727
const result = await options.next({
2828
...options,
2929
context: {
30-
[this.HIBERNATION_CONTEXT_SYMBOL]: hibernationContext,
30+
[this.CONTEXT_SYMBOL]: hibernationContext,
3131
...options.context,
3232
},
3333
})
@@ -46,7 +46,7 @@ export class experimental_HibernationPlugin<T extends Context> implements Standa
4646
})
4747

4848
options.clientInterceptors.unshift(async (options) => {
49-
const hibernationContext = options.context[this.HIBERNATION_CONTEXT_SYMBOL] as experimental_HibernationContext | undefined
49+
const hibernationContext = options.context[this.CONTEXT_SYMBOL] as experimental_HibernationPluginContext | undefined
5050

5151
if (!hibernationContext) {
5252
throw new TypeError('[HibernationPlugin] Hibernation context has been corrupted or modified by another plugin or interceptor')

0 commit comments

Comments
 (0)