UNPKG

graphql-join

Version:

Join types together in your schema declaratively with SDL.

30 lines (29 loc) 1.53 kB
import { FieldNode, GraphQLSchema, SelectionNode } from 'graphql'; import { batchDelegateToSchema } from '@graphql-tools/batch-delegate'; import { delegateToSchema, Transform } from '@graphql-tools/delegate'; import { stitchSchemas } from '@graphql-tools/stitch'; export interface GraphQLJoinConfig { typeDefs: string; resolvers: { [type: string]: { [field: string]: string; }; }; graphqlTools?: { batchDelegateToSchema?: typeof batchDelegateToSchema; delegateToSchema?: typeof delegateToSchema; stitchSchemas?: typeof stitchSchemas; }; } export default class GraphQLJoinTransform implements Transform { private config; constructor(config: GraphQLJoinConfig); transformSchema(originalSchema: GraphQLSchema): GraphQLSchema; private getResolvers; private createUnbatchedFieldResolver; private createBatchedFieldResolver; } export declare function createParentSelectionSet(queryFieldNode: FieldNode): string | undefined; export declare function createChildSelectionSet(queryFieldNode: FieldNode): readonly SelectionNode[]; export declare function createArgsFromKeysFunction(queryFieldNode: FieldNode, userArgs: Record<string, unknown>, batched: boolean): (parents: readonly unknown[]) => any; export declare function mapChildrenToParents(children: readonly Record<string, unknown>[], parents: readonly Record<string, unknown>[], queryFieldNode: FieldNode, toManyRelation: boolean): (Record<string, unknown> | Record<string, unknown>[])[];