Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 51 additions & 39 deletions src/type/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,7 @@ export class GraphQLScalarType {
}
}

toConfig(): {|
...GraphQLScalarTypeConfig<mixed, mixed>,
serialize: GraphQLScalarSerializer<mixed>,
parseValue: GraphQLScalarValueParser<mixed>,
parseLiteral: GraphQLScalarLiteralParser<mixed>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<ScalarTypeExtensionNode>,
|} {
toConfig(): GraphQLScalarTypeNormalizedConfig {
return {
name: this.name,
description: this.description,
Expand Down Expand Up @@ -686,6 +679,15 @@ export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
extensionASTNodes?: ?$ReadOnlyArray<ScalarTypeExtensionNode>,
|};

type GraphQLScalarTypeNormalizedConfig = {|
...GraphQLScalarTypeConfig<mixed, mixed>,
serialize: GraphQLScalarSerializer<mixed>,
parseValue: GraphQLScalarValueParser<mixed>,
parseLiteral: GraphQLScalarLiteralParser<mixed>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<ScalarTypeExtensionNode>,
|};

/**
* Object Type Definition
*
Expand Down Expand Up @@ -766,13 +768,7 @@ export class GraphQLObjectType {
return this._interfaces;
}

toConfig(): {|
...GraphQLObjectTypeConfig<any, any>,
interfaces: Array<GraphQLInterfaceType>,
fields: GraphQLFieldConfigMap<any, any>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<ObjectTypeExtensionNode>,
|} {
toConfig(): GraphQLObjectTypeNormalizedConfig {
return {
name: this.name,
description: this.description,
Expand Down Expand Up @@ -924,6 +920,14 @@ export type GraphQLObjectTypeConfig<TSource, TContext> = {|
extensionASTNodes?: ?$ReadOnlyArray<ObjectTypeExtensionNode>,
|};

type GraphQLObjectTypeNormalizedConfig = {|
...GraphQLObjectTypeConfig<any, any>,
interfaces: Array<GraphQLInterfaceType>,
fields: GraphQLFieldConfigMap<any, any>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<ObjectTypeExtensionNode>,
|};

/**
* Note: returning GraphQLObjectType is deprecated and will be removed in v16.0.0
*/
Expand Down Expand Up @@ -1092,13 +1096,7 @@ export class GraphQLInterfaceType {
return this._interfaces;
}

toConfig(): {|
...GraphQLInterfaceTypeConfig<any, any>,
interfaces: Array<GraphQLInterfaceType>,
fields: GraphQLFieldConfigMap<any, any>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<InterfaceTypeExtensionNode>,
|} {
toConfig(): GraphQLInterfaceTypeNormalizedConfig {
return {
name: this.name,
description: this.description,
Expand Down Expand Up @@ -1144,6 +1142,14 @@ export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
extensionASTNodes?: ?$ReadOnlyArray<InterfaceTypeExtensionNode>,
|};

export type GraphQLInterfaceTypeNormalizedConfig = {|
...GraphQLInterfaceTypeConfig<any, any>,
interfaces: Array<GraphQLInterfaceType>,
fields: GraphQLFieldConfigMap<any, any>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<InterfaceTypeExtensionNode>,
|};

/**
* Union Type Definition
*
Expand Down Expand Up @@ -1201,12 +1207,7 @@ export class GraphQLUnionType {
return this._types;
}

toConfig(): {|
...GraphQLUnionTypeConfig<any, any>,
types: Array<GraphQLObjectType>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<UnionTypeExtensionNode>,
|} {
toConfig(): GraphQLUnionTypeNormalizedConfig {
return {
name: this.name,
description: this.description,
Expand Down Expand Up @@ -1261,6 +1262,13 @@ export type GraphQLUnionTypeConfig<TSource, TContext> = {|
extensionASTNodes?: ?$ReadOnlyArray<UnionTypeExtensionNode>,
|};

type GraphQLUnionTypeNormalizedConfig = {|
...GraphQLUnionTypeConfig<any, any>,
types: Array<GraphQLObjectType>,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<UnionTypeExtensionNode>,
|};

/**
* Enum Type Definition
*
Expand Down Expand Up @@ -1369,11 +1377,7 @@ export class GraphQLEnumType /* <T> */ {
return enumValue.value;
}

toConfig(): {|
...GraphQLEnumTypeConfig,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<EnumTypeExtensionNode>,
|} {
toConfig(): GraphQLEnumTypeNormalizedConfig {
const values = keyValMap(
this.getValues(),
(value) => value.name,
Expand Down Expand Up @@ -1462,6 +1466,12 @@ export type GraphQLEnumTypeConfig /* <T> */ = {|
extensionASTNodes?: ?$ReadOnlyArray<EnumTypeExtensionNode>,
|};

type GraphQLEnumTypeNormalizedConfig = {|
...GraphQLEnumTypeConfig,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<EnumTypeExtensionNode>,
|};

export type GraphQLEnumValueConfigMap /* <T> */ = ObjMap<GraphQLEnumValueConfig /* <T> */>;

export type GraphQLEnumValueConfig /* <T> */ = {|
Expand Down Expand Up @@ -1531,12 +1541,7 @@ export class GraphQLInputObjectType {
return this._fields;
}

toConfig(): {|
...GraphQLInputObjectTypeConfig,
fields: GraphQLInputFieldConfigMap,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<InputObjectTypeExtensionNode>,
|} {
toConfig(): GraphQLInputObjectTypeNormalizedConfig {
const fields = mapValue(this.getFields(), (field) => ({
description: field.description,
type: field.type,
Expand Down Expand Up @@ -1607,6 +1612,13 @@ export type GraphQLInputObjectTypeConfig = {|
extensionASTNodes?: ?$ReadOnlyArray<InputObjectTypeExtensionNode>,
|};

type GraphQLInputObjectTypeNormalizedConfig = {|
...GraphQLInputObjectTypeConfig,
fields: GraphQLInputFieldConfigMap,
extensions: ?ReadOnlyObjMap<mixed>,
extensionASTNodes: $ReadOnlyArray<InputObjectTypeExtensionNode>,
|};

export type GraphQLInputFieldConfig = {|
description?: ?string,
type: GraphQLInputType,
Expand Down
14 changes: 8 additions & 6 deletions src/type/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@ export class GraphQLDirective {
}));
}

toConfig(): {|
...GraphQLDirectiveConfig,
args: GraphQLFieldConfigArgumentMap,
isRepeatable: boolean,
extensions: ?ReadOnlyObjMap<mixed>,
|} {
toConfig(): GraphQLDirectiveNormalizedConfig {
return {
name: this.name,
description: this.description,
Expand Down Expand Up @@ -128,6 +123,13 @@ export type GraphQLDirectiveConfig = {|
astNode?: ?DirectiveDefinitionNode,
|};

type GraphQLDirectiveNormalizedConfig = {|
...GraphQLDirectiveConfig,
args: GraphQLFieldConfigArgumentMap,
isRepeatable: boolean,
extensions: ?ReadOnlyObjMap<mixed>,
|};

/**
* Used to conditionally include fields or fragments.
*/
Expand Down