import type { BasePayload } from 'payload'; import type { I18nConfig } from '../i18n/index.js'; type CreateSearchRouteArgs = { /** Absolute origin to prefix result URLs with. */ baseUrl?: string; /** Pages collection. Default 'pages'. */ collection?: string; config: I18nConfig; /** Default result cap when ?limit is absent. Default 10. */ defaultLimit?: number; getCachedPayload: () => Promise; /** Home slug map/string so the home result collapses to root. */ homeSlug?: Record | string; /** * Per-IP limit (in memory, per instance). Default { max: 120, windowMs: 60_000 }. * `false` = off (a limiter in front, e.g. Cloudflare WAF rate limiting). */ rateLimit?: { max?: number; windowMs?: number; } | false; /** Field holding a richer AI summary (buildSummaryField) to prefer as description. */ summaryField?: string; }; /** * A JSON content-search endpoint. Powers both the site's own search UI and * external agents — one ranking, one source of truth (shares searchContent with * the MCP server's search_content tool). * * // app/api/search/route.ts * import { createSearchRoute } from '@intecion/ipal-kit' * import { getCachedPayload } from '@/lib/content' * import { i18nConfig } from '@/i18n.config' * export const dynamic = 'force-dynamic' * export const GET = createSearchRoute({ getCachedPayload, config: i18nConfig, * baseUrl: process.env.NEXT_PUBLIC_SERVER_URL! }) * * Query params: `q` (required), `locale`, `limit`. Response: * { query, locale, count, results: [{ title, url, description?, slug }] } * * Uses the global Request/Response — no next/server import. */ export declare function createSearchRoute(args: CreateSearchRouteArgs): (req: Request) => Promise; export {};