1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var get_root_1 = require("../utils/get-root");
|
4 | var build_selection_set_1 = require("./build-selection-set");
|
5 | var transform_variables_1 = require("./transform-variables");
|
6 | var debugging_1 = require("../debugging");
|
7 | var printer_1 = require("graphql/language/printer");
|
8 | function transformOperation(schema, operationNode) {
|
9 | var name = operationNode.name && operationNode.name.value ? operationNode.name.value : '';
|
10 | debugging_1.debugLog("[transformOperation] transforming operation " + name + " of type " + operationNode.operation);
|
11 | var root = get_root_1.getRoot(schema, operationNode);
|
12 | var variables = transform_variables_1.transformVariables(schema, operationNode);
|
13 | return {
|
14 | name: name,
|
15 | selectionSet: build_selection_set_1.buildSelectionSet(schema, root, operationNode.selectionSet),
|
16 | operationType: operationNode.operation,
|
17 | variables: variables,
|
18 | hasVariables: variables.length > 0,
|
19 | isQuery: operationNode.operation === 'query',
|
20 | isMutation: operationNode.operation === 'mutation',
|
21 | isSubscription: operationNode.operation === 'subscription',
|
22 | document: printer_1.print(operationNode),
|
23 | };
|
24 | }
|
25 | exports.transformOperation = transformOperation;
|
26 |
|
\ | No newline at end of file |