@graphql-mesh/transform-prefix 0.11.78 → 0.11.79-alpha-20220913111252-29aa4bbf2
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/index.js +12 -0
- package/index.mjs +12 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -83,6 +83,18 @@ class BarePrefix {
|
|
|
83
83
|
}
|
|
84
84
|
return undefined;
|
|
85
85
|
},
|
|
86
|
+
[utils$1.MapperKind.ABSTRACT_TYPE]: (type) => {
|
|
87
|
+
if (this.includeTypes && !graphql.isSpecifiedScalarType(type)) {
|
|
88
|
+
const existingResolver = type.resolveType;
|
|
89
|
+
type.resolveType = (data, context, info, abstractType) => {
|
|
90
|
+
const typeName = existingResolver(data, context, info, abstractType);
|
|
91
|
+
return this.prefix + typeName;
|
|
92
|
+
};
|
|
93
|
+
const currentName = type.name;
|
|
94
|
+
return utils$1.renameType(type, this.prefix + currentName);
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
},
|
|
86
98
|
[utils$1.MapperKind.ROOT_OBJECT]() {
|
|
87
99
|
return undefined;
|
|
88
100
|
},
|
package/index.mjs
CHANGED
|
@@ -81,6 +81,18 @@ class BarePrefix {
|
|
|
81
81
|
}
|
|
82
82
|
return undefined;
|
|
83
83
|
},
|
|
84
|
+
[MapperKind.ABSTRACT_TYPE]: (type) => {
|
|
85
|
+
if (this.includeTypes && !isSpecifiedScalarType(type)) {
|
|
86
|
+
const existingResolver = type.resolveType;
|
|
87
|
+
type.resolveType = (data, context, info, abstractType) => {
|
|
88
|
+
const typeName = existingResolver(data, context, info, abstractType);
|
|
89
|
+
return this.prefix + typeName;
|
|
90
|
+
};
|
|
91
|
+
const currentName = type.name;
|
|
92
|
+
return renameType(type, this.prefix + currentName);
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
},
|
|
84
96
|
[MapperKind.ROOT_OBJECT]() {
|
|
85
97
|
return undefined;
|
|
86
98
|
},
|