import { difference } from 'lodash' ; import { getFlattenedObject } from '@osd/std' ; import { hasConfigPathIntersection } from '../../config' ; import { LegacyConfig , LegacyVars } from '../types' ; const getFlattenedKeys = ( object ) => Object . keys ( getFlattenedObject ( object ) ) ; export async function getUnusedConfigKeys ( { coreHandledConfigPaths , settings , legacyConfig , } ) { const inputKeys = getFlattenedKeys ( settings ) ; const appliedKeys = getFlattenedKeys ( legacyConfig . get ( ) ) ; if ( inputKeys . includes ( 'env' ) ) { inputKeys [ inputKeys . indexOf ( 'env' ) ] = 'env.name' ; } return difference ( inputKeys , appliedKeys ) . filter ( ( unusedConfigKey ) => ! coreHandledConfigPaths . some ( ( usedInCoreConfigKey ) => hasConfigPathIntersection ( unusedConfigKey , usedInCoreConfigKey ) ) ) ; }