const { getOperationAST } = require('graphql');

const isSubscription = (operation) => {
  const { query, operationName } = operation;
  const operationAST = getOperationAST(query, operationName);

  return !!operationAST && operationAST.operation === 'subscription';
};

module.exports = isSubscription;

@@ -3,75 +3,44 @@
 nst 
-%7B getOperationAST %7D = require('graphql');%0A%0Aconst isSubscription = (
+isSubscriptionDefinition = (%7B kind, 
 oper
@@ -48,195 +48,200 @@
 tion
+ %7D
 ) =%3E 
-%7B%0A  const %7B query, operationName %7D = opera
+kind === 'OperationDefinition' && operation === 'subscrip
 tion
+'
 ;%0A
-  
+%0A
 const 
-operationAST = getOperationAST(query, operationName);%0A%0A  return !!opera
+isSubscription = (%7B query %7D) =%3E query%0A  && query.defini
 tion
-AST
+s%0A 
  && 
-operationAST.operation === 'subscription';%0A%7D
+query.definitions.some(isSubscriptionDefinition)
 ;%0A%0Am

remove client side graphql dependency