diff --git a/node_modules/@graphql-tools/delegate/esm/prepareGatewayDocument.js b/node_modules/@graphql-tools/delegate/esm/prepareGatewayDocument.js index 4356899..0b39047 100644 --- a/node_modules/@graphql-tools/delegate/esm/prepareGatewayDocument.js +++ b/node_modules/@graphql-tools/delegate/esm/prepareGatewayDocument.js @@ -7,59 +7,7 @@ export function prepareGatewayDocument(originalDocument, transformedSchema, retu if (infoSchema == null) { return wrappedConcreteTypesDocument; } - const visitedSelections = new WeakSet(); - wrappedConcreteTypesDocument = visit(wrappedConcreteTypesDocument, { - [Kind.SELECTION_SET](node) { - const newSelections = []; - for (const selectionNode of node.selections) { - if (selectionNode.kind === Kind.INLINE_FRAGMENT && - selectionNode.typeCondition != null && - !visitedSelections.has(selectionNode)) { - visitedSelections.add(selectionNode); - const typeName = selectionNode.typeCondition.name.value; - const type = infoSchema.getType(typeName); - if (isAbstractType(type)) { - const possibleTypes = infoSchema.getPossibleTypes(type); - for (const possibleType of possibleTypes) { - newSelections.push({ - ...selectionNode, - typeCondition: { - kind: Kind.NAMED_TYPE, - name: { - kind: Kind.NAME, - value: possibleType.name, - }, - }, - }); - } - } - const typeInSubschema = transformedSchema.getType(typeName); - if (!typeInSubschema) { - for (const selection of selectionNode.selectionSet.selections) { - newSelections.push(selection); - } - } - if (typeInSubschema && 'getFields' in typeInSubschema) { - const fieldMap = typeInSubschema.getFields(); - for (const selection of selectionNode.selectionSet.selections) { - if (selection.kind === Kind.FIELD) { - const fieldName = selection.name.value; - const field = fieldMap[fieldName]; - if (!field) { - newSelections.push(selection); - } - } - } - } - } - newSelections.push(selectionNode); - } - return { - ...node, - selections: newSelections, - }; - }, - }); + const { possibleTypesMap, reversePossibleTypesMap, interfaceExtensionsMap, fieldNodesByType, fieldNodesByField, dynamicSelectionSetsByField, } = getSchemaMetaData(infoSchema, transformedSchema); const { operations, fragments, fragmentNames } = getDocumentMetadata(wrappedConcreteTypesDocument); const { expandedFragments, fragmentReplacements } = getExpandedFragments(fragments, fragmentNames, possibleTypesMap);