import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const GetGeneratorWithService = gql` query GetGeneratorWithService($guid: String, $serviceGuid: String, $serviceUri: String, $attributeName: String, $key: String, $limit: Int, $offset: Int) { getGeneratorWithService(guid: $guid, serviceGuid: $serviceGuid, serviceUri: $serviceUri, attributeName: $attributeName, key: $key, limit: $limit, offset: $offset) { } }` const GetGeneratorWithService = gql` query GetGeneratorWithService($key: String) { getGeneratorWithService(key: $key) { service { guid uri audit } generator } }` const withAppSyncGeneratorWithService = compose( graphql(GetGeneratorWithService, { name: 'getGeneratorWithService', options: (ownProps) => ({ fetchPolicy: 'cache-and-network', variables: { guid: ownProps.guid, serviceGuid: ownProps.serviceGuid, serviceUri: ownProps.serviceUri, attributeName: ownProps.attributeName, key: ownProps.key, limit: ownProps.limit, offset: ownProps.offset } }), props: (props) => { if (props.getGeneratorWithService.error) console.log(props.getGeneratorWithService.error) return props } }) ) export { GetGeneratorWithService, GetGeneratorWithService, withAppSyncGeneratorWithService }