/** * Mock platform adapter for testing. * Manages in-memory WebSocket connections and coordinates with the router. */ import type { ConnectionData } from "../context/base-context.js"; import type { RouterImpl } from "../internal.js"; import type { PlatformAdapter, ServerWebSocket } from "../ws/platform-adapter.js"; import { TestWebSocket, type ConnectionState } from "./test-websocket.js"; import type { OutgoingFrame } from "./types.js"; /** * In-memory platform adapter that manages in-memory WebSocket connections. * Used by the test harness to coordinate message routing. * * Integrates with router's websocket bridge to exercise the same code paths * as production adapters (Bun, Cloudflare, etc.). */ export declare class InMemoryPlatformAdapter implements PlatformAdapter { private connections; private nextClientId; private globalMessages; private router; constructor(router: RouterImpl); /** * Get or create a connection. */ getOrCreateConnection(init?: { data?: Partial; headers?: Record; }): TestWebSocket; /** * Get a connection by ID. */ getConnection(clientId: string): ConnectionState | undefined; /** * Get all active connections. */ getAllConnections(): Map>; getServerWebSocket(clientId: string): ServerWebSocket | undefined; close(clientId: string, code?: number, reason?: string): void; send(clientId: string, data: string | ArrayBuffer): void; getConnectionInfo(clientId: string): Record; /** * Send a message to router from a client. * Routes through router.websocket.message() to exercise the same bridge * as production adapters (Bun, Cloudflare, etc.). */ receiveMessage(clientId: string, type: string, payload?: unknown, meta?: Record): Promise; /** * Get all globally sent messages. */ getAllSentMessages(): readonly OutgoingFrame[]; /** * Clear all sent messages. */ clearSentMessages(): void; /** * Close all connections. */ closeAll(): void; private decode; } //# sourceMappingURL=test-adapter.d.ts.map