@join-com/grpc
Advanced tools
Comparing version 0.0.4 to 0.0.5
import * as grpc from '@grpc/grpc-js'; | ||
import { ClientStreamRequest, IClient, MethodName, UnaryRequest } from './interfaces/IClient'; | ||
import { IClientConfig } from './interfaces/IClientConfig'; | ||
export declare class Client<ServiceDefinitionType> implements IClient<ServiceDefinitionType> { | ||
private readonly config; | ||
private readonly client; | ||
constructor(config: IClientConfig<ServiceDefinitionType>); | ||
declare type GrpcServiceClient = InstanceType<ReturnType<typeof grpc.makeGenericClientConstructor>>; | ||
export declare class Client<ServiceDefinitionType = grpc.UntypedServiceImplementation> implements IClient<ServiceDefinitionType> { | ||
/** WARNING: Only access this property from outside for debugging/tracing/profiling purposes */ | ||
readonly config: IClientConfig<ServiceDefinitionType>; | ||
/** WARNING: Only access this property from outside for debugging/tracing/profiling purposes */ | ||
readonly client: GrpcServiceClient; | ||
constructor( | ||
/** WARNING: Only access this property from outside for debugging/tracing/profiling purposes */ | ||
config: IClientConfig<ServiceDefinitionType>); | ||
close(): void; | ||
@@ -15,2 +20,3 @@ makeBidiStreamRequest<RequestType, ResponseType>(method: MethodName<ServiceDefinitionType>, metadata?: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientDuplexStream<RequestType, ResponseType>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=Client.d.ts.map |
@@ -25,5 +25,8 @@ "use strict"; | ||
class Client { | ||
// We keep config as an internal property to make debugging easier | ||
constructor(config) { | ||
constructor( | ||
/** WARNING: Only access this property from outside for debugging/tracing/profiling purposes */ | ||
config) { | ||
this.config = config; | ||
// Don't lose time trying to see if the third parameter (classOptions) is useful for anything. It's not. | ||
// The current implementation of grpc.makeGenericClientConstructor does absolutely nothing with it. | ||
const ClientClass = grpc.makeGenericClientConstructor(this.config.serviceDefinition, this.config.serviceName, {}); | ||
@@ -30,0 +33,0 @@ this.client = new ClientClass(this.config.address, this.config.credentials, this.config.options); |
export * from './interfaces/IClient'; | ||
export * from './interfaces/IClientConfig'; | ||
export * from './interfaces/IServer'; | ||
export * from './Client'; | ||
export * from './Server'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -14,3 +14,6 @@ "use strict"; | ||
__exportStar(require("./interfaces/IClient"), exports); | ||
__exportStar(require("./interfaces/IClientConfig"), exports); | ||
__exportStar(require("./interfaces/IServer"), exports); | ||
__exportStar(require("./Client"), exports); | ||
__exportStar(require("./Server"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,3 @@ import * as grpc from '@grpc/grpc-js'; | ||
}; | ||
export interface IClient<ServiceDefinitionType> { | ||
export interface IClient<ServiceDefinitionType = grpc.UntypedServiceImplementation> { | ||
makeUnaryRequest<RequestType, ResponseType>(method: MethodName<ServiceDefinitionType>, argument: RequestType, metadata?: grpc.Metadata, options?: grpc.CallOptions): UnaryRequest<ResponseType>; | ||
@@ -14,0 +14,0 @@ makeClientStreamRequest<RequestType, ResponseType>(method: MethodName<ServiceDefinitionType>, metadata?: grpc.Metadata, options?: grpc.CallOptions): ClientStreamRequest<RequestType, ResponseType>; |
import * as grpc from '@grpc/grpc-js'; | ||
export interface IClientConfig<ServiceDefinitionType> { | ||
export interface IClientConfig<ServiceDefinitionType = grpc.UntypedServiceImplementation> { | ||
serviceName: string; | ||
@@ -4,0 +4,0 @@ serviceDefinition: grpc.ServiceDefinition<ServiceDefinitionType>; |
{ | ||
"name": "@join-com/grpc", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "gRPC library", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24437
27
245