{"version":3,"file":"aggregations.mjs","names":[],"sources":["../../src/helpers/templates/editor/aggregations/types.ts","../../src/helpers/templates/editor/aggregations/index.ts"],"sourcesContent":["export const aggregationTypes = [\n  { name: 'avg', type: 'metric', isCommonlyFound: true },\n  { name: 'cardinality', type: 'metric', isCommonlyFound: true },\n  { name: 'max', type: 'metric', isCommonlyFound: true },\n  { name: 'min', type: 'metric', isCommonlyFound: true },\n  { name: 'percentile_ranks', type: 'metric', isCommonlyFound: false },\n  { name: 'percentiles', type: 'metric', isCommonlyFound: false },\n  { name: 'stats', type: 'metric', isCommonlyFound: false },\n  { name: 'sum', type: 'metric', isCommonlyFound: true },\n  { name: 'value_count', type: 'metric', isCommonlyFound: false },\n\n  // { name: 'cumulative_sum', type: 'pipeline', isCommonlyFound: false },\n  // { name: 'derivative', type: 'pipeline', isCommonlyFound: false },\n  // { name: 'max_bucket', type: 'pipeline', isCommonlyFound: false },\n  // { name: 'min_bucket', type: 'pipeline', isCommonlyFound: false },\n  // { name: 'moving_average', type: 'pipeline', isCommonlyFound: false },\n  // { name: 'sum_bucket', type: 'pipeline', isCommonlyFound: false },\n\n  { name: 'adjacency_matrix', type: 'bucket', isCommonlyFound: false },\n  { name: 'auto_date_histogram', type: 'bucket', isCommonlyFound: false },\n  { name: 'date_histogram', type: 'bucket', isCommonlyFound: true },\n  { name: 'diversified_sampler', type: 'bucket', isCommonlyFound: false },\n  { name: 'filters', type: 'bucket', isCommonlyFound: false },\n  { name: 'geo_grid', type: 'bucket', isCommonlyFound: false },\n  { name: 'histogram', type: 'bucket', isCommonlyFound: false },\n  { name: 'range', type: 'bucket', isCommonlyFound: false },\n  { name: 'sampler', type: 'bucket', isCommonlyFound: false },\n  { name: 'significant_terms', type: 'bucket', isCommonlyFound: false },\n  { name: 'terms', type: 'bucket', isCommonlyFound: true },\n  { name: 'top_hits', type: 'bucket', isCommonlyFound: false },\n  { name: 'variable_width_histogram', type: 'bucket', isCommonlyFound: false },\n] as const;\n\nexport type AggregationName = (typeof aggregationTypes)[number]['name'];\nexport type AggregationType = (typeof aggregationTypes)[number]['type'];\n\nexport function isAggregationName(name: string): name is AggregationName {\n  return aggregationTypes.some((agg) => agg.name === name);\n}\n","import type { TemplateFilter } from '~/modules/templates/types';\n\nimport type { AggregationName } from './types';\n\nexport interface FigureRawAggregation {\n  // oxlint-disable-next-line no-explicit-any\n  raw: Record<string, any>;\n}\n\nexport interface FigureFilterAggregationEntry {\n  label: string;\n  filters: TemplateFilter[];\n}\n\nexport interface FigureFilterAggregation {\n  type: 'filters';\n  values: FigureFilterAggregationEntry[];\n  missing?: string;\n}\n\nexport interface FigureBaseAggregation {\n  type: AggregationName;\n  field: string;\n  size?: number;\n  missing?: string;\n}\n\n/**\n * Type for aggregations used in figures, when fetching data\n */\nexport type FigureAggregation =\n  | FigureBaseAggregation\n  | FigureFilterAggregation\n  | FigureRawAggregation;\n\nexport function isRawAggregation(\n  agg: FigureAggregation\n): agg is FigureRawAggregation {\n  return 'raw' in agg;\n}\n\nexport * from './types';\n"],"mappings":";AAAA,MAAa,mBAAmB;CAC9B;EAAE,MAAM;EAAO,MAAM;EAAU,iBAAiB;CAAK;CACrD;EAAE,MAAM;EAAe,MAAM;EAAU,iBAAiB;CAAK;CAC7D;EAAE,MAAM;EAAO,MAAM;EAAU,iBAAiB;CAAK;CACrD;EAAE,MAAM;EAAO,MAAM;EAAU,iBAAiB;CAAK;CACrD;EAAE,MAAM;EAAoB,MAAM;EAAU,iBAAiB;CAAM;CACnE;EAAE,MAAM;EAAe,MAAM;EAAU,iBAAiB;CAAM;CAC9D;EAAE,MAAM;EAAS,MAAM;EAAU,iBAAiB;CAAM;CACxD;EAAE,MAAM;EAAO,MAAM;EAAU,iBAAiB;CAAK;CACrD;EAAE,MAAM;EAAe,MAAM;EAAU,iBAAiB;CAAM;CAS9D;EAAE,MAAM;EAAoB,MAAM;EAAU,iBAAiB;CAAM;CACnE;EAAE,MAAM;EAAuB,MAAM;EAAU,iBAAiB;CAAM;CACtE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