import { schema , TypeOf } from '@kbn/config-schema' ; import type { ServiceConfigDescriptor } from '../internal_types' ; const migrationSchema = schema . object ( { batchSize : schema . number ( { defaultValue : 1000 } ) , maxBatchSizeBytes : schema . byteSize ( { defaultValue : '100mb' } ) , scrollDuration : schema . string ( { defaultValue : '15m' } ) , pollInterval : schema . number ( { defaultValue : 1500 } ) , skip : schema . boolean ( { defaultValue : false } ) , retryAttempts : schema . number ( { defaultValue : 15 } ) , } ) ; export type SavedObjectsMigrationConfigType = TypeOf < typeof migrationSchema > ; export const savedObjectsMigrationConfig = { path : 'migrations' , schema : migrationSchema , } ; const soSchema = schema . object ( { maxImportPayloadBytes : schema . byteSize ( { defaultValue : 26214400 } ) , maxImportExportSize : schema . number ( { defaultValue : 10000 } ) , } ) ; export type SavedObjectsConfigType = TypeOf < typeof soSchema > ; export const savedObjectsConfig = { path : 'savedObjects' , schema : soSchema , } ; export class SavedObjectConfig { public maxImportPayloadBytes : number ; public maxImportExportSize : number ; public migration : SavedObjectsMigrationConfigType ; constructor ( rawConfig , rawMigrationConfig ) { this . maxImportPayloadBytes = rawConfig . maxImportPayloadBytes . getValueInBytes ( ) ; this . maxImportExportSize = rawConfig . maxImportExportSize ; this . migration = rawMigrationConfig ; } }