UNPKG

@graphql-mesh/grpc

Version:
67 lines (66 loc) 2.75 kB
import { GraphQLFieldResolver, GraphQLSchema } from 'graphql'; import protobufjs, { AnyNestedObject, IParseOptions } from 'protobufjs'; import { GetMeshSourcePayload, Logger, MeshHandler, MeshHandlerOptions, YamlConfig } from '@graphql-mesh/types'; import { ChannelCredentials, loadPackageDefinition } from '@grpc/grpc-js'; import { ServiceClient } from '@grpc/grpc-js/build/src/make-client.js'; import './patchLongJs.js'; interface LoadOptions extends IParseOptions { includeDirs?: string[]; } export default class GrpcHandler implements MeshHandler { private config; private baseDir; private schemaWithAnnotationsProxy; private logger; private pubsub; private fetchFn; private importFn; constructor({ config, baseDir, store, logger, pubsub, importFn, }: MeshHandlerOptions<YamlConfig.GrpcHandler>); processReflection(creds: ChannelCredentials): Promise<Promise<protobufjs.Root>[]>; processDescriptorFile(): Promise<protobufjs.Root>; processProtoFile(): Promise<protobufjs.Root>; getDescriptorSets(creds: ChannelCredentials): Promise<{ name: string; rootJson: protobufjs.INamespace; }[]>; getCredentials(): Promise<ChannelCredentials>; walkToFindTypePath(rootJson: protobufjs.INamespace, pathWithName: string[], baseTypePath: string[]): string[]; getGrpcObject({ rootJson, loadOptions, rootLogger, }: { rootJson: protobufjs.INamespace; loadOptions: LoadOptions; rootLogger: Logger; }): import("@grpc/grpc-js").GrpcObject; private grpcObjectByserviceClientByObjPath; getServiceClient({ grpcObject, objPath, creds, }: { grpcObject: ReturnType<typeof loadPackageDefinition>; objPath: string; creds: ChannelCredentials; }): ServiceClient; getFieldResolver({ client, methodName, isResponseStream, }: { client: ServiceClient; methodName: string; isResponseStream: boolean; }): GraphQLFieldResolver<any, any>; getConnectivityStateResolver({ client, }: { client: ServiceClient; }): GraphQLFieldResolver<any, any>; processDirectives({ schema, creds }: { schema: GraphQLSchema; creds: ChannelCredentials; }): void; visit({ nested, name, currentPath, rootJsonName, rootJson, rootLogger: logger, loadOptions, }: { nested: AnyNestedObject; name: string; currentPath: string[]; rootJsonName: string; rootJson: protobufjs.INamespace; rootLogger: Logger; loadOptions?: LoadOptions; }): void; private schemaComposer; private getCachedNonExecutableSchema; getMeshSource({ fetchFn }: GetMeshSourcePayload): Promise<{ schema: GraphQLSchema; }>; } export {};