import { schema , TypeOf } from '@kbn/config-schema' ; const RulesSchema = schema . object ( { allow : schema . boolean ( ) , host : schema . maybe ( schema . string ( ) ) , protocol : schema . maybe ( schema . string ( { validate ( value ) { if ( ! /:$/ . test ( value ) ) { return 'must end in colon' ; } } , } ) ) , } ) ; export const ConfigSchema = schema . object ( { networkPolicy : schema . object ( { enabled : schema . boolean ( { defaultValue : true } ) , rules : schema . arrayOf ( RulesSchema , { defaultValue : [ { host : undefined , allow : true , protocol : 'http:' } , { host : undefined , allow : true , protocol : 'https:' } , { host : undefined , allow : true , protocol : 'ws:' } , { host : undefined , allow : true , protocol : 'wss:' } , { host : undefined , allow : true , protocol : 'data:' } , { host : undefined , allow : false , protocol : undefined } , ] , } ) , } ) , browser : schema . object ( { autoDownload : schema . conditional ( schema . contextRef ( 'dist' ) , true , schema . boolean ( { defaultValue : false } ) , schema . boolean ( { defaultValue : true } ) ) , chromium : schema . object ( { inspect : schema . conditional ( schema . contextRef ( 'dist' ) , true , schema . boolean ( { defaultValue : false } ) , schema . maybe ( schema . never ( ) ) ) , disableSandbox : schema . maybe ( schema . boolean ( ) ) , proxy : schema . object ( { enabled : schema . boolean ( { defaultValue : false } ) , server : schema . conditional ( schema . siblingRef ( 'enabled' ) , true , schema . uri ( { scheme : [ 'http' , 'https' ] } ) , schema . maybe ( schema . never ( ) ) ) , bypass : schema . conditional ( schema . siblingRef ( 'enabled' ) , true , schema . arrayOf ( schema . string ( ) ) , schema . maybe ( schema . never ( ) ) ) , } ) , } ) , } ) , } ) ; export type ConfigType = TypeOf < typeof ConfigSchema > ;