/** * Koa Server Adapter * Server adapter implementation using Koa framework * Koa is known for its elegant middleware composition using async/await */ import type { NeuroLink } from "../../neurolink.js"; import { BaseServerAdapter } from "../abstract/baseServerAdapter.js"; import type { MiddlewareDefinition, RouteDefinition, ServerAdapterConfig } from "../../types/index.js"; /** * Koa-specific server adapter * Leverages Koa's middleware composition for clean request handling */ export declare class KoaServerAdapter extends BaseServerAdapter { private app; private router; private server?; private frameworkInitialized; private rateLimitStore; private rateLimitCleanupInterval?; private sockets; constructor(neurolink: NeuroLink, config?: ServerAdapterConfig); /** * Initialize Koa framework * Called by base class but actual initialization happens in initializeFrameworkAsync */ protected initializeFramework(): void; /** * Initialize Koa framework with async imports */ private initializeFrameworkAsync; /** * Create rate limiter middleware for Koa */ private createRateLimiter; /** * Periodically clean up expired rate limit entries */ private cleanupRateLimitStore; /** * Override initialize to ensure async framework setup */ initialize(): Promise; /** * Register route with Koa */ protected registerFrameworkRoute(route: RouteDefinition): void; /** * Handle streaming response using Server-Sent Events */ private handleStreamingResponse; /** * Register middleware with Koa */ protected registerFrameworkMiddleware(middleware: MiddlewareDefinition): void; /** * Start the Koa server */ start(): Promise; /** * Stop the Koa server with graceful shutdown */ stop(): Promise; /** * Stop accepting new connections */ protected stopAcceptingConnections(): Promise; /** * Close the underlying server */ protected closeServer(): Promise; /** * Force close all active connections */ protected forceCloseConnections(): Promise; /** * Get the Koa app instance */ getFrameworkInstance(): unknown; }