import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
/**
 * Handles RPC method calls, combining core RPC methods with custom Storefront RPC methods.
 * This function acts as a central dispatcher for invoking RPC methods, determining
 * whether the method takes parameters or not, and executing it accordingly.
 * It additionally logs the execution time of each RPC call.
 *
 * @template N The RPC method name.
 * @template P The RPC method parameters.
 * @template TResult The awaited return type of the RPC method. This can include a `Response` object.
 * @template TakesParameters A boolean indicating whether the method takes parameters (undefined if it doesn't).
 * @template TParams The type of the parameters if the method takes any, otherwise null.
 *
 * @param method The name of the RPC method to call.
 * @param payload The parameters for the RPC method (if any).
 * @param rpcContext The RPC context object.
 *
 * @returns A Promise resolving to the result of the RPC call, which can be any valid return type or a `Response` object.
 *
 * @throws {Error} If the specified RPC method is not found.
 */
export declare const invokeRpc: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TakesParameters = P extends RpcContext ? undefined : boolean, TParams = TakesParameters extends undefined ? null : P>(method: N, payload: TParams, rpcContext: RpcContext) => Promise<TResult>;
