import { WebSocket } from 'ws';
import type { Client } from '../../types/remote/protocol';
import { IDiagnosticReporter } from '../../utils/diagnostic';
interface IDispatcherState {
    transfer?: {
        kind: Client.TransferKind;
        id: string;
    };
}
export interface RetryMessageOptions {
    retryMessageMaxRetries: number;
    retryMessageTimeout: number;
}
interface IDispatchOptions {
    attachTransfer?: boolean;
    /** Merged onto the dispatcher's default `retryMessageOptions` for this message only. */
    retryOverrides?: Partial<RetryMessageOptions>;
}
type Dispatch<T> = Omit<T, 'transferID' | 'uuid'>;
export declare const createDispatcher: (ws: WebSocket, retryMessageOptions?: RetryMessageOptions, reportInfo?: (message: string) => void) => {
    readonly transferID: string | undefined;
    readonly transferKind: "push" | "pull" | undefined;
    setTransferProperties: (properties: Exclude<IDispatcherState["transfer"], undefined>) => void;
    dispatch: <U = null>(message: Dispatch<Client.Message>, options?: IDispatchOptions) => Promise<U | null>;
    dispatchCommand: <U extends Client.Command>(payload: {
        command: U;
    } & ([Client.GetCommandParams<U>] extends [never] ? unknown : {
        params?: Client.GetCommandParams<U>;
    })) => Promise<null>;
    dispatchTransferAction: <T>(action: Client.Action["action"]) => Promise<T | null>;
    dispatchTransferStep: <T, A extends Client.TransferPushMessage["action"] = "end" | "stream" | "start", S extends Client.TransferPushStep = "entities" | "links" | "assets" | "configuration">(payload: {
        step: S;
        action: A;
    } & (A extends "stream" ? {
        data: Client.GetTransferPushStreamData<S>;
    } : unknown), dispatchOptions?: Omit<IDispatchOptions, "attachTransfer">) => Promise<T | null>;
};
type WebsocketParams = ConstructorParameters<typeof WebSocket>;
type Address = WebsocketParams[0];
type Options = WebsocketParams[2];
export declare const connectToWebsocket: (address: Address, options?: Options, diagnostics?: IDiagnosticReporter) => Promise<WebSocket>;
export declare const trimTrailingSlash: (input: string) => string;
export declare const wait: (ms: number) => Promise<void>;
export declare const waitUntil: (test: () => boolean, interval: number) => Promise<void>;
export {};
//# sourceMappingURL=utils.d.ts.map