import type { ApiController } from '../controller/api_controller.js'; import type DebugController from '../controller/debug_controller.js'; import type { DebugStore } from '../debug/debug_store.js'; import type ServerStatsController from '../controller/server_stats_controller.js'; import type DashboardController from '../dashboard/dashboard_controller.js'; import type { AccessGuard } from '../types.js'; import type { AdonisRouter } from './router_types.js'; import type { ApplicationService } from '@adonisjs/core/types'; /** * Options for the unified route registration function. */ export interface RegisterRoutesOptions { router: AdonisRouter; getApiController: () => ApiController | null; getStatsController: () => ServerStatsController | null; getDebugController: () => DebugController | null; getDashboardController: () => DashboardController | null; getDebugStore?: () => DebugStore | null; getApp?: () => ApplicationService | null; statsEndpoint?: string | false; debugEndpoint?: string; dashboardPath?: string; shouldShow?: AccessGuard; /** * Escape hatch to register the sensitive dashboard/debug/stats routes WITHOUT * any access guard when no `shouldShow` callback is provided. Off by default — * without either `shouldShow` or this flag, sensitive routes are NOT registered * (fail closed). Enabling this exposes the dashboard (which can surface secrets, * email bodies, and SQL) to anyone who can reach it. Local dev only. */ unsafeAllowNoAuth?: boolean; /** * Whether the app is running in production. When true, `unsafeAllowNoAuth` is * ignored — an unauthenticated dashboard in production is never correct, so * the only way in is a real `shouldShow` guard. */ inProduction?: boolean; /** Optional promise that resolves when controllers are initialized. */ whenReady?: () => Promise; /** * Restrict every registered route to this host, via `router.group().domain()`. * Supports dynamic segments (`':tenant.example.com'`). Unset = no restriction. */ domain?: string; } /** * Register all server-stats routes in a single call. * * Returns whether the routes were actually registered — false means the * fail-closed guard check rejected the configuration, which callers need to * know before announcing that anything is reachable. */ export declare function registerAllRoutes(options: RegisterRoutesOptions): boolean;