import { CoreSetup , Logger , LoggerFactory } from '../../../../../src/core/server' ; import { SecurityPluginStart } from '../../../security/server' ; import { AgentService , FleetStartContract , PackageService , AgentPolicyServiceInterface , PackagePolicyServiceInterface , } from '../../../fleet/server' ; import { ConfigType } from '../config' ; export type OsqueryAppContextServiceStartContract = Partial < Pick < FleetStartContract , 'agentService' | 'packageService' | 'packagePolicyService' | 'agentPolicyService' > > & { logger : Logger ; config : ConfigType ; registerIngestCallback ? : FleetStartContract [ 'registerExternalCallback' ] ; } ; /**
 * A singleton that holds shared services that are initialized during the start up phase
 * of the plugin lifecycle. And stop during the stop phase, if needed.
 */ export class OsqueryAppContextService { private agentService : AgentService | undefined ; private packageService : PackageService | undefined ; private packagePolicyService : PackagePolicyServiceInterface | undefined ; private agentPolicyService : AgentPolicyServiceInterface | undefined ; public start ( dependencies ) { this . agentService = dependencies . agentService ; this . packageService = dependencies . packageService ; this . packagePolicyService = dependencies . packagePolicyService ; this . agentPolicyService = dependencies . agentPolicyService ; } public stop ( ) { } public getAgentService ( ) { return this . agentService ; } public getPackageService ( ) { return this . packageService ; } public getPackagePolicyService ( ) { return this . packagePolicyService ; } public getAgentPolicyService ( ) { return this . agentPolicyService ; } } /**
 * The context for Osquery app.
 */ export interface OsqueryAppContext { logFactory : LoggerFactory ; config ( ) : ConfigType ; security : SecurityPluginStart ; getStartServices : CoreSetup [ 'getStartServices' ] ; /**
     * Object readiness is tied to plugin start method
     */ service : OsqueryAppContextService ; }