According to the Shopify API reference, it should be as this:
const data = await _client.query({
data: {
query: query
variables: {
cursor: endCursor,
},
},
})
BTW according to them _client.query
will be deprecated and it will replaced by _client.request
const client = new shopify.clients.Graphql({session});
const response = await
…