@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
80 lines (79 loc) • 2.33 kB
TypeScript
/**
* 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<void>;
/**
* 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<void>;
/**
* Stop the Koa server with graceful shutdown
*/
stop(): Promise<void>;
/**
* Stop accepting new connections
*/
protected stopAcceptingConnections(): Promise<void>;
/**
* Close the underlying server
*/
protected closeServer(): Promise<void>;
/**
* Force close all active connections
*/
protected forceCloseConnections(): Promise<void>;
/**
* Get the Koa app instance
*/
getFrameworkInstance(): unknown;
}