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