import type { BaseHandler } from 'redweb'; /** Structural Standard Schema v1 support; use an existing compatible validator library. */ export interface SocketSchema { readonly '~standard': { readonly version: 1; readonly validate: (input: unknown) => { readonly value: Output; readonly issues?: undefined } | { readonly issues: readonly unknown[] } | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: readonly unknown[] }>; readonly types?: { readonly input: Input; readonly output: Output }; }; } export type SchemaInput = NonNullable['input']; export type SchemaOutput = Awaited['output']>; export interface HandlerSchema { readonly name: Name; readonly schema: Schema; } export type RedwebSchemas> = { readonly [Name in keyof Schemas & string]: HandlerSchema; }; export type MessageOf = SchemaOutput; export type HandlerMessage = MessageOf; export type HandlerInput = SchemaInput; declare const socketActionBrand: unique symbol; export interface SocketAction { readonly [socketActionBrand]: true; } export interface SocketHandler { new (): BaseHandler; with(payload: Input): SocketAction; } export function defineHandlerSchema( name: Name, schema: Schema, ): HandlerSchema; /** Names each schema from its object key so handlers can select SCHEMAS.join, etc. */ export function defineRedwebSchemas>( schemas: Schemas, ): RedwebSchemas;