function aliasTopLevelFields(prefix, doc) {
  const transformer = {
    [Kind.OPERATION_DEFINITION]: def => {
      const { selections } = def.selectionSet
      return {
        ...def,
        selectionSet: {
          ...def.selectionSet,
          selections: aliasFieldsInSelection(prefix, selections, doc),
        },
      }
    },
  }
  return visit(doc, transformer, { [Kind.DOCUMENT]: [`definitions`] })
}
Adds prefixed aliases to top-level fields of the query.

@see aliasFieldsInSelection for implementation details