import {
  createApi
} from "./chunk-3OJ5QDPS.mjs";

// src/runtime/index.tsx
import { errorFrom } from "@toolpad/utils/errors";
function createRemoteFunction(functionFile, functionName) {
  const runtimeApi = createApi(`${process.env.BASE_URL}/api/runtime-rpc`);
  return async function remote(...params) {
    const { data, error } = await runtimeApi.methods.execFunction(
      functionFile,
      functionName,
      params
    );
    if (error) {
      throw errorFrom(error);
    }
    return data;
  };
}

export {
  createRemoteFunction
};
//# sourceMappingURL=chunk-RZHPB5F4.mjs.map