import type { IncomingMessage, ServerResponse, ServerOptions as NodeServerOptions, Server as NodeServer } from 'node:http'; import type { Method, TaskAction, TaskResult, UnknownNest, FileSystem } from '@stackpress/lib/types'; import type ActionRouter from './plugin/ActionRouter.js'; import type Request from './Request.js'; import type Response from './Response.js'; import type Router from './Router.js'; import type Server from './Server.js'; export type { TypeOf, Key, NestedObject, UnknownNest, Scalar, Hash, ScalarInput, FileMeta, CallableSet, CallableMap, CallableNest, ResponseStatus, Trace, ErrorResponse, SuccessResponse, StatusResponse, Item, TaskResult, TaskAction, TaskItem, EventMap, EventName, EventData, EventMatch, Event, EventHook, EventExpression, Body, ResponseDispatcher, ResponseOptions, Headers, Data, Query, Session, Post, LoaderResults, RequestLoader, CallableSession, RequestOptions, Revision, CookieOptions, Method, Route, RouteMap, RouteAction, RouterContext, RouterArgs, RouterMap, RouterAction, FileRecursiveOption, FileStat, FileStream, FileSystem, CallSite } from '@stackpress/lib/types'; export type ConfigLoaderOptions = { cwd?: string; fs?: FileSystem; key?: string; extnames?: string[]; }; export type PluginLoaderOptions = ConfigLoaderOptions & { modules?: string; plugins?: string[]; }; export type ActionRouteProps = { request: Request; response: Response; context: X; req: Request; res: Response; ctx: X; }; export type ActionRouterArgs = [ ActionRouteProps ]; export type ActionRouterMap = Record>; export type ActionRouterAction = TaskAction>; export type ActionRouterListener = (event: string, action: ActionRouterAction, priority?: number) => ActionRouter; export type EntryRouterTaskItem = { entry: string; priority: number; }; export type ImportRouterAction = () => Promise<{ default: ActionRouterAction; }>; export type ImportRouterTaskItem = { import: ImportRouterAction; priority: number; }; export type ViewRouterTaskItem = { entry: string; priority: number; }; export type ViewRouterEngine = (filePath: string, ...args: ActionRouterArgs) => TaskResult; export type ViewRouterRender = (filePath: string, props?: UnknownNest, options?: UnknownNest) => string | null | Promise; export type AnyRouterAction = string | ActionRouterAction | ImportRouterAction; export type ActionProps = ActionRouteProps>; export type AnyActionProps = ActionRouteProps>; export type ConfigMap = UnknownNest; export type PluginMap = Record; export type Infer = { readonly __infer: unique symbol; }; export type KnownPlugin = K extends keyof P ? P[K] : unknown; export type ServerProps = ActionRouteProps>; export type ServerAction = ActionRouterAction>; export type ServerHandler = (ctx: Server, req: R, res: S) => Promise; export type ServerGateway = (options: NodeServerOptions) => NodeServer; export type ServerOptions = PluginLoaderOptions & { handler?: ServerHandler; gateway?: (server: Server) => ServerGateway; }; export { NodeServer, NodeServerOptions }; export type NodeRequest = globalThis.Request; export type NodeResponse = globalThis.Response; export type NodeOptResponse = NodeResponse | undefined; export type IM = IncomingMessage; export type SR = ServerResponse; export type HttpResponse = Response; export type HttpRequest = Request; export type HttpRouter = Router; export type HttpServer = Server; export type HttpServerOptions = ServerOptions; export type HttpAction = ServerAction; export type WhatwgResponse = Response; export type WhatwgRequest = Request; export type WhatwgRouter = Router; export type WhatwgServer = Server; export type WhatwgServerOptions = ServerOptions; export type WhatwgAction = ServerAction; export type ControllerProperty = string | symbol; export type ControllerHandler = Router> = ActionRouterAction; export type ControllerRouteDefinition = { method: Method | 'ALL'; path: string; property: ControllerProperty; priority: number; }; export type ControllerEventDefinition = { event: string | RegExp; property: ControllerProperty; priority: number; }; export type ControllerMetadata = { basePath: string; routes: ControllerRouteDefinition[]; events: ControllerEventDefinition[]; }; export type ControllerInstance = object; export type ControllerClass = new () => ControllerInstance; export type ControllerMountable = ControllerClass | ControllerInstance;