2021-04-12 13:32:25 +00:00
|
|
|
import { flatMap, sortBy } from "lodash";
|
|
|
|
import osqueryTablesJSON from "../osquery_tables.json";
|
2016-10-11 15:32:39 +00:00
|
|
|
|
|
|
|
export const normalizeTables = (tablesJSON) => {
|
2020-07-07 16:47:50 +00:00
|
|
|
// osquery JSON needs less parsing than it used to
|
2021-04-12 13:32:25 +00:00
|
|
|
const parsedTables =
|
|
|
|
typeof tablesJSON === "object" ? tablesJSON : JSON.parse(tablesJSON);
|
|
|
|
return sortBy(parsedTables, (table) => {
|
|
|
|
return table.name;
|
|
|
|
});
|
2016-10-11 15:32:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const osqueryTables = normalizeTables(osqueryTablesJSON);
|
|
|
|
export const osqueryTableNames = flatMap(osqueryTables, (table) => {
|
|
|
|
return table.name;
|
|
|
|
});
|