fleet/frontend/utilities/osquery_tables.js
Zachary Wasserman 168e1f9007
Update table schema for osquery 4.4.0 (#2253)
Osquery schema JSON has changed, so parsing code has been updated

Closes #2232
2020-07-07 09:47:50 -07:00

14 lines
523 B
JavaScript

import { flatMap, sortBy } from 'lodash';
import osqueryTablesJSON from '../osquery_tables.json';
export const normalizeTables = (tablesJSON) => {
// osquery JSON needs less parsing than it used to
const parsedTables = typeof tablesJSON === 'object' ? tablesJSON : JSON.parse(tablesJSON);
return sortBy(parsedTables, (table) => { return table.name; });
};
export const osqueryTables = normalizeTables(osqueryTablesJSON);
export const osqueryTableNames = flatMap(osqueryTables, (table) => {
return table.name;
});