import GRPCClient from "./GRPCClient"; import Class from "../../../types/Class"; import IClientProxy from "../../../interfaces/Client/IClientProxy"; /** * gRPC proxy wrapper for service-to-service invocation. * * Provides type-safe proxy creation for invoking remote services through the Dapr sidecar * using the gRPC protocol. Proxies automatically handle serialization, method routing, * and gRPC communication to the target service. * * @implements {IClientProxy} * * @internal */ export default class GRPCClientProxy implements IClientProxy { /** * Reference to the underlying gRPC client. */ client: GRPCClient; /** * Creates a gRPC proxy wrapper. * * @param client - The gRPC client instance */ constructor(client: GRPCClient); /** * Creates a type-safe proxy for service-to-service invocation. * * Returns a proxy object that implements the specified service class interface, * with methods that invoke the remote service through the Dapr sidecar. * Supports arbitrary service interfaces with automatic method routing. * * @typeParam T - The service interface type to proxy * @param cls - The service class/interface to proxy. Methods on the proxy will match this interface. * @param _clientOptions - Optional proxy configuration (currently unused) * * @returns Promise resolving to a proxy implementing service interface T * * @throws Rejects if proxy construction fails or gRPC connection is unavailable * * @example * ```typescript * // Define a service interface * class MyRemoteService { * async greet(name: string): Promise { * // Implementation would be generated by proxy * } * } * * // Create a proxy instance * const proxy = await client.proxy.create(MyRemoteService); * * // Call remote methods as if they were local * const result = await proxy.greet("World"); * ``` * * @see {@link HTTPClientProxy} for HTTP-based invocation (without proxy support) * @see {@link DaprClient.proxy} for unified API */ create(cls: Class, _clientOptions?: Record): Promise; }