import type { ISource } from './source' ; import { Adapters } from '../../../../../../src/plugins/inspector/common/adapters' ; export type SourceRegistryEntry = { ConstructorFunction : new ( sourceDescriptor , inspectorAdapters ? ) => ISource ; type : string ; } ; const registry = [ ] ; export function registerSource ( entry ) { const sourceTypeExists = registry . some ( ( { type } ) => { return entry . type === type ; } ) ; if ( sourceTypeExists ) { throw new Error ( `Unable to register source type ${ entry . type }. ${ entry . type } has already been registered` ) ; } registry . push ( entry ) ; } export function getSourceByType ( sourceType ) { return registry . find ( ( source ) => source . type === sourceType ) ; }