message: Add code to deal with nested fragments
diff: @@ -253,8 +253,28 @@ export function combineOperationsAndFragments(
  operations.forEach(operation => {
  const completeOperation: Array<
  OperationDefinitionNode | FragmentDefinitionNode
  - > = [operation];
  + > = [
  + operation,
  + ...Object.values(getNestedFragments(operation, fragments, errorLogger))
  + ];
  + fullOperations.push({
  + kind: "Document",
  + definitions: completeOperation
  + });
  + });
  + return fullOperations;
  +}
  +
  +function getNestedFragments(
  + operation: OperationDefinitionNode | FragmentDefinitionNode,
  + fragments: Record<string, FragmentDefinitionNode>,
  + errorLogger?: (message: string) => void
  +) {
  + // Using an object ensures that we only include each fragment definition once.
  + // We are assured that there will be no duplicate fragment names during the
  + // extraction step
  + const combination: Record<string, FragmentDefinitionNode> = {};
  visit(operation, {
  [Kind.FRAGMENT_SPREAD]: node => {
  if (!node.name || node.name.kind !== "Name") {
  @@ -269,14 +289,12 @@ export function combineOperationsAndFragments(
  } is not defined. Please add the file containing the fragment to the set of included paths`
  );
  }
  - completeOperation.push(fragments[node.name.value]);
  + Object.assign(
  + combination,
  + getNestedFragments(fragments[node.name.value], fragments, errorLogger),
  + { [node.name.value]: fragments[node.name.value] }
  + );
  }
  });
  -
  - fullOperations.push({
  - kind: "Document",
  - definitions: completeOperation
  - });
  - });
  - return fullOperations;
  + return combination;
  }
  