@graphql-mesh/grpc
Version:
40 lines (39 loc) • 1.84 kB
TypeScript
import './patchLongJs';
import { GetMeshSourceOptions, Logger, MeshHandler, YamlConfig } from '@graphql-mesh/types';
import { ChannelCredentials, loadPackageDefinition } from '@grpc/grpc-js';
import { AnyNestedObject, Message } from 'protobufjs';
import protobufjs from 'protobufjs';
import { IFileDescriptorSet } from 'protobufjs/ext/descriptor';
declare type DecodedDescriptorSet = Message<IFileDescriptorSet> & IFileDescriptorSet;
declare type RootJsonAndDecodedDescriptorSet = {
name: string;
rootJson: protobufjs.INamespace;
decodedDescriptorSet: DecodedDescriptorSet;
};
export default class GrpcHandler implements MeshHandler {
private config;
private baseDir;
private rootJsonAndDecodedDescriptorSets;
private logger;
constructor({ config, baseDir, store, logger }: GetMeshSourceOptions<YamlConfig.GrpcHandler>);
getRootPromisesFromReflection(creds: ChannelCredentials): Promise<Promise<protobufjs.Root>[]>;
getRootPromiseFromDescriptorFilePath(): Promise<protobufjs.Root>;
getRootPromiseFromProtoFilePath(): Promise<protobufjs.Root>;
getCachedDescriptorSets(creds: ChannelCredentials): Promise<RootJsonAndDecodedDescriptorSet[]>;
getCredentials(): Promise<ChannelCredentials>;
walkToFindTypePath(rootJson: protobufjs.INamespace, pathWithName: string[], baseTypePath: string[]): string[];
visit({ nested, name, currentPath, rootJson, creds, grpcObject, rootLogger: logger, }: {
nested: AnyNestedObject;
name: string;
currentPath: string[];
rootJson: protobufjs.INamespace;
creds: ChannelCredentials;
grpcObject: ReturnType<typeof loadPackageDefinition>;
rootLogger: Logger;
}): void;
private schemaComposer;
getMeshSource(): Promise<{
schema: import("graphql").GraphQLSchema;
}>;
}
export {};