{
  "version": 3,
  "sources": ["../../src/formatModuleTransforms/stripFragmentReferenceFieldSelectionTransform.ts"],
  "sourcesContent": ["import { DocumentNode, visit } from \"graphql\";\n\n/**\n * Given an execution query document, this transform will remove `__fragments`\n * selections (and container inline fragments on the `Node` interface) from the\n * operation, as these are only needed in watch queries.\n *\n * @param document The watch query document\n */\nexport function stripFragmentReferenceFieldSelectionTransform(\n  document: DocumentNode\n): DocumentNode {\n  return visit(document, {\n    Field(fieldNode) {\n      if (fieldNode.name.value === \"__fragments\") {\n        return null;\n      }\n    },\n    InlineFragment: {\n      leave(fragmentNode) {\n        if (\n          fragmentNode.typeCondition?.name.value === \"Node\" &&\n          fragmentNode.selectionSet.selections.length === 0\n        ) {\n          return null;\n        }\n      },\n    },\n  });\n}\n"],
  "mappings": ";AAAA,SAAuB,aAAa;AAS7B,SAAS,8CACd,UACc;AACd,SAAO,MAAM,UAAU;AAAA,IACrB,MAAM,WAAW;AACf,UAAI,UAAU,KAAK,UAAU,eAAe;AAC1C,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,gBAAgB;AAAA,MACd,MAAM,cAAc;AAnB1B;AAoBQ,cACE,kBAAa,kBAAb,mBAA4B,KAAK,WAAU,UAC3C,aAAa,aAAa,WAAW,WAAW,GAChD;AACA,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
  "names": []
}
