/** * Single connection: read RESP, dispatch commands, write encoded responses. */ import type { Socket } from 'node:net'; import type { CommandPolicy, CompiledCommandPolicy } from '../commands/registry.ts'; import type { PubSubBroker } from '../pubsub/broker.ts'; import type { ScriptingPlugin } from '../scripting/plugin.ts'; import type { ServerStats } from './stats.ts'; import type { ConnectionHooks, Engine } from '../types.ts'; /** Shared connection services for one server instance. */ export interface ConnectionServices { /** Pub/Sub broker shared by every connection of the server. */ pubSub?: PubSubBroker | null; /** Prepared scripting plugin owned by the server. */ scripting?: ScriptingPlugin | null; /** Owner the scripting plugin is attached to; defaults to the engine. */ scriptingOwner?: object; /** Server-wide counters reported by INFO; shared by every connection of the server. */ stats?: ServerStats; } /** * @param hooks - Optional: onUnknownCommand, onCommandError, onSocketError * @param commandPolicy - Optional: command rename/disable policy. * @param services - Shared connection services for this server instance. */ export declare function handleConnection(socket: Socket, engine: Engine, hooks?: ConnectionHooks, commandPolicy?: CommandPolicy | CompiledCommandPolicy | null, services?: ConnectionServices): void;