import type { ErrorDef, InferErrorData } from '@ts-pf/contract'; export type NextFn = (opts?: { context?: Partial; input?: TInput; }) => Promise; export type MiddlewareFn = (opts: { context: TCtx; input: TInput; next: NextFn; errors: ErrorFactory; path: string[]; }) => Promise; export type ErrorFactory = Record> = string extends keyof E ? { [K in keyof E]: (data?: unknown) => never; } : { [K in keyof E]: [InferErrorData>] extends [never] ? () => never : (data: InferErrorData>) => never; }; //# sourceMappingURL=middleware.d.ts.map