import type { Context, Handler, MiddlewareHandler } from 'hono'; import type { DescribeRouteOptions } from 'hono-openapi'; import type { Mastra } from '../mastra/index.js'; import type { RequestContext } from '../request-context/index.js'; import type { ApiRoute, MastraAuthConfig, Methods } from './types.js'; export type { MastraAuthConfig, ContextWithMastra, ApiRoute, HttpLoggingConfig, ValidationErrorContext, ValidationErrorResponse, ValidationErrorHook, } from './types.js'; export { MastraAuthProvider } from './auth.js'; export type { MastraAuthProviderOptions } from './auth.js'; export { CompositeAuth } from './composite-auth.js'; export { MastraServerBase } from './base.js'; export { SimpleAuth } from './simple-auth.js'; export type { SimpleAuthOptions } from './simple-auth.js'; type ParamsFromPath
= { [K in P extends `${string}:${infer Param}/${string}` | `${string}:${infer Param}` ? Param : never]: string; }; type RegisterApiRoutePathError = `Param 'path' must not start with '/api', it is reserved for internal API routes.`; type ValidatePath
= P extends `/api/${string}` ? RegisterApiRoutePathError : T; /** * Variables available in the Hono context for custom API route handlers. * These are set by the server middleware and available via c.get(). */ type CustomRouteVariables = { mastra: Mastra; requestContext: RequestContext; }; type RegisterApiRouteOptions
= { method: Methods; openapi?: DescribeRouteOptions; handler?: Handler<{ Variables: CustomRouteVariables; }, P, ParamsFromPath
>;
createHandler?: (c: Context) => Promise (path: P, options: ValidatePath >): ValidatePath ;
export declare function defineAuth