query getCategories {
  categories(sort: "id:asc") {
    id
    name
  }
  productsConnection {
    aggregate {
      totalCount
    }
    groupBy {  
      category {
        key
        connection {
          aggregate {
            count
          }
        }
      }
    }
  }
}