/** * FluentRouter — Prefix Grouping for Fluent Tools * * Eliminates repetitive `'users.'` prefixes across dozens of tools. * A router shares a common prefix, description, and middleware chain * across all child tools. * * @example * ```typescript * const f = initFusion(); * * const users = f.router('users') * .describe('User management') * .use(requireAuth); * * // Tool name: "users", action: "list" * const listUsers = users.query('list') * .input({ limit: f.number() }) * .resolve(async ({ input }) => { ... }); * * // Tool name: "users", action: "delete" * const deleteUser = users.mutation('delete') * .input({ id: f.string() }) * .resolve(async ({ input }) => { ... }); * ``` * * @module */ import { type MiddlewareFn } from '../types.js'; import { type MiddlewareDefinition } from '../middleware/ContextDerivation.js'; import { FluentToolBuilder } from './FluentToolBuilder.js'; /** * Fluent router that shares prefix, description, and middleware * across child tools created via `.query()`, `.mutation()`, `.action()`. * * @typeParam TContext - Base application context */ export declare class FluentRouter { /** @internal */ readonly _prefix: string; /** @internal */ _description?: string; /** @internal */ _middlewares: MiddlewareFn[]; /** @internal */ _tags: string[]; constructor(prefix: string); /** * Set the shared description for all tools in this router. * * @param text - Human-readable description * @returns `this` for chaining */ describe(text: string): this; /** * Add middleware shared by all tools in this router. * * Accepts both `MiddlewareDefinition` from `f.middleware()` and * raw `MiddlewareFn` functions. * * @param mw - Middleware function or MiddlewareDefinition * @returns Router with narrowed `TContext` type (when using MiddlewareDefinition) */ use>(mw: MiddlewareDefinition): FluentRouter; use(mw: MiddlewareFn): this; /** * Set capability tags shared by all tools in this router. * * @param tags - Tag strings for filtering * @returns `this` for chaining */ tags(...tags: string[]): this; /** * Create a read-only query tool under this router's prefix. * * @param action - Action name (e.g. `'list'` → tool name `'prefix.list'`) * @returns A `FluentToolBuilder` with the prefixed name and inherited config */ query(action: string): FluentToolBuilder; /** * Create a destructive mutation tool under this router's prefix. * * @param action - Action name (e.g. `'delete'` → tool name `'prefix.delete'`) * @returns A `FluentToolBuilder` with the prefixed name and inherited config */ mutation(action: string): FluentToolBuilder; /** * Create a neutral action tool under this router's prefix. * * @param action - Action name (e.g. `'update'` → tool name `'prefix.update'`) * @returns A `FluentToolBuilder` with the prefixed name and inherited config */ action(action: string): FluentToolBuilder; /** * Create a FluentToolBuilder with inherited router config. * @internal */ private _createBuilder; } //# sourceMappingURL=FluentRouter.d.ts.map