Skip to content

Commit

Permalink
export a bunch of definition types and predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Jul 31, 2015
1 parent aa5902c commit aefa033
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 23 deletions.
36 changes: 18 additions & 18 deletions src/type/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class GraphQLScalarType/*<T>*/ {
}
}

type GraphQLScalarTypeConfig/*<T>*/ = {
export type GraphQLScalarTypeConfig/*<T>*/ = {
name: string;
description?: ?string;
coerce: (value: any) => ?any/*T*/;
Expand Down Expand Up @@ -332,7 +332,7 @@ function addImplementationToInterfaces(impl) {
});
}

type GraphQLObjectTypeConfig = {
export type GraphQLObjectTypeConfig = {
name: string;
interfaces?: GraphQLInterfacesThunk | Array<GraphQLInterfaceType>;
fields: GraphQLFieldConfigMapThunk | GraphQLFieldConfigMap;
Expand All @@ -344,7 +344,7 @@ type GraphQLInterfacesThunk = () => Array<GraphQLInterfaceType>;

type GraphQLFieldConfigMapThunk = () => GraphQLFieldConfigMap;

type GraphQLFieldConfig = {
export type GraphQLFieldConfig = {
type: GraphQLOutputType;
args?: GraphQLFieldConfigArgumentMap;
resolve?: (
Expand All @@ -360,16 +360,16 @@ type GraphQLFieldConfig = {
description?: ?string;
}

type GraphQLFieldConfigArgumentMap = {
export type GraphQLFieldConfigArgumentMap = {
[argName: string]: GraphQLArgumentConfig;
};

type GraphQLArgumentConfig = {
export type GraphQLArgumentConfig = {
type: GraphQLInputType;
defaultValue?: any;
}

type GraphQLFieldConfigMap = {
export type GraphQLFieldConfigMap = {
[fieldName: string]: GraphQLFieldConfig;
};

Expand Down Expand Up @@ -397,7 +397,7 @@ export type GraphQLArgument = {
description?: ?string;
};

type GraphQLFieldDefinitionMap = {
export type GraphQLFieldDefinitionMap = {
[fieldName: string]: GraphQLFieldDefinition;
};

Expand Down Expand Up @@ -492,7 +492,7 @@ function getTypeOf(
}
}

type GraphQLInterfaceTypeConfig = {
export type GraphQLInterfaceTypeConfig = {
name: string,
fields: GraphQLFieldConfigMapThunk | GraphQLFieldConfigMap,
/**
Expand Down Expand Up @@ -584,7 +584,7 @@ export class GraphQLUnionType {
}
}

type GraphQLUnionTypeConfig = {
export type GraphQLUnionTypeConfig = {
name: string,
types: Array<GraphQLObjectType>,
/**
Expand Down Expand Up @@ -695,27 +695,27 @@ export class GraphQLEnumType/*<T>*/ {
}
}

type GraphQLEnumTypeConfig/*<T>*/ = {
export type GraphQLEnumTypeConfig/*<T>*/ = {
name: string;
values: GraphQLEnumValueConfigMap/*<T>*/;
description?: ?string;
}

type GraphQLEnumValueConfigMap/*<T>*/ = {
export type GraphQLEnumValueConfigMap/*<T>*/ = {
[valueName: string]: GraphQLEnumValueConfig/*<T>*/;
};

type GraphQLEnumValueConfig/*<T>*/ = {
export type GraphQLEnumValueConfig/*<T>*/ = {
value?: any/*T*/;
deprecationReason?: string;
description?: ?string;
}

type GraphQLEnumValueDefinitionMap/*<T>*/ = {
export type GraphQLEnumValueDefinitionMap/*<T>*/ = {
[valueName: string]: GraphQLEnumValueDefinition/*<T>*/;
};

type GraphQLEnumValueDefinition/*<T>*/ = {
export type GraphQLEnumValueDefinition/*<T>*/ = {
name: string;
value?: any/*T*/;
deprecationReason?: string;
Expand Down Expand Up @@ -777,21 +777,21 @@ export class GraphQLInputObjectType {
}
}

type InputObjectConfig = {
export type InputObjectConfig = {
name: string;
fields: InputObjectConfigFieldMapThunk | InputObjectConfigFieldMap;
description?: ?string;
}

type InputObjectConfigFieldMapThunk = () => InputObjectConfigFieldMap;

type InputObjectFieldConfig = {
export type InputObjectFieldConfig = {
type: GraphQLInputType;
defaultValue?: any;
description?: ?string;
}

type InputObjectConfigFieldMap = {
export type InputObjectConfigFieldMap = {
[fieldName: string]: InputObjectFieldConfig;
};

Expand All @@ -802,7 +802,7 @@ export type InputObjectField = {
description?: ?string;
}

type InputObjectFieldMap = {
export type InputObjectFieldMap = {
[fieldName: string]: InputObjectField;
};

Expand Down
49 changes: 44 additions & 5 deletions src/type/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*@flow*/
/**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
Expand All @@ -7,25 +8,63 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

export {
GraphQLSchema
} from './schema';
// GraphQL Schema definition
export { GraphQLSchema } from './schema';

export {
// Predicates
isInputType,
isOutputType,
isLeafType,
isCompositeType,
isAbstractType,

// Un-modifiers
getNullableType,
getNamedType,

// Definitions
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,
GraphQLEnumType,
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull
GraphQLNonNull,
} from './definition';

// Common built-in scalar instances.
export {
GraphQLInt,
GraphQLFloat,
GraphQLString,
GraphQLBoolean,
GraphQLID
GraphQLID,
} from './scalars';

// Export flow types.

// Note: a future version of flow may support `export type {} from ''`, but
// until then, this is a viable workaround.

// These are unions of the various GraphQL type definitions that are useful
// annotation alongside the GraphQL type predicates.
import type {
GraphQLType,
GraphQLInputType,
GraphQLOutputType,
GraphQLLeafType,
GraphQLCompositeType,
GraphQLAbstractType,
GraphQLNullableType,
GraphQLNamedType,
} from './definition';
export type GraphQLType = GraphQLType;
export type GraphQLInputType = GraphQLInputType;
export type GraphQLOutputType = GraphQLOutputType;
export type GraphQLLeafType = GraphQLLeafType;
export type GraphQLCompositeType = GraphQLCompositeType;
export type GraphQLAbstractType = GraphQLAbstractType;
export type GraphQLNullableType = GraphQLNullableType;
export type GraphQLNamedType = GraphQLNamedType;

0 comments on commit aefa033

Please sign in to comment.