UNPKG

@orpc/server

Version:

<div align="center"> <image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" /> </div>

54 lines (50 loc) 2.33 kB
import { Interceptor, MaybeOptionalOptions } from '@orpc/shared'; import { FastifyRequest, FastifyReply, SendStandardResponseOptions } from '@orpc/standard-server-fastify'; import { C as Context, R as Router } from '../../shared/server.qKsRrdxW.js'; import { b as StandardHandleOptions, f as StandardHandler } from '../../shared/server.7cEtMB30.js'; import { F as FriendlyStandardHandleOptions } from '../../shared/server.EfTOZ2Q7.js'; import { S as StandardRPCHandlerOptions } from '../../shared/server.yoEB3Fx4.js'; import '@orpc/client'; import '@orpc/contract'; import '@orpc/standard-server'; import '@orpc/client/standard'; import '../../shared/server.ChyoA9XY.js'; type FastifyHandleResult = { matched: true; } | { matched: false; }; interface FastifyInterceptorOptions<T extends Context> extends StandardHandleOptions<T> { request: FastifyRequest; reply: FastifyReply; sendStandardResponseOptions: SendStandardResponseOptions; } interface FastifyHandlerOptions<T extends Context> extends SendStandardResponseOptions { adapterInterceptors?: Interceptor<FastifyInterceptorOptions<T>, Promise<FastifyHandleResult>>[]; } declare class FastifyHandler<T extends Context> { private readonly standardHandler; private readonly sendStandardResponseOptions; private readonly adapterInterceptors; constructor(standardHandler: StandardHandler<T>, options?: NoInfer<FastifyHandlerOptions<T>>); handle(request: FastifyRequest, reply: FastifyReply, ...rest: MaybeOptionalOptions<FriendlyStandardHandleOptions<T>>): Promise<FastifyHandleResult>; } interface RPCHandlerOptions<T extends Context> extends FastifyHandlerOptions<T>, StandardRPCHandlerOptions<T> { /** * Enables or disables the StrictGetMethodPlugin. * * @default true */ strictGetMethodPluginEnabled?: boolean; } /** * RPC Handler for Fastify Server * * @see {@link https://orpc.dev/docs/rpc-handler RPC Handler Docs} * @see {@link https://orpc.dev/docs/adapters/http HTTP Adapter Docs} */ declare class RPCHandler<T extends Context> extends FastifyHandler<T> { constructor(router: Router<any, T>, options?: NoInfer<RPCHandlerOptions<T>>); } export { FastifyHandler, RPCHandler }; export type { FastifyHandleResult, FastifyHandlerOptions, FastifyInterceptorOptions, RPCHandlerOptions };