@graphql-tools/delegate 8.2.3 → 8.3.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.
- package/index.js +13 -11
- package/index.mjs +13 -11
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -396,12 +396,13 @@ function finalizeGatewayDocument(targetSchema, fragments, operations) {
|
|
|
396
396
|
selectionSet,
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
|
+
const newDocument = {
|
|
400
|
+
kind: graphql.Kind.DOCUMENT,
|
|
401
|
+
definitions: [...newOperations, ...newFragments],
|
|
402
|
+
};
|
|
399
403
|
return {
|
|
400
404
|
usedVariables,
|
|
401
|
-
newDocument
|
|
402
|
-
kind: graphql.Kind.DOCUMENT,
|
|
403
|
-
definitions: [...newOperations, ...newFragments],
|
|
404
|
-
},
|
|
405
|
+
newDocument,
|
|
405
406
|
};
|
|
406
407
|
}
|
|
407
408
|
function finalizeGatewayRequest(originalRequest, delegationContext) {
|
|
@@ -438,7 +439,7 @@ function addVariablesToRootFields(targetSchema, operations, args) {
|
|
|
438
439
|
[def.variable.name.value]: def,
|
|
439
440
|
}), {});
|
|
440
441
|
const type = utils.getDefinedRootType(targetSchema, operation.operation);
|
|
441
|
-
const
|
|
442
|
+
const newSelections = [];
|
|
442
443
|
for (const selection of operation.selectionSet.selections) {
|
|
443
444
|
if (selection.kind === graphql.Kind.FIELD) {
|
|
444
445
|
const argumentNodes = (_b = selection.arguments) !== null && _b !== void 0 ? _b : [];
|
|
@@ -451,22 +452,23 @@ function addVariablesToRootFields(targetSchema, operations, args) {
|
|
|
451
452
|
if (targetField != null) {
|
|
452
453
|
updateArguments(targetField, argumentNodeMap, variableDefinitionMap, newVariables, args);
|
|
453
454
|
}
|
|
454
|
-
|
|
455
|
+
newSelections.push({
|
|
455
456
|
...selection,
|
|
456
457
|
arguments: Object.values(argumentNodeMap),
|
|
457
458
|
});
|
|
458
459
|
}
|
|
459
460
|
else {
|
|
460
|
-
|
|
461
|
+
newSelections.push(selection);
|
|
461
462
|
}
|
|
462
463
|
}
|
|
464
|
+
const newSelectionSet = {
|
|
465
|
+
kind: graphql.Kind.SELECTION_SET,
|
|
466
|
+
selections: newSelections,
|
|
467
|
+
};
|
|
463
468
|
return {
|
|
464
469
|
...operation,
|
|
465
470
|
variableDefinitions: Object.values(variableDefinitionMap),
|
|
466
|
-
selectionSet:
|
|
467
|
-
kind: graphql.Kind.SELECTION_SET,
|
|
468
|
-
selections: newSelectionSet,
|
|
469
|
-
},
|
|
471
|
+
selectionSet: newSelectionSet,
|
|
470
472
|
};
|
|
471
473
|
});
|
|
472
474
|
return {
|
package/index.mjs
CHANGED
|
@@ -392,12 +392,13 @@ function finalizeGatewayDocument(targetSchema, fragments, operations) {
|
|
|
392
392
|
selectionSet,
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
|
+
const newDocument = {
|
|
396
|
+
kind: Kind.DOCUMENT,
|
|
397
|
+
definitions: [...newOperations, ...newFragments],
|
|
398
|
+
};
|
|
395
399
|
return {
|
|
396
400
|
usedVariables,
|
|
397
|
-
newDocument
|
|
398
|
-
kind: Kind.DOCUMENT,
|
|
399
|
-
definitions: [...newOperations, ...newFragments],
|
|
400
|
-
},
|
|
401
|
+
newDocument,
|
|
401
402
|
};
|
|
402
403
|
}
|
|
403
404
|
function finalizeGatewayRequest(originalRequest, delegationContext) {
|
|
@@ -434,7 +435,7 @@ function addVariablesToRootFields(targetSchema, operations, args) {
|
|
|
434
435
|
[def.variable.name.value]: def,
|
|
435
436
|
}), {});
|
|
436
437
|
const type = getDefinedRootType(targetSchema, operation.operation);
|
|
437
|
-
const
|
|
438
|
+
const newSelections = [];
|
|
438
439
|
for (const selection of operation.selectionSet.selections) {
|
|
439
440
|
if (selection.kind === Kind.FIELD) {
|
|
440
441
|
const argumentNodes = (_b = selection.arguments) !== null && _b !== void 0 ? _b : [];
|
|
@@ -447,22 +448,23 @@ function addVariablesToRootFields(targetSchema, operations, args) {
|
|
|
447
448
|
if (targetField != null) {
|
|
448
449
|
updateArguments(targetField, argumentNodeMap, variableDefinitionMap, newVariables, args);
|
|
449
450
|
}
|
|
450
|
-
|
|
451
|
+
newSelections.push({
|
|
451
452
|
...selection,
|
|
452
453
|
arguments: Object.values(argumentNodeMap),
|
|
453
454
|
});
|
|
454
455
|
}
|
|
455
456
|
else {
|
|
456
|
-
|
|
457
|
+
newSelections.push(selection);
|
|
457
458
|
}
|
|
458
459
|
}
|
|
460
|
+
const newSelectionSet = {
|
|
461
|
+
kind: Kind.SELECTION_SET,
|
|
462
|
+
selections: newSelections,
|
|
463
|
+
};
|
|
459
464
|
return {
|
|
460
465
|
...operation,
|
|
461
466
|
variableDefinitions: Object.values(variableDefinitionMap),
|
|
462
|
-
selectionSet:
|
|
463
|
-
kind: Kind.SELECTION_SET,
|
|
464
|
-
selections: newSelectionSet,
|
|
465
|
-
},
|
|
467
|
+
selectionSet: newSelectionSet,
|
|
466
468
|
};
|
|
467
469
|
});
|
|
468
470
|
return {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/delegate",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
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"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/batch-execute": "^8.
|
|
11
|
-
"@graphql-tools/schema": "^8.
|
|
12
|
-
"@graphql-tools/utils": "^8.
|
|
10
|
+
"@graphql-tools/batch-execute": "^8.2.0",
|
|
11
|
+
"@graphql-tools/schema": "^8.3.0",
|
|
12
|
+
"@graphql-tools/utils": "^8.4.0",
|
|
13
13
|
"dataloader": "2.0.0",
|
|
14
14
|
"tslib": "~2.3.0",
|
|
15
15
|
"value-or-promise": "1.0.11"
|