UNPKG

@n1ru4l/graphql-live-query

Version:

[![npm version](https://img.shields.io/npm/v/@n1ru4l/graphql-live-query.svg)](https://www.npmjs.com/package/@n1ru4l/graphql-live-query) [![npm downloads](https://img.shields.io/npm/dm/@n1ru4l/graphql-live-query.svg)](https://www.npmjs.com/package/@n1ru4l/

23 lines (22 loc) 977 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NoLiveMixedWithDeferStreamRule = void 0; const graphql_1 = require("graphql"); const getLiveDirectiveNode_js_1 = require("../getLiveDirectiveNode.js"); const Maybe_js_1 = require("../Maybe.js"); const NoLiveMixedWithDeferStreamRule = (context) => { return { OperationDefinition(operationDefinitionNode) { if ((0, Maybe_js_1.isNone)((0, getLiveDirectiveNode_js_1.getLiveDirectiveNode)(operationDefinitionNode))) { return false; } }, Directive(directiveNode) { if (directiveNode.name.value === "defer" || directiveNode.name.value === "stream") { context.reportError(new graphql_1.GraphQLError(`Cannot mix "@${directiveNode.name.value}" with "@live".`, directiveNode.name)); } }, }; }; exports.NoLiveMixedWithDeferStreamRule = NoLiveMixedWithDeferStreamRule;