import type { CoreSetup , Logger } from 'src/core/server' ; import { SPACES_USAGE_STATS_TYPE } from './constants' ; import { UsageStatsClient } from './usage_stats_client' ; export interface UsageStatsServiceSetup { getClient ( ) : UsageStatsClient ; } interface UsageStatsServiceDeps { getStartServices : CoreSetup [ 'getStartServices' ] ; } export class UsageStatsService { constructor ( private readonly log ) { } public async setup ( { getStartServices } ) { const internalRepositoryPromise = getStartServices ( ) . then ( ( [ coreStart ] ) => coreStart . savedObjects . createInternalRepository ( [ SPACES_USAGE_STATS_TYPE ] ) ) ; const getClient = ( ) => { const debugLogger = ( message ) => this . log . debug ( message ) ; return new UsageStatsClient ( debugLogger , internalRepositoryPromise ) ; } ; return { getClient } ; } public async stop ( ) { } }