@graphql-codegen/visitor-plugin-common 6.2.0-alpha-20251119131248-4aa0bce27decc294509fae591f5c2236858abdbb → 6.2.0
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.
|
@@ -175,15 +175,17 @@ class BaseResolversVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
175
175
|
const isMapped = this.config.mappers[typeName];
|
|
176
176
|
const isScalar = this.config.scalars[typeName];
|
|
177
177
|
const hasDefaultMapper = !!this.config.defaultMapper?.type;
|
|
178
|
-
|
|
179
|
-
prev[typeName] = applyWrapper(this.config.rootValueType.type);
|
|
180
|
-
return prev;
|
|
181
|
-
}
|
|
178
|
+
// Check for mappers first, even for root types, to allow overriding rootValueType
|
|
182
179
|
if (isMapped && this.config.mappers[typeName].type && !hasPlaceholder(this.config.mappers[typeName].type)) {
|
|
183
180
|
this.markMapperAsUsed(typeName);
|
|
184
181
|
prev[typeName] = applyWrapper(this.config.mappers[typeName].type);
|
|
182
|
+
return prev;
|
|
183
|
+
}
|
|
184
|
+
if (isRootType) {
|
|
185
|
+
prev[typeName] = applyWrapper(this.config.rootValueType.type);
|
|
186
|
+
return prev;
|
|
185
187
|
}
|
|
186
|
-
|
|
188
|
+
if ((0, graphql_1.isEnumType)(schemaType) && this.config.enumValues[typeName]) {
|
|
187
189
|
const isExternalFile = !!this.config.enumValues[typeName].sourceFile;
|
|
188
190
|
prev[typeName] = isExternalFile
|
|
189
191
|
? this.convertName(this.config.enumValues[typeName].typeIdentifier, {
|
|
@@ -171,15 +171,17 @@ export class BaseResolversVisitor extends BaseVisitor {
|
|
|
171
171
|
const isMapped = this.config.mappers[typeName];
|
|
172
172
|
const isScalar = this.config.scalars[typeName];
|
|
173
173
|
const hasDefaultMapper = !!this.config.defaultMapper?.type;
|
|
174
|
-
|
|
175
|
-
prev[typeName] = applyWrapper(this.config.rootValueType.type);
|
|
176
|
-
return prev;
|
|
177
|
-
}
|
|
174
|
+
// Check for mappers first, even for root types, to allow overriding rootValueType
|
|
178
175
|
if (isMapped && this.config.mappers[typeName].type && !hasPlaceholder(this.config.mappers[typeName].type)) {
|
|
179
176
|
this.markMapperAsUsed(typeName);
|
|
180
177
|
prev[typeName] = applyWrapper(this.config.mappers[typeName].type);
|
|
178
|
+
return prev;
|
|
179
|
+
}
|
|
180
|
+
if (isRootType) {
|
|
181
|
+
prev[typeName] = applyWrapper(this.config.rootValueType.type);
|
|
182
|
+
return prev;
|
|
181
183
|
}
|
|
182
|
-
|
|
184
|
+
if (isEnumType(schemaType) && this.config.enumValues[typeName]) {
|
|
183
185
|
const isExternalFile = !!this.config.enumValues[typeName].sourceFile;
|
|
184
186
|
prev[typeName] = isExternalFile
|
|
185
187
|
? this.convertName(this.config.enumValues[typeName].typeIdentifier, {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/visitor-plugin-common",
|
|
3
|
-
"version": "6.2.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@graphql-tools/optimize": "^2.0.0",
|
|
9
|
-
"@graphql-codegen/plugin-helpers": "6.1.0
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^6.1.0",
|
|
10
10
|
"@graphql-tools/relay-operation-optimizer": "^7.0.0",
|
|
11
11
|
"@graphql-tools/utils": "^10.0.0",
|
|
12
12
|
"auto-bind": "~4.0.0",
|