mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
ee3d96eb53
* Updates eslint packages * Expected parentheses around arrow function argument having a body with curly braces * Prop type `object` is forbidden * Visible, non-interactive elements should not have mouse or keyboard event listeners * Prop type is defined but not used * Unexpected use of file extension "jsx" * Expected 'this' to be used by class method * HTML entities must be escaped * Prevent default behavior on more options button click
25 lines
754 B
JavaScript
25 lines
754 B
JavaScript
import { flatten, map, flatMap } from 'lodash';
|
|
import osqueryTablesJSON from '../osquery_tables.json';
|
|
|
|
const appendPlatformKeyToTables = (parsedTables) => {
|
|
return map(parsedTables, (platform) => {
|
|
return platform.tables.map((table) => {
|
|
table.platform = platform.key;
|
|
|
|
return table;
|
|
});
|
|
});
|
|
};
|
|
|
|
export const normalizeTables = (tablesJSON) => {
|
|
const { tables: parsedTables } = typeof tablesJSON === 'object' ? tablesJSON : JSON.parse(tablesJSON);
|
|
const tablesWithPlatformKey = appendPlatformKeyToTables(parsedTables);
|
|
|
|
return flatten(tablesWithPlatformKey);
|
|
};
|
|
|
|
export const osqueryTables = normalizeTables(osqueryTablesJSON);
|
|
export const osqueryTableNames = flatMap(osqueryTables, (table) => {
|
|
return table.name;
|
|
});
|