apollo-schema-extend
Version:
Extends your Apollo Server Express based graphql server with an external graphql source
11 lines (10 loc) • 593 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getResolverScopedOperation = void 0;
const ast_1 = require("../ast");
const getResolverScopedOperation = ({ operation, fieldNodes, }) => {
const resolvingFieldNames = fieldNodes.map(node => node.name.value);
const selections = operation.selectionSet.selections.filter(selection => (0, ast_1.isFieldNode)(selection) && resolvingFieldNames.includes(selection.name.value));
return (0, ast_1.withSelections)(operation, selections);
};
exports.getResolverScopedOperation = getResolverScopedOperation;