apollo-codegen-typescript
Advanced tools
Comparing version 0.35.1 to 0.35.2
@@ -16,3 +16,2 @@ "use strict"; | ||
const common_tags_1 = require("common-tags"); | ||
const graphql_1 = require("graphql"); | ||
const typeCase_1 = require("apollo-codegen-core/lib/compiler/visitors/typeCase"); | ||
@@ -24,3 +23,3 @@ const collectAndMergeFields_1 = require("apollo-codegen-core/lib/compiler/visitors/collectAndMergeFields"); | ||
const definition_1 = require("graphql/type/definition"); | ||
const graphql_2 = require("graphql"); | ||
const graphql_1 = require("graphql"); | ||
const array_1 = require("apollo-codegen-core/lib/utilities/array"); | ||
@@ -43,3 +42,3 @@ const printing_1 = require("apollo-codegen-core/lib/utilities/printing"); | ||
typesUsed | ||
.filter(type => type instanceof graphql_1.GraphQLEnumType) | ||
.filter(definition_1.isEnumType) | ||
.sort() | ||
@@ -50,3 +49,3 @@ .forEach(enumType => { | ||
typesUsed | ||
.filter(type => type instanceof graphql_1.GraphQLInputObjectType) | ||
.filter(definition_1.isInputObjectType) | ||
.sort() | ||
@@ -171,7 +170,7 @@ .forEach(inputObjectType => { | ||
this.isGlobalType = (type) => { | ||
return (type instanceof graphql_1.GraphQLEnumType || type instanceof graphql_1.GraphQLInputObjectType); | ||
return definition_1.isEnumType(type) || definition_1.isInputObjectType(type); | ||
}; | ||
this.getUnderlyingType = (type) => { | ||
if (type instanceof graphql_2.GraphQLNonNull) { | ||
return this.getUnderlyingType(graphql_2.getNullableType(type)); | ||
if (definition_1.isNonNullType(type)) { | ||
return this.getUnderlyingType(graphql_1.getNullableType(type)); | ||
} | ||
@@ -184,4 +183,4 @@ if (definition_1.isListType(type)) { | ||
this.reduceTypesUsed = (acc, type) => { | ||
if (type instanceof graphql_2.GraphQLNonNull) { | ||
type = graphql_2.getNullableType(type); | ||
if (definition_1.isNonNullType(type)) { | ||
type = graphql_1.getNullableType(type); | ||
} | ||
@@ -191,4 +190,3 @@ if (definition_1.isListType(type)) { | ||
} | ||
if (type instanceof graphql_1.GraphQLInputObjectType || | ||
type instanceof graphql_2.GraphQLObjectType) { | ||
if (definition_1.isInputObjectType(type) || definition_1.isObjectType(type)) { | ||
acc = array_1.maybePush(acc, type); | ||
@@ -195,0 +193,0 @@ const fields = type.getFields(); |
@@ -32,3 +32,3 @@ "use strict"; | ||
} | ||
else if (graphQLType instanceof graphql_1.GraphQLScalarType) { | ||
else if (graphql_1.isScalarType(graphQLType)) { | ||
const builtIn = builtInScalarMap[typeName || graphQLType.name]; | ||
@@ -35,0 +35,0 @@ if (builtIn != null) { |
{ | ||
"name": "apollo-codegen-typescript", | ||
"description": "TypeScript generator module for Apollo Codegen", | ||
"version": "0.35.1", | ||
"version": "0.35.2", | ||
"author": "Apollo GraphQL <opensource@apollographql.com>", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
"@babel/types": "7.6.1", | ||
"apollo-codegen-core": "^0.35.1", | ||
"apollo-codegen-core": "^0.35.2", | ||
"apollo-env": "^0.5.1", | ||
@@ -59,3 +59,3 @@ "change-case": "^3.0.1", | ||
}, | ||
"gitHead": "ad937df63ff8655eed6a4e632a398fa6d724986d" | ||
"gitHead": "ee51af0a82027104fbcd95c3effb810c89a43566" | ||
} |
@@ -28,9 +28,11 @@ import path from "path"; | ||
import { DEFAULT_FILE_EXTENSION } from "./helpers"; | ||
import { GraphQLType, isListType } from "graphql/type/definition"; | ||
import { | ||
GraphQLNonNull, | ||
GraphQLOutputType, | ||
getNullableType, | ||
GraphQLObjectType | ||
} from "graphql"; | ||
GraphQLType, | ||
isListType, | ||
isObjectType, | ||
isNonNullType, | ||
isEnumType, | ||
isInputObjectType | ||
} from "graphql/type/definition"; | ||
import { GraphQLOutputType, getNullableType } from "graphql"; | ||
import { maybePush } from "apollo-codegen-core/lib/utilities/array"; | ||
@@ -61,15 +63,13 @@ import { unifyPaths } from "apollo-codegen-core/lib/utilities/printing"; | ||
typesUsed | ||
.filter(type => type instanceof GraphQLEnumType) | ||
.filter(isEnumType) | ||
.sort() | ||
.forEach(enumType => { | ||
generator.typeAliasForEnumType(enumType as GraphQLEnumType); | ||
generator.typeAliasForEnumType(enumType); | ||
}); | ||
typesUsed | ||
.filter(type => type instanceof GraphQLInputObjectType) | ||
.filter(isInputObjectType) | ||
.sort() | ||
.forEach(inputObjectType => { | ||
generator.typeAliasForInputObjectType( | ||
inputObjectType as GraphQLInputObjectType | ||
); | ||
generator.typeAliasForInputObjectType(inputObjectType); | ||
}); | ||
@@ -393,9 +393,7 @@ | ||
private isGlobalType = (type: GraphQLType) => { | ||
return ( | ||
type instanceof GraphQLEnumType || type instanceof GraphQLInputObjectType | ||
); | ||
return isEnumType(type) || isInputObjectType(type); | ||
}; | ||
private getUnderlyingType = (type: GraphQLType): GraphQLType => { | ||
if (type instanceof GraphQLNonNull) { | ||
if (isNonNullType(type)) { | ||
return this.getUnderlyingType(getNullableType(type)); | ||
@@ -463,3 +461,3 @@ } | ||
) => { | ||
if (type instanceof GraphQLNonNull) { | ||
if (isNonNullType(type)) { | ||
type = getNullableType(type); | ||
@@ -472,6 +470,3 @@ } | ||
if ( | ||
type instanceof GraphQLInputObjectType || | ||
type instanceof GraphQLObjectType | ||
) { | ||
if (isInputObjectType(type) || isObjectType(type)) { | ||
acc = maybePush(acc, type); | ||
@@ -478,0 +473,0 @@ const fields = type.getFields(); |
@@ -6,7 +6,7 @@ import { | ||
GraphQLID, | ||
GraphQLScalarType, | ||
GraphQLString, | ||
GraphQLType, | ||
isListType, | ||
isNonNullType | ||
isNonNullType, | ||
isScalarType | ||
} from "graphql"; | ||
@@ -50,3 +50,3 @@ | ||
); | ||
} else if (graphQLType instanceof GraphQLScalarType) { | ||
} else if (isScalarType(graphQLType)) { | ||
const builtIn = builtInScalarMap[typeName || graphQLType.name]; | ||
@@ -53,0 +53,0 @@ if (builtIn != null) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
346581
2416
Updatedapollo-codegen-core@^0.35.2