Skip to content

Commit

Permalink
Simplify API
Browse files Browse the repository at this point in the history
  • Loading branch information
freiksenet committed Dec 19, 2017
1 parent c758e03 commit 2e2c9b1
Show file tree
Hide file tree
Showing 6 changed files with 549 additions and 280 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-tools",
"version": "2.14.0",
"version": "2.15.0-alpha.1",
"description": "Useful tools to create and manipulate GraphQL schemas.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
23 changes: 23 additions & 0 deletions src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
GraphQLIsTypeOfFn,
GraphQLTypeResolver,
GraphQLScalarType,
GraphQLNamedType,
DocumentNode,
} from 'graphql';

Expand All @@ -29,12 +30,14 @@ export interface IResolverOptions {

export type MergeInfo = {
delegate: (
schemaName: string,
type: 'query' | 'mutation' | 'subscription',
fieldName: string,
args: { [key: string]: any },
context: { [key: string]: any },
info: GraphQLResolveInfo,
) => any;
getSubSchema: (schemaName: string) => GraphQLSchema;
};

export type IFieldResolver<TSource, TContext> = (
Expand Down Expand Up @@ -119,3 +122,23 @@ export interface IMockServer {
vars?: { [key: string]: any },
) => Promise<ExecutionResult>;
}

export type MergeTypeCandidate = {
schemaName: string;
schema?: GraphQLSchema;
type: GraphQLNamedType;
};

export type TypeWithResolvers = {
type: GraphQLNamedType;
resolvers?: IResolvers;
};

export type VisitTypeResult = GraphQLNamedType | TypeWithResolvers | null;

export type VisitType = (
name: string,
candidates: Array<MergeTypeCandidate>,
) => VisitTypeResult;

export type ResolveType<T extends GraphQLType> = (type: T) => T;
Loading

0 comments on commit 2e2c9b1

Please sign in to comment.