UNPKG

@trpc/next

Version:

The tRPC Next.js library

30 lines 1.81 kB
import type { CreateContextCallback } from '@trpc/server'; import type { AnyProcedure, AnyRootTypes, AnyRouter, ErrorHandlerOptions, inferClientTypes, MaybePromise, RootConfig, Simplify, TRPCResponse } from '@trpc/server/unstable-core-do-not-import'; import type { ActionHandlerDef, CreateTRPCNextAppRouterOptions, inferActionDef } from './shared'; import type { NextAppDirDecorateRouterRecord } from './types'; export type { ActionHandlerDef }; export declare function experimental_createTRPCNextAppDirServer<TRouter extends AnyRouter>(opts: CreateTRPCNextAppRouterOptions<TRouter>): NextAppDirDecorateRouterRecord<TRouter["_def"]["_config"]["$types"], TRouter["_def"]["record"]>; /** * @internal */ export type TRPCActionHandler<TDef extends ActionHandlerDef> = (input: FormData | TDef['input']) => Promise<TRPCResponse<TDef['output'], TDef['errorShape']>>; export declare function experimental_createServerActionHandler<TInstance extends { _config: RootConfig<AnyRootTypes>; }>(t: TInstance, opts: CreateContextCallback<TInstance['_config']['$types']['ctx'], () => MaybePromise<TInstance['_config']['$types']['ctx']>> & { /** * Transform form data to a `Record` before passing it to the procedure * @default true */ normalizeFormData?: boolean; /** * Called when an error occurs in the handler */ onError?: (opts: ErrorHandlerOptions<TInstance['_config']['$types']['ctx']>) => void; /** * Rethrow errors that should be handled by Next.js * @default true */ rethrowNextErrors?: boolean; }): <TProc extends AnyProcedure>(proc: TProc) => TRPCActionHandler<Simplify<inferActionDef<inferClientTypes<TInstance>, TProc>>>; export declare function experimental_revalidateEndpoint(req: Request): Promise<Response>; //# sourceMappingURL=server.d.ts.map