import { i18n } from '@osd/i18n' ; import { FILTERS } from '../../../../../common/opensearch_query/filters' ; export interface Operator { message : string ; type : FILTERS ; negate : boolean ; fieldTypes ? : string [ ] ; } export const isOperator = { message : i18n . translate ( 'data.filter.filterEditor.isOperatorOptionLabel' , { defaultMessage : 'is' , } ) , type : FILTERS . PHRASE , negate : false , } ; export const isNotOperator = { message : i18n . translate ( 'data.filter.filterEditor.isNotOperatorOptionLabel' , { defaultMessage : 'is not' , } ) , type : FILTERS . PHRASE , negate : true , } ; export const isOneOfOperator = { message : i18n . translate ( 'data.filter.filterEditor.isOneOfOperatorOptionLabel' , { defaultMessage : 'is one of' , } ) , type : FILTERS . PHRASES , negate : false , fieldTypes : [ 'string' , 'number' , 'date' , 'ip' , 'geo_point' , 'geo_shape' ] , } ; export const isNotOneOfOperator = { message : i18n . translate ( 'data.filter.filterEditor.isNotOneOfOperatorOptionLabel' , { defaultMessage : 'is not one of' , } ) , type : FILTERS . PHRASES , negate : true , fieldTypes : [ 'string' , 'number' , 'date' , 'ip' , 'geo_point' , 'geo_shape' ] , } ; export const isBetweenOperator = { message : i18n . translate ( 'data.filter.filterEditor.isBetweenOperatorOptionLabel' , { defaultMessage : 'is between' , } ) , type : FILTERS . RANGE , negate : false , fieldTypes : [ 'number' , 'date' , 'ip' ] , } ; export const isNotBetweenOperator = { message : i18n . translate ( 'data.filter.filterEditor.isNotBetweenOperatorOptionLabel' , { defaultMessage : 'is not between' , } ) , type : FILTERS . RANGE , negate : true , fieldTypes : [ 'number' , 'date' , 'ip' ] , } ; export const existsOperator = { message : i18n . translate ( 'data.filter.filterEditor.existsOperatorOptionLabel' , { defaultMessage : 'exists' , } ) , type : FILTERS . EXISTS , negate : false , } ; export const doesNotExistOperator = { message : i18n . translate ( 'data.filter.filterEditor.doesNotExistOperatorOptionLabel' , { defaultMessage : 'does not exist' , } ) , type : FILTERS . EXISTS , negate : true , } ; export const FILTER_OPERATORS = [ isOperator , isNotOperator , isOneOfOperator , isNotOneOfOperator , isBetweenOperator , isNotBetweenOperator , existsOperator , doesNotExistOperator , ] ;