import { IScopedClusterClient } from 'kibana/server' ; import type { JobSpaceOverrides } from '../../sync' ; import { logJobsSpaces } from './logs' ; import { metricsJobsSpaces } from './metrics' ; export async function createJobSpaceOverrides ( clusterClient ) { const spaceOverrides = { overrides : { 'anomaly-detector' : { } , 'data-frame-analytics' : { } , } , } ; ( await logJobsSpaces ( clusterClient ) ) . forEach ( ( o ) => ( spaceOverrides . overrides [ 'anomaly-detector' ] [ o . id ] = [ o . space ] ) ) ; ( await metricsJobsSpaces ( clusterClient ) ) . forEach ( ( o ) => ( spaceOverrides . overrides [ 'anomaly-detector' ] [ o . id ] = [ o . space ] ) ) ; return spaceOverrides ; }