@graphql-tools/wrap 9.4.0 → 9.4.1-alpha-20230406062259-3c0a93c4
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.
|
@@ -28,9 +28,9 @@ class MoveRootField {
|
|
|
28
28
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
29
|
const rootTypeMap = (0, utils_1.getRootTypeMap)(schema);
|
|
30
30
|
const newRootFieldsMap = {
|
|
31
|
-
query: ((_b = (_a = rootTypeMap.get(
|
|
32
|
-
mutation: ((_d = (_c = rootTypeMap.get(
|
|
33
|
-
subscription: ((_f = (_e = rootTypeMap.get(
|
|
31
|
+
query: ((_b = (_a = rootTypeMap.get('query')) === null || _a === void 0 ? void 0 : _a.toConfig()) === null || _b === void 0 ? void 0 : _b.fields) || {},
|
|
32
|
+
mutation: ((_d = (_c = rootTypeMap.get('mutation')) === null || _c === void 0 ? void 0 : _c.toConfig()) === null || _d === void 0 ? void 0 : _d.fields) || {},
|
|
33
|
+
subscription: ((_f = (_e = rootTypeMap.get('subscription')) === null || _e === void 0 ? void 0 : _e.toConfig()) === null || _f === void 0 ? void 0 : _f.fields) || {},
|
|
34
34
|
};
|
|
35
35
|
for (const operation in this.from) {
|
|
36
36
|
const removedFields = this.from[operation];
|
|
@@ -91,7 +91,7 @@ class MoveRootField {
|
|
|
91
91
|
if ((_a = result.data) === null || _a === void 0 ? void 0 : _a.__typename) {
|
|
92
92
|
const newOperation = this.to[delegationContext.operation][delegationContext.fieldName];
|
|
93
93
|
if (newOperation && newOperation !== delegationContext.operation) {
|
|
94
|
-
result.data.__typename = (_b = delegationContext.targetSchema
|
|
94
|
+
result.data.__typename = (_b = (0, utils_1.getDefinedRootType)(delegationContext.targetSchema, newOperation)) === null || _b === void 0 ? void 0 : _b.name;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
return result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GraphQLObjectType, GraphQLSchema, Kind,
|
|
2
|
-
import { MapperKind, getRootTypeMap, mapSchema } from '@graphql-tools/utils';
|
|
1
|
+
import { GraphQLObjectType, GraphQLSchema, Kind, visit } from 'graphql';
|
|
2
|
+
import { MapperKind, getDefinedRootType, getRootTypeMap, mapSchema, } from '@graphql-tools/utils';
|
|
3
3
|
const defaultRootTypeNames = {
|
|
4
4
|
query: 'Query',
|
|
5
5
|
mutation: 'Mutation',
|
|
@@ -25,9 +25,9 @@ export class MoveRootField {
|
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
26
|
const rootTypeMap = getRootTypeMap(schema);
|
|
27
27
|
const newRootFieldsMap = {
|
|
28
|
-
query: ((_b = (_a = rootTypeMap.get(
|
|
29
|
-
mutation: ((_d = (_c = rootTypeMap.get(
|
|
30
|
-
subscription: ((_f = (_e = rootTypeMap.get(
|
|
28
|
+
query: ((_b = (_a = rootTypeMap.get('query')) === null || _a === void 0 ? void 0 : _a.toConfig()) === null || _b === void 0 ? void 0 : _b.fields) || {},
|
|
29
|
+
mutation: ((_d = (_c = rootTypeMap.get('mutation')) === null || _c === void 0 ? void 0 : _c.toConfig()) === null || _d === void 0 ? void 0 : _d.fields) || {},
|
|
30
|
+
subscription: ((_f = (_e = rootTypeMap.get('subscription')) === null || _e === void 0 ? void 0 : _e.toConfig()) === null || _f === void 0 ? void 0 : _f.fields) || {},
|
|
31
31
|
};
|
|
32
32
|
for (const operation in this.from) {
|
|
33
33
|
const removedFields = this.from[operation];
|
|
@@ -88,7 +88,7 @@ export class MoveRootField {
|
|
|
88
88
|
if ((_a = result.data) === null || _a === void 0 ? void 0 : _a.__typename) {
|
|
89
89
|
const newOperation = this.to[delegationContext.operation][delegationContext.fieldName];
|
|
90
90
|
if (newOperation && newOperation !== delegationContext.operation) {
|
|
91
|
-
result.data.__typename = (_b = delegationContext.targetSchema
|
|
91
|
+
result.data.__typename = (_b = getDefinedRootType(delegationContext.targetSchema, newOperation)) === null || _b === void 0 ? void 0 : _b.name;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return result;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/wrap",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.1-alpha-20230406062259-3c0a93c4",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/delegate": "9.0.
|
|
10
|
+
"@graphql-tools/delegate": "9.0.30-alpha-20230406062259-3c0a93c4",
|
|
11
11
|
"@graphql-tools/schema": "9.0.17",
|
|
12
12
|
"@graphql-tools/utils": "9.2.1",
|
|
13
13
|
"tslib": "^2.4.0",
|