import { MessageInterface } from '../communication-interface/MessageInterface';
declare global {
    interface ErrorConstructor {
        new (message?: string, options?: ErrorOptions): Error;
    }
    interface ErrorOptions {
        cause?: any;
    }
}
export declare type ExpectedCall<K> = {
    functionName: K;
    timeout?: number;
};
declare type ExpectedCallStruct = {
    from: string;
    stack: string;
    resolver: (r: Promise<void> | void) => void;
};
export declare class LongAsyncRemoteFunction<T> {
    private messageInterface;
    private namespace;
    constructor(messageInterface: MessageInterface, namespace?: string);
    messageRecieved(from: string, payload: string): Promise<boolean>;
    private _messageRecieved;
    registeredFunctions: Map<string, {
        func: (from: string, param: any) => void | Promise<void>;
        expectedInvocations: Array<ExpectedCallStruct>;
    }>;
    /**
     * Registers a function to be called on a remote system.
     * The functions are not allowed to return a value.
     * Instead, return values should invoke a different function.
     * @param name a name to identify the function (similar to REST routes)
     * @param func the function to be executed remotely
     */
    register<K extends keyof T>(name: K, func: (from: string, param: T[K]) => void | Promise<void>): void;
    getCallCode<K extends keyof T>(name: K, targetUserId: string, argObject: T[K]): string;
    expectCallInvocation<K extends keyof T>(ec: ExpectedCall<K>, from: string): Promise<void>;
    call<K extends keyof T>(name: K, targetUserId: string, argObject: T[K], ec?: ExpectedCall<K>): Promise<void>;
    private _invokeLocal;
}
export {};
//# sourceMappingURL=LongAsyncRemoteFunction.d.ts.map