import type { IScopedClusterClient , SavedObjectsClientContract , KibanaRequest , } from 'kibana/server' ; import type { DataViewsService } from '../../../../../src/plugins/data_views/common' ; import type { PluginStart as DataViewsPluginStart } from '../../../../../src/plugins/data_views/server' ; export type GetDataViewsService = ( ) => Promise < DataViewsService > ; export function getDataViewsServiceFactory ( getDataViews , savedObjectClient , scopedClient , request ) { const dataViews = getDataViews ( ) ; if ( dataViews === null ) { throw Error ( 'data views service has not been initialized' ) ; } return ( ) => dataViews . dataViewsServiceFactory ( savedObjectClient , scopedClient . asCurrentUser , request ) ; }