Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
([operationName, operationAST]) => {
const printed = defaultOperationRegistrySignature(
operationAST,
operationName
);
return {
signature: operationHash(printed),
document: printed,
// TODO: unused. Remove or repurpose this field altogether with op. registry 2.0 work.
// For now, this field is non-nullable on the input type.
metadata: {
engineSignature: ""
}
};
}
);
const operationDefinition = document.definitions.find(
({ kind }) => kind === "OperationDefinition"
);
const relativePath =
operationDefinition &&
operationDefinition.loc &&
relative(
config.configURI ? config.configURI.fsPath : "",
URI.parse(operationDefinition.loc.source.name).fsPath
);
const line =
operationDefinition &&
operationDefinition.loc &&
operationDefinition.loc.source.locationOffset.line;
return [
operationHash(
defaultOperationRegistrySignature(document, operationName)
),
{
operationName,
document,
file: line ? `${relativePath}:${line}` : relativePath || ""
}
];
}
)