@grpc.ts/core
Version:
Core package for @grpc.ts
29 lines (28 loc) • 1.46 kB
TypeScript
import { type Options, type ProtobufTypeDefinition } from '@grpc/proto-loader';
import { type GrpcObject, type ChannelOptions, type ChannelCredentials, type ServiceClientConstructor } from '@grpc/grpc-js';
import type { IPackageProps, IClientsProps, IChannelOptionsProps } from './interface';
export declare function convertChannelOptions({ maxSessionMemory, defaultCompressionAlgorithm, ...options }: IChannelOptionsProps): ChannelOptions;
interface IExtractedGrpcObjectProps {
[key: string]: ServiceClientConstructor | ProtobufTypeDefinition;
}
export declare function extractPackage(grpcObject: GrpcObject, packagePath: string): IExtractedGrpcObjectProps;
interface ILoadPackageParams {
packageDefinitionOptions?: Options;
package: IPackageProps | IPackageProps[];
}
interface IPackageServiceProps {
[key: string]: ServiceClientConstructor;
}
interface IPackageDefProps {
[key: string]: IPackageServiceProps;
}
export declare function isGrpcService(obj: unknown): obj is ServiceClientConstructor;
export declare function loadPackage({ package: packageInfo, packageDefinitionOptions, }: ILoadPackageParams): Promise<IPackageDefProps>;
interface IMakeServiceClientsParams {
url: string;
options: IChannelOptionsProps;
packageDefs: IPackageDefProps;
credentials: ChannelCredentials;
}
export declare function makeServiceClients({ url, options, packageDefs, credentials, }: IMakeServiceClientsParams): IClientsProps;
export {};