UNPKG

698 BJavaScriptView Raw
1import { getOperationName } from "../../utilities/index.js";
2export function transformOperation(operation) {
3 var transformedOperation = {
4 variables: operation.variables || {},
5 extensions: operation.extensions || {},
6 operationName: operation.operationName,
7 query: operation.query,
8 };
9 // Best guess at an operation name
10 if (!transformedOperation.operationName) {
11 transformedOperation.operationName =
12 typeof transformedOperation.query !== "string" ?
13 getOperationName(transformedOperation.query) || undefined
14 : "";
15 }
16 return transformedOperation;
17}
18//# sourceMappingURL=transformOperation.js.map
\No newline at end of file