Skip to content

Commit e563486

Browse files
authored
refactor(server): rename CompositePlugin -> CompositeHandlerPlugin (#268)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Refined the internal plugin structure for improved consistency and maintainability. - **Tests** - Updated test cases to align with the internal enhancements, ensuring proper plugin initialization and reliable system behavior. These updates optimize the backend processes without changing any functionality visible to end-users. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 28aa60a commit e563486

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/server/src/adapters/standard/handler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { Router } from '../../router'
88
import type { StandardCodec, StandardMatcher } from './types'
99
import { ORPCError, toORPCError } from '@orpc/client'
1010
import { intercept, trim } from '@orpc/shared'
11-
import { CompositePlugin } from '../../plugins'
11+
import { CompositeHandlerPlugin } from '../../plugins'
1212
import { createProcedureClient } from '../../procedure-client'
1313

1414
export type StandardHandleOptions<T extends Context> =
@@ -46,15 +46,15 @@ export interface StandardHandlerOptions<TContext extends Context> {
4646
}
4747

4848
export class StandardHandler<T extends Context> {
49-
private readonly plugin: CompositePlugin<T>
49+
private readonly plugin: CompositeHandlerPlugin<T>
5050

5151
constructor(
5252
router: Router<any, T>,
5353
private readonly matcher: StandardMatcher,
5454
private readonly codec: StandardCodec,
5555
private readonly options: NoInfer<StandardHandlerOptions<T>>,
5656
) {
57-
this.plugin = new CompositePlugin(options.plugins)
57+
this.plugin = new CompositeHandlerPlugin(options.plugins)
5858

5959
this.plugin.init(this.options)
6060
this.matcher.init(router)

packages/server/src/plugins/base.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { CompositePlugin } from './base'
1+
import { CompositeHandlerPlugin } from './base'
22

3-
it('compositePlugin', () => {
3+
it('compositeHandlerPlugin', () => {
44
const plugin1 = { init: vi.fn() }
55
const plugin2 = {}
66
const plugin3 = { init: vi.fn() }
77

8-
const composite = new CompositePlugin([plugin1, plugin2, plugin3])
8+
const composite = new CompositeHandlerPlugin([plugin1, plugin2, plugin3])
99

1010
composite.init('__OPTIONS__' as any)
1111

packages/server/src/plugins/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface HandlerPlugin<TContext extends Context> {
55
init?(options: StandardHandlerOptions<TContext>): void
66
}
77

8-
export class CompositePlugin<TContext extends Context> implements HandlerPlugin<TContext> {
8+
export class CompositeHandlerPlugin<TContext extends Context> implements HandlerPlugin<TContext> {
99
constructor(private readonly plugins: HandlerPlugin<TContext>[] = []) {}
1010

1111
init(options: StandardHandlerOptions<TContext>): void {

0 commit comments

Comments
 (0)