effect-rpc
    Preparing search index...

    Function makeServerRequest

    • Creates a server-side handler for a specific RPC request within a given RPC group, immediately invoking the RPC endpoint with the provided payload and returning the result Effect.

      Type Parameters

      • T extends RpcGroup<any>

        The type representing the RPC group.

      • K extends string | number | symbol

        The key of the RPC method within the group.

      Parameters

      • rpcGroup: T

        The RPC group containing the available RPC methods.

      • requestName: K

        The name of the RPC method to handle.

      • payload: Parameters<InferClient<T>[K]>[0]

        The payload to send to the specified RPC method.

      Returns ReturnType<InferClient<T>[K]>

      The Effect returned by invoking the RPC endpoint with the given payload.

      This utility is intended for server-side usage to facilitate handling of typed RPC requests. The returned Effect enforces the correct payload and return types based on the RPC group definition. It wraps the same client as useRPCRequest, but immediately invokes the endpoint with the payload.

      const userEffect = makeServerRequest(userRpcGroup, "getUser", { id: "123" });
      // userEffect is an Effect representing the result of the getUser RPC method.

      0.3.0