1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule;
|
7 |
|
8 | var _GraphQLError = require("../../error/GraphQLError.js");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function SingleFieldSubscriptionsRule(context) {
|
16 | return {
|
17 | OperationDefinition: function OperationDefinition(node) {
|
18 | if (node.operation === 'subscription') {
|
19 | if (node.selectionSet.selections.length !== 1) {
|
20 | context.reportError(new _GraphQLError.GraphQLError(node.name ? "Subscription \"".concat(node.name.value, "\" must select only one top level field.") : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1)));
|
21 | }
|
22 | }
|
23 | }
|
24 | };
|
25 | }
|