export const Symbols = {
  ARGUMENTS: Symbol('arguments'),
};

export default function astToBody(ast) {
  const fieldNodes = ast.fieldNodes;

  const body = extractSelectionSet(ast.fieldNodes[0].selectionSet);

  return body;
}

function extractSelectionSet(set) {
  let body = {};
  set.selections.forEach(el => {
    if (!el.selectionSet) {
      body[el.name.value] = 1;
    } else {
      body[el.name.value] = extractSelectionSet(el.selectionSet);
      if (el.arguments.length) {
        let argumentMap = {};
        el.arguments.forEach(arg => {
          argumentMap[arg.name.value] = arg.value.value;
        });

        body[el.name.value][Symbols.ARGUMENTS] = argumentMap;
      }
    }
  });

  return body;
}

@@ -543,24 +543,282 @@
 ch(arg =%3E %7B%0A
+          if (arg.value.kind === %22ObjectValue%22) %7B%0A            argumentMap%5Barg.name.value%5D = arg.value.fields.reduce((acc, field) =%3E %7B%0A              acc%5Bfield.name.value%5D = field.value.value;%0A              return acc;%0A            %7D, %7B%7D);%0A          %7D else %7B%0A  
           ar
@@ -854,32 +854,44 @@
 rg.value.value;%0A
+          %7D%0A
         %7D);%0A%0A   

add support for input types