bun-ws-router
Version:
Lightweight client/server WebSocket router for Bun with type-safe Zod/Valibot validation.
21 lines • 806 B
TypeScript
import * as v from "valibot";
import type { ValidatorAdapter } from "../shared/router";
import type { MessageSchemaType } from "./types";
/**
* Adapter that bridges Valibot validation with the generic router implementation.
* Handles the differences in Valibot's schema structure compared to Zod.
*/
export declare class ValibotValidatorAdapter implements ValidatorAdapter {
getMessageType(schema: MessageSchemaType): string;
safeParse(schema: MessageSchemaType, data: unknown): {
success: boolean;
data: {
readonly [x: string]: any;
[x: number]: any;
[x: symbol]: any;
} | undefined;
error: [any, ...any[]] | undefined;
};
infer<T extends MessageSchemaType>(): v.InferOutput<T>;
}
//# sourceMappingURL=adapter.d.ts.map