import { CollectorSet , MakeSchemaFrom } from '../../plugins/usage_collection/server/collector' ; import { loggerMock } from '../../core/server/logging/logger.mock' ; const { makeUsageCollector } = new CollectorSet ( { logger : loggerMock . create ( ) , maximumWaitTimeForAllCollectorsInS : 0 , } ) ; interface MyObject { total : number ; type : boolean ; } interface Usage { flat ? : string ; my_str ? : string ; my_objects : MyObject ; } const SOME_NUMBER = 123 ; const someSchema = { flat : { type : 'keyword' , } , my_str : { type : 'text' , } , } ; const someOtherSchema = { my_objects : { total : { type : 'long' , } , type : { type : 'boolean' } , } , } ; export const myCollector = makeUsageCollector < Usage > ( { type : 'schema_defined_with_spreads' , isReady : ( ) => true , fetch ( ) { const testString = '123' ; return { flat : 'hello' , my_str : testString , my_objects : { total : SOME_NUMBER , type : true , } , } ; } , schema : { ... someSchema , ... someOtherSchema , } , } ) ;