{"size": 631, "ext": "js", "max_stars_repo_path": "src/subscriptions/resources.js", "max_stars_repo_name": "hyperdev-io/server-client", "max_stars_repo_stars_event_min_datetime": "2019-04-30T11:22:33.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-29T23:21:33.000Z", "max_issues_repo_path": "src/subscriptions/resources.js", "max_issues_repo_name": "hyperdev-io/server-client", "max_issues_repo_issues_event_min_datetime": "2020-07-16T23:50:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-22T04:39:30.000Z", "max_forks_repo_path": "src/subscriptions/resources.js", "max_forks_repo_name": "hyperdev-io/graphql-api-client", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 16.1794871795, "max_line_length": 58, "alphanum_fraction": 0.4247226624}
const gql = require("graphql-tag");
const query = gql`
  subscription {
    resources {
      name
      lastUpdated
      ... on ComputeNode {
        cpu {
          idle
          used
          iowait
        }
        memory {
          total
          used
        }
        disk {
          total
          used
          free
        }
      }
      ... on StorageNode {
        disk {
          total
          used
          free
        }
      }
    }
  }
`;

module.exports = wsclient => callback => {
  wsclient.subscribe({ query, variables: {} }).subscribe({
    next: data => callback(data.data.resources)
  });
};
