export interface RequestContextBase { peerAuthorization?: string; method: string; requestId: number; } export type MethodHandler = (params: Params, ctx: RequestContext, peer: ISocketClient, next: () => Promise) => Promise; export type GenericMiddleware = MethodHandler; type NonEmptyArray = [...T[], T]; export type MethodHandlers = { [Key in keyof Methods]: Methods[Key] extends (params: infer Params) => Promise ? NonEmptyArray> : Methods[Key] extends Record ? MethodHandlers : never; }; type ISocketClientMethodCall = { [Key in keyof Methods]: Methods[Key] extends (params: infer P) => Promise ? (params: P) => Promise : Methods[Key] extends Record ? ISocketClientMethodCall : never; }; export type ISocketClient = { close: (reason?: string) => void; closeAndRejectPendingRequests: (reason?: string) => void; call: ISocketClientMethodCall; requestWithTracing: (method: string, params: Params, tracingHeaders: { traceparent?: string; tracestate?: string; }, authorization?: string) => Promise; }; export type MethodSchema = (params: Params) => Promise; /** The exception type can be thrown to cause the default error handler to write a raw error response to the socket */ export declare class SocketErrorException extends Error { readonly code: number; readonly message: string; constructor(code: number, message: string); } export type SocketTimeouts = { noResponseTimeoutInSeconds?: number; connectionTimeoutInSeconds?: number; }; export {}; //# sourceMappingURL=types.d.ts.map