@graphql-codegen/visitor-plugin-common 8.0.0 → 8.0.2
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.
|
@@ -200,9 +200,13 @@ class BaseResolversVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
200
200
|
const isExternalFile = !!this.config.enumValues[typeName].sourceFile;
|
|
201
201
|
prev[typeName] = isExternalFile
|
|
202
202
|
? this.config.enumValues[typeName].typeIdentifierConverted
|
|
203
|
-
: // `sourceIdentifier` is `null` when `enumValues` maps this enum with an object
|
|
204
|
-
//
|
|
205
|
-
|
|
203
|
+
: // `sourceIdentifier` is `null` when `enumValues` maps this enum with an object. The
|
|
204
|
+
// typescript plugin still generates the enum then, so use the name it gives it.
|
|
205
|
+
(this.config.enumValues[typeName].sourceIdentifier ??
|
|
206
|
+
this.convertName(typeName, {
|
|
207
|
+
useTypesPrefix: this.config.enumPrefix,
|
|
208
|
+
useTypesSuffix: this.config.enumSuffix,
|
|
209
|
+
}, true));
|
|
206
210
|
}
|
|
207
211
|
else if (defaultMapperType && !hasPlaceholder(defaultMapperType)) {
|
|
208
212
|
prev[typeName] = applyWrapper(defaultMapperType);
|
|
@@ -80,6 +80,7 @@ const convertSchemaEnumToDeclarationBlockString = ({ schema, node, enumName, enu
|
|
|
80
80
|
options: {
|
|
81
81
|
typesPrefix: naming.options.typesPrefix,
|
|
82
82
|
typesSuffix: naming.options.typesSuffix,
|
|
83
|
+
useTypesPrefix: false,
|
|
83
84
|
},
|
|
84
85
|
convert: () => naming.convert(enumOption, {
|
|
85
86
|
transformUnderscore: true,
|
|
@@ -196,9 +196,13 @@ export class BaseResolversVisitor extends BaseVisitor {
|
|
|
196
196
|
const isExternalFile = !!this.config.enumValues[typeName].sourceFile;
|
|
197
197
|
prev[typeName] = isExternalFile
|
|
198
198
|
? this.config.enumValues[typeName].typeIdentifierConverted
|
|
199
|
-
: // `sourceIdentifier` is `null` when `enumValues` maps this enum with an object
|
|
200
|
-
//
|
|
201
|
-
|
|
199
|
+
: // `sourceIdentifier` is `null` when `enumValues` maps this enum with an object. The
|
|
200
|
+
// typescript plugin still generates the enum then, so use the name it gives it.
|
|
201
|
+
(this.config.enumValues[typeName].sourceIdentifier ??
|
|
202
|
+
this.convertName(typeName, {
|
|
203
|
+
useTypesPrefix: this.config.enumPrefix,
|
|
204
|
+
useTypesSuffix: this.config.enumSuffix,
|
|
205
|
+
}, true));
|
|
202
206
|
}
|
|
203
207
|
else if (defaultMapperType && !hasPlaceholder(defaultMapperType)) {
|
|
204
208
|
prev[typeName] = applyWrapper(defaultMapperType);
|
|
@@ -77,6 +77,7 @@ export const convertSchemaEnumToDeclarationBlockString = ({ schema, node, enumNa
|
|
|
77
77
|
options: {
|
|
78
78
|
typesPrefix: naming.options.typesPrefix,
|
|
79
79
|
typesSuffix: naming.options.typesSuffix,
|
|
80
|
+
useTypesPrefix: false,
|
|
80
81
|
},
|
|
81
82
|
convert: () => naming.convert(enumOption, {
|
|
82
83
|
transformUnderscore: true,
|