import { ElasticsearchClient } from './client' ; const scriptAllowedTypesKey = 'script.allowed_types' ; export const isInlineScriptingEnabled = async ( { client , } ) : Promise < boolean > => { const { body : settings } = await client . cluster . getSettings ( { include_defaults : true , flat_settings : true , } ) ; const scriptAllowedTypes = settings . transient [ scriptAllowedTypesKey ] ?? settings . persistent [ scriptAllowedTypesKey ] ?? settings . defaults ! [ scriptAllowedTypesKey ] ?? [ ] ; return scriptAllowedTypes . length === 0 || scriptAllowedTypes . includes ( 'inline' ) ; } ;