import "@fastify/websocket"; import type { FastifyInstance } from "fastify"; import { type StarscreamPlugin, type StarscreamRoute, type StarscreamServer } from ".."; export interface StarscreamAppRoutesOptions { dirs?: { routes: string | string[]; }; } /** * A function that will build a route for mounting into the route table for routes which fail to import * Used to implement framework-level error pages **/ export type ImportErrorRouteBuilder = (server: FastifyInstance, error: Error, context: { fileName: string; filePath: string; method: string; pathPattern: string; }) => StarscreamRoute; export declare const StarscreamAppRoutes: import("fastify").FastifyPluginCallback; export declare const registerPluginWithTimeout: (instance: StarscreamServer, plugin: StarscreamPlugin, name: string, type: "route" | "boot") => Promise; export declare const diskRouteFileNameToFastifyRoute: (filePath: string) => { fileName: string; method: string; pathPattern: string; } | null; export interface RequirePluginOptions { root: boolean; warnOnInvalidPath: boolean; requireFunc: (path: string) => any; presentationRootPath?: string; buildErrorRoute?: ImportErrorRouteBuilder; } /** * Require all the routes from the routes directory structure. * * Loop over each directory registering the scope plugin first, and then each route within that folder * This lets the scope plugin add context to just that folder's routes, so like an auth handler or what have you only applies to subordinate routes. * This actually works using Fastify's scope encapsulation thing where decorations added in outer plugins apply only to inner plugins using the folder hierarchy, but in order to take advantage of that, we need to nest the register calls right, so this does that. */ export declare const requirePluginsAtPath: (currentPath: string, currentInstance: StarscreamServer, optionsArg?: Partial) => Promise;