import _ from 'lodash' ; import * as ast from '../ast' ; import { nodeTypes } from '.' ; import { NamedArgTypeBuildNode } from './types' ; import { JsonObject } from '../../../../../opensearch_dashboards_utils/common' ; export function buildNode ( name , value ) { const argumentNode = _ . get ( value , 'type' ) === 'literal' ? value : nodeTypes . literal . buildNode ( value ) ; return { type : 'namedArg' , name , value : argumentNode , } ; } export function toOpenSearchQuery ( node ) { return ast . toOpenSearchQuery ( node . value ) ; }