{"size": 980, "ext": "js", "max_stars_repo_path": "src/system_graph.js", "max_stars_repo_name": "Meettya/antinite", "max_stars_repo_stars_event_min_datetime": "2017-07-13T11:38:41.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-02T23:05:24.000Z", "max_issues_repo_path": "src/system_graph.js", "max_issues_repo_name": "Meettya/antinite", "max_issues_repo_issues_event_min_datetime": "2017-07-26T07:52:21.000Z", "max_issues_repo_issues_event_max_datetime": "2019-01-16T10:32:34.000Z", "max_forks_repo_path": "src/system_graph.js", "max_forks_repo_name": "Meettya/antinite", "max_forks_repo_forks_event_min_datetime": "2017-06-21T14:47:08.000Z", "max_forks_repo_forks_event_max_datetime": "2017-06-21T14:47:08.000Z"}
{"max_stars_count": 4, "max_issues_count": 6, "max_forks_count": 1, "avg_line_length": 21.3043478261, "max_line_length": 62, "alphanum_fraction": 0.6846938776}
/*
 * Build system graph for all layers
 */

let getData, getLayerData, processServicesData, getServiceData

getServiceData = (serviceObj) => {
  return {
    name: serviceObj.getName(),
    isReady: serviceObj.isReady(),
    isLegacy: serviceObj.isLegacy(),
    acl: serviceObj.getAcl(),
    export: serviceObj.getExportDict(),
    require: serviceObj.getRequireDict()
  }
}

processServicesData = (servicesDict) => {
  let res = []

  Object.keys(servicesDict).forEach((serviceName) => {
    res.push(getServiceData(servicesDict[serviceName]))
  })
  return res
}

getLayerData = (layerObj) => {
  return {
    name: layerObj.getName(),
    isReady: layerObj.isReady(),
    isLegacy: layerObj.isLegacy(),
    services: processServicesData(layerObj.getServices())
  }
}

getData = (layersExchanger) => {
  let res = []

  Object.keys(layersExchanger).forEach((layerName) => {
    res.push(getLayerData(layersExchanger[layerName]))
  })
  return res
}

export default { getData }
