graphql-jerky 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib.cjs +23 -0
- package/build/lib.mjs +23 -0
- package/package.json +1 -1
package/build/lib.cjs
CHANGED
|
@@ -863,6 +863,27 @@ class GeneratorContext {
|
|
|
863
863
|
.block(jen.return(jen.id("v").in.add(this._renderGraphQLTypeType(type)))),
|
|
864
864
|
];
|
|
865
865
|
}
|
|
866
|
+
_getGraphQLTypeClass(type) {
|
|
867
|
+
if (type instanceof graphql.GraphQLObjectType) {
|
|
868
|
+
return 'GraphQLObjectType';
|
|
869
|
+
}
|
|
870
|
+
if (type instanceof graphql.GraphQLScalarType) {
|
|
871
|
+
return 'GraphQLScalarType';
|
|
872
|
+
}
|
|
873
|
+
if (type instanceof graphql.GraphQLInterfaceType) {
|
|
874
|
+
return 'GraphQLInterfaceType';
|
|
875
|
+
}
|
|
876
|
+
if (type instanceof graphql.GraphQLUnionType) {
|
|
877
|
+
return 'GraphQLUnionType';
|
|
878
|
+
}
|
|
879
|
+
if (type instanceof graphql.GraphQLInputObjectType) {
|
|
880
|
+
return 'GraphQLInputObjectType';
|
|
881
|
+
}
|
|
882
|
+
if (type instanceof graphql.GraphQLEnumType) {
|
|
883
|
+
return 'GraphQLEnumType';
|
|
884
|
+
}
|
|
885
|
+
throw new Error(`unhandled type: ${type.toString()}`);
|
|
886
|
+
}
|
|
866
887
|
_getRenderDefintionFnForType(type) {
|
|
867
888
|
if (type instanceof graphql.GraphQLObjectType) {
|
|
868
889
|
return this._renderGraphQLObjectTypeDefinition.bind(this, type);
|
|
@@ -908,6 +929,8 @@ class GeneratorContext {
|
|
|
908
929
|
_renderGraphQLTypeDefinitions(type, interfaces, inputFieldDirectives, includeAstNodes) {
|
|
909
930
|
return jen.const
|
|
910
931
|
.add(this._renderGraphQLTypeIdentifier(type))
|
|
932
|
+
.op(":")
|
|
933
|
+
.id(this._getGraphQLTypeClass(type))
|
|
911
934
|
.op("=")
|
|
912
935
|
.add(this._getRenderDefintionFnForType(type)({
|
|
913
936
|
implementors: interfaces[type.name],
|
package/build/lib.mjs
CHANGED
|
@@ -861,6 +861,27 @@ class GeneratorContext {
|
|
|
861
861
|
.block(jen$1.return(jen$1.id("v").in.add(this._renderGraphQLTypeType(type)))),
|
|
862
862
|
];
|
|
863
863
|
}
|
|
864
|
+
_getGraphQLTypeClass(type) {
|
|
865
|
+
if (type instanceof GraphQLObjectType) {
|
|
866
|
+
return 'GraphQLObjectType';
|
|
867
|
+
}
|
|
868
|
+
if (type instanceof GraphQLScalarType) {
|
|
869
|
+
return 'GraphQLScalarType';
|
|
870
|
+
}
|
|
871
|
+
if (type instanceof GraphQLInterfaceType) {
|
|
872
|
+
return 'GraphQLInterfaceType';
|
|
873
|
+
}
|
|
874
|
+
if (type instanceof GraphQLUnionType) {
|
|
875
|
+
return 'GraphQLUnionType';
|
|
876
|
+
}
|
|
877
|
+
if (type instanceof GraphQLInputObjectType) {
|
|
878
|
+
return 'GraphQLInputObjectType';
|
|
879
|
+
}
|
|
880
|
+
if (type instanceof GraphQLEnumType) {
|
|
881
|
+
return 'GraphQLEnumType';
|
|
882
|
+
}
|
|
883
|
+
throw new Error(`unhandled type: ${type.toString()}`);
|
|
884
|
+
}
|
|
864
885
|
_getRenderDefintionFnForType(type) {
|
|
865
886
|
if (type instanceof GraphQLObjectType) {
|
|
866
887
|
return this._renderGraphQLObjectTypeDefinition.bind(this, type);
|
|
@@ -906,6 +927,8 @@ class GeneratorContext {
|
|
|
906
927
|
_renderGraphQLTypeDefinitions(type, interfaces, inputFieldDirectives, includeAstNodes) {
|
|
907
928
|
return jen$1.const
|
|
908
929
|
.add(this._renderGraphQLTypeIdentifier(type))
|
|
930
|
+
.op(":")
|
|
931
|
+
.id(this._getGraphQLTypeClass(type))
|
|
909
932
|
.op("=")
|
|
910
933
|
.add(this._getRenderDefintionFnForType(type)({
|
|
911
934
|
implementors: interfaces[type.name],
|