Skip to content

Commit 7f49c09

Browse files
committed
move getJoinKey out of constants and into its own file
1 parent 3c6c15d commit 7f49c09

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
8+
export * from '../../../../plugins/maps/common/get_join_key';

x-pack/legacy/plugins/maps/common/migrations/join_agg_key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
AGG_DELIMITER,
1010
AGG_TYPE,
1111
FIELD_ORIGIN,
12-
getJoinAggKey,
1312
JOIN_FIELD_NAME_PREFIX,
1413
LAYER_TYPE,
1514
VECTOR_STYLES,
1615
} from '../constants';
16+
import { getJoinAggKey } from '../get_join_key';
1717
import {
1818
AggDescriptor,
1919
JoinDescriptor,

x-pack/plugins/maps/common/constants.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License;
4-
* you may not use this file except in compliance with the Elastic License.
5-
*/
6-
71
/*
82
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
93
* or more contributor license agreements. Licensed under the Elastic License;
@@ -75,21 +69,6 @@ export enum FIELD_ORIGIN {
7569
}
7670
export const JOIN_FIELD_NAME_PREFIX = '__kbnjoin__';
7771

78-
// function in common since its needed by migration
79-
export function getJoinAggKey({
80-
aggType,
81-
aggFieldName,
82-
rightSourceId,
83-
}: {
84-
aggType: AGG_TYPE;
85-
aggFieldName?: string;
86-
rightSourceId: string;
87-
}) {
88-
const metricKey =
89-
aggType !== AGG_TYPE.COUNT ? `${aggType}${AGG_DELIMITER}${aggFieldName}` : aggType;
90-
return `${JOIN_FIELD_NAME_PREFIX}${metricKey}__${rightSourceId}`;
91-
}
92-
9372
export const SOURCE_DATA_ID_ORIGIN = 'source';
9473
export const META_ID_ORIGIN_SUFFIX = 'meta';
9574
export const SOURCE_META_ID_ORIGIN = `${SOURCE_DATA_ID_ORIGIN}_${META_ID_ORIGIN_SUFFIX}`;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { AGG_DELIMITER, AGG_TYPE, JOIN_FIELD_NAME_PREFIX } from './constants';
8+
9+
// function in common since its needed by migration
10+
export function getJoinAggKey({
11+
aggType,
12+
aggFieldName,
13+
rightSourceId,
14+
}: {
15+
aggType: AGG_TYPE;
16+
aggFieldName?: string;
17+
rightSourceId: string;
18+
}) {
19+
const metricKey =
20+
aggType !== AGG_TYPE.COUNT ? `${aggType}${AGG_DELIMITER}${aggFieldName}` : aggType;
21+
return `${JOIN_FIELD_NAME_PREFIX}${metricKey}__${rightSourceId}`;
22+
}

x-pack/plugins/maps/public/layers/sources/es_term_source/es_term_source.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
import _ from 'lodash';
88

99
import { i18n } from '@kbn/i18n';
10-
import {
11-
AGG_TYPE,
12-
DEFAULT_MAX_BUCKETS_LIMIT,
13-
FIELD_ORIGIN,
14-
getJoinAggKey,
15-
} from '../../../../common/constants';
10+
import { AGG_TYPE, DEFAULT_MAX_BUCKETS_LIMIT, FIELD_ORIGIN } from '../../../../common/constants';
11+
import { getJoinAggKey } from '../../../../common/get_join_key';
1612
import { ESDocField } from '../../fields/es_doc_field';
1713
import { AbstractESAggSource } from '../es_agg_source';
1814
import { getField, addFieldToDSL, extractPropertiesFromBucket } from '../../util/es_agg_utils';

0 commit comments

Comments
 (0)