Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return generate(t.file(t.program(fileBody), [], [])).code;
}
const context = new OperationContext(operation, ast, options, file);
const partialContext = new OperationContext(
operation,
ast,
{...options, partial: true},
file,
);
let rootType: GraphQLObjectType;
if (operation.operationType === OperationType.Query) {
rootType = ast.schema.getQueryType() as any;
} else if (operation.operationType === OperationType.Mutation) {
rootType = ast.schema.getMutationType() as any;
} else {
rootType = ast.schema.getSubscriptionType() as any;
}
const variables =
operation.variables.filter(isTypedVariable).length > 0
? context.export(variablesInterface(operation.variables, context))
: null;
const operationInterface = t.tsInterfaceDeclaration(
t.identifier(context.typeName),
null,
null,
tsInterfaceBodyForObjectField(
operation,