UNPKG

@graphql-mesh/runtime

Version:
18 lines (17 loc) 518 B
import { BREAK, visit } from 'graphql'; import { memoize1 } from '@graphql-tools/utils'; export const isStreamOperation = memoize1(function isStreamOperation(astNode) { let isStream = false; visit(astNode, { Field: { enter(node) { if (node.directives?.some(d => d.name.value === 'stream')) { isStream = true; return BREAK; } return undefined; }, }, }); return isStream; });