import { AnyRootConfig } from './internals/config'; import { ProcedureCallOptions } from './internals/procedureBuilder'; import { AnyProcedure, ProcedureArgs } from './procedure'; import { MaybePromise } from './types'; /** @internal **/ export type ProcedureRecord = Record; export interface ProcedureRouterRecord { [key: string]: AnyProcedure | AnyRouter; } export interface RouterDef { _config: TConfig; router: true; procedure?: never; procedures: TRecord; record: TRecord; } export type AnyRouterDef = RouterDef; type DecorateProcedure = (input: ProcedureArgs[0]) => Promise; /** * @internal */ type DecoratedProcedureRecord = { [TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ? DecoratedProcedureRecord : TProcedures[TKey] extends AnyProcedure ? DecorateProcedure : never; }; /** * @internal */ export type RouterCaller = ( /** * @note * If passing a function, we recommend it's a cached function * e.g. wrapped in `React.cache` to avoid unnecessary computations */ ctx: TDef['_config']['$types']['ctx'] | (() => MaybePromise)) => DecoratedProcedureRecord; export interface Router { _def: TDef; /** * @deprecated use `t.createCallerFactory(router)` instead * @see https://trpc.io/docs/server/server-side-calls */ createCaller: RouterCaller; } export type AnyRouter = Router; /** * @internal */ export type CreateRouterInner = Router> & /** * This adds ability to call procedures directly but is primarily used for quick access in type inference */ TProcRouterRecord; /** * @internal */ export declare function createRouterFactory(config: TConfig): (procedures: TProcRouterRecord) => CreateRouterInner; /** * @internal */ export declare function callProcedure(opts: ProcedureCallOptions & { procedures: ProcedureRouterRecord; }): Promise; export declare function createCallerFactory(): >>(router: TRouter) => RouterCaller; export {}; //# sourceMappingURL=router.d.ts.map