Update dependency @types/lodash to ^4.17.10 (main) (#194739)

This commit is contained in:
elastic-renovate-prod[bot] 2024-10-15 08:21:03 +02:00 committed by GitHub
parent 68cceefbec
commit 563910b672
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
71 changed files with 167 additions and 154 deletions

View file

@ -1587,7 +1587,7 @@
"@types/jsonwebtoken": "^9.0.0",
"@types/license-checker": "15.0.0",
"@types/loader-utils": "^2.0.3",
"@types/lodash": "^4.14.159",
"@types/lodash": "^4.17.10",
"@types/lru-cache": "^5.1.0",
"@types/lz-string": "^1.3.34",
"@types/mapbox__vector-tile": "1.3.0",

View file

@ -17,7 +17,7 @@ export const updateFilter = (
operator?: FilterMeta,
params?: Filter['meta']['params'],
fieldType?: string
) => {
): Filter => {
if (!field || !operator) {
return updateField(filter, field);
}
@ -35,7 +35,7 @@ export const updateFilter = (
return updateWithIsOperator(filter, operator, params, fieldType);
};
function updateField(filter: Filter, field?: string) {
function updateField(filter: Filter, field?: string): Filter {
return {
...filter,
meta: {
@ -48,7 +48,7 @@ function updateField(filter: Filter, field?: string) {
type: undefined,
},
query: undefined,
};
} as Filter; // need the casting because `field` shouldn't be there
}
function updateWithExistsOperator(filter: Filter, operator?: FilterMeta) {
@ -104,7 +104,7 @@ function updateWithRangeOperator(
operator: FilterMeta,
rawParams: Filter['meta']['params'] | undefined,
field: string
) {
): Filter {
if (isRangeFilterParams(rawParams)) {
const { from, to } = rawParams;
const params = {
@ -148,7 +148,7 @@ function updateWithRangeOperator(
},
},
};
return updatedFilter;
return updatedFilter as Filter; // need the casting because it doesn't like the types of `params.gte|lt`
}
}

View file

@ -321,13 +321,10 @@ export const ESQLEditor = memo(function ESQLEditor({
}, []);
const { cache: dataSourcesCache, memoizedSources } = useMemo(() => {
const fn = memoize(
(...args: [DataViewsPublicPluginStart, CoreStart]) => ({
timestamp: Date.now(),
result: getESQLSources(...args),
}),
({ esql }) => esql
);
const fn = memoize((...args: [DataViewsPublicPluginStart, CoreStart]) => ({
timestamp: Date.now(),
result: getESQLSources(...args),
}));
return { cache: fn.cache, memoizedSources: fn };
}, []);

View file

@ -131,7 +131,7 @@ describe('processVersionedRouter', () => {
{}
);
expect(Object.keys(get(baseCase, 'paths["/foo"].get.responses.200.content'))).toEqual([
expect(Object.keys(get(baseCase, 'paths["/foo"].get.responses.200.content')!)).toEqual([
'application/test+json; Elastic-Api-Version=2023-10-31',
'application/test+json; Elastic-Api-Version=2024-12-31',
]);
@ -142,7 +142,7 @@ describe('processVersionedRouter', () => {
createOperationIdCounter(),
{ version: '2023-10-31' }
);
expect(Object.keys(get(filteredCase, 'paths["/foo"].get.responses.200.content'))).toEqual([
expect(Object.keys(get(filteredCase, 'paths["/foo"].get.responses.200.content')!)).toEqual([
'application/test+json; Elastic-Api-Version=2023-10-31',
]);
});

View file

@ -117,13 +117,11 @@ const suggestionAggSubtypes: { [key: string]: OptionsListSuggestionAggregationBu
const isNested = fieldSpec && getFieldSubtypeNested(fieldSpec);
basePath += isNested ? '.nestedSuggestions.filteredSuggestions' : '.filteredSuggestions';
const suggestions = get(rawEsResult, `${basePath}.suggestions.buckets`)?.reduce(
(acc: OptionsListSuggestions, suggestion: EsBucket) => {
acc.push({ value: suggestion.key, docCount: suggestion.doc_count });
return acc;
},
[]
);
const buckets = get(rawEsResult, `${basePath}.suggestions.buckets`, []) as EsBucket[];
const suggestions = buckets.reduce((acc: OptionsListSuggestions, suggestion: EsBucket) => {
acc.push({ value: suggestion.key, docCount: suggestion.doc_count });
return acc;
}, []);
return {
suggestions,
totalCardinality: get(rawEsResult, `${basePath}.unique_terms.value`),

View file

@ -8,7 +8,7 @@
*/
import { set } from '@kbn/safer-lodash-set';
import { defaults, get } from 'lodash';
import { defaults } from 'lodash';
import { DataViewsService, DataView, DataViewLazy } from '.';
import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks';
@ -297,7 +297,8 @@ describe('IndexPatterns', () => {
test('does cache ad-hoc data views', async () => {
const id = '1';
const createFromSpecOriginal = get(indexPatterns, 'createFromSpec');
// eslint-disable-next-line dot-notation
const createFromSpecOriginal = indexPatterns['createFromSpec'];
let mockedCreateFromSpec: jest.Mock;
set(
@ -340,7 +341,8 @@ describe('IndexPatterns', () => {
test('does cache ad-hoc data views for DataViewLazy', async () => {
const id = '1';
const createFromSpecOriginal = get(indexPatterns, 'createFromSpecLazy');
// eslint-disable-next-line dot-notation
const createFromSpecOriginal = indexPatterns['createFromSpecLazy'];
let mockedCreateFromSpec: jest.Mock;
set(

View file

@ -8,7 +8,7 @@
*/
import { debounce } from 'lodash';
import type { Cancelable } from 'lodash';
import type { DebouncedFunc } from 'lodash';
import { useCallback, useEffect, useMemo, useState } from 'react';
import useUpdateEffect from 'react-use/lib/useUpdateEffect';
@ -22,7 +22,7 @@ export function useDebouncedValue<T>(value: T, timeout?: number): [T, boolean] {
},
[setStoredValue, setPending]
);
const setDebouncedValue = useMemo<typeof setValue & Partial<Cancelable>>(
const setDebouncedValue = useMemo<typeof setValue & Partial<DebouncedFunc<typeof setValue>>>(
() => (timeout ? debounce(setValue, timeout) : setValue),
[setValue, timeout]
);

View file

@ -82,7 +82,7 @@ export class PhraseFilterManager extends FilterManager {
private getValueFromFilter(kbnFilter: Filter): any {
// bool filter - multiple phrase filters
if (_.has(kbnFilter, 'query.bool.should')) {
return _.get(kbnFilter, 'query.bool.should')
return (_.get(kbnFilter, 'query.bool.should') as PhraseFilter[])
.map((kbnQueryFilter: PhraseFilter) => {
return this.getValueFromFilter(kbnQueryFilter);
})

View file

@ -14,7 +14,7 @@ import useMount from 'react-use/lib/useMount';
import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AggParam, IAggConfig, IFieldParamType, KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { IAggConfig, IFieldParamType, KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
import { DataViewField } from '@kbn/data-views-plugin/public';
import { formatListAsProse, parseCommaSeparatedList, useValidation } from './utils';
import { AggParamEditorProps } from '../agg_param_props';
@ -47,7 +47,7 @@ function FieldParamEditor({
: [];
const onChange = (options: EuiComboBoxOptionOption[]) => {
const selectedOption: DataViewField = get(options, '0.target');
const selectedOption: DataViewField | undefined = get(options, '0.target');
if (!(aggParam.required && !selectedOption)) {
setValue(selectedOption);
}
@ -158,9 +158,8 @@ function getFieldTypesString(agg: IAggConfig) {
}
function getFieldTypes(agg: IAggConfig) {
const param =
get(agg, 'type.params', []).find((p: AggParam) => p.name === 'field') ||
({} as IFieldParamType);
const param = (get(agg, 'type.params', []).find((p) => p.name === 'field') ||
{}) as IFieldParamType;
return parseCommaSeparatedList(param.filterFieldTypes || []);
}

View file

@ -147,7 +147,7 @@ function TimeIntervalParamEditor({
const onCustomInterval = (customValue: string) => setValue(customValue.trim());
const onChange = (opts: EuiComboBoxOptionOption[]) => {
const selectedOpt: ComboBoxOption = get(opts, '0');
const selectedOpt = get(opts, '0');
setValue(selectedOpt ? selectedOpt.key : '');
};

View file

@ -23,7 +23,7 @@ export function getArgValueSuggestions() {
// index argument not provided
return;
}
const indexPatternTitle = get(indexPatternArg, 'value.text');
const indexPatternTitle = get(indexPatternArg, 'value.text', '');
return (await indexPatterns.find(indexPatternTitle, 1)).find(
(index) => index.title === indexPatternTitle

View file

@ -20,7 +20,7 @@ import type { Panel, Series } from '../../../../common/types';
import type { BaseMeta } from '../request_processors/types';
const getTimeSeries = <TRawResponse = unknown>(resp: TRawResponse, series: Series) =>
get(resp, `aggregations.timeseries`) || get(resp, `aggregations.${series.id}.timeseries`);
get(resp, `aggregations.timeseries`) || get(resp, [`aggregations`, series.id, `timeseries`]);
interface SplittedData<TMeta extends BaseMeta = BaseMeta> {
id: string;
@ -49,7 +49,7 @@ export async function getSplits<TRawResponse = unknown, TMeta extends BaseMeta =
extractFields: Function
): Promise<Array<SplittedData<TMeta>>> {
if (!meta) {
meta = get(resp, `aggregations.${series.id}.meta`);
meta = get(resp, `aggregations.${series.id}.meta`) as TMeta | undefined;
}
const color = new Color(series.color);
@ -81,7 +81,7 @@ export async function getSplits<TRawResponse = unknown, TMeta extends BaseMeta =
if (series.split_mode === 'filters' && isPlainObject(buckets)) {
return (series.split_filters || []).map((filter) => {
const bucket = get(resp, `aggregations.${series.id}.buckets.${filter.id}`);
const bucket = get(resp, [`aggregations`, series.id, `buckets`, filter.id!]); // using array path because the dotted string failed to resolve the types
bucket.id = `${series.id}${SERIES_SEPARATOR}${filter.id}`;
bucket.key = filter.id;
bucket.splitByLabel = splitByLabel;

View file

@ -26,9 +26,7 @@ const hasSiblingPipelineAggregation = (aggs: Record<string, unknown> = {}) =>
*/
export const normalizeQuery: TableRequestProcessorsFunction = () => {
return () => (doc) => {
const series = get(doc, 'aggs.pivot.aggs') as Array<{
aggs: Record<string, unknown>;
}>;
const series = get(doc, 'aggs.pivot.aggs');
const normalizedSeries = {};
forEach(series, (value, seriesId) => {

View file

@ -109,8 +109,8 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps<VisParams>) {
}
if (lastCustomLabels[axis.id] !== newCustomLabel && newCustomLabel !== '') {
const lastSeriesAggType = get(lastSeriesAgg, `${matchingSeries[0].id}.type`);
const lastSeriesAggField = get(lastSeriesAgg, `${matchingSeries[0].id}.field`);
const lastSeriesAggType = get(lastSeriesAgg, [matchingSeries[0].id, `type`]); // using array path vs. string because type inference was broken
const lastSeriesAggField = get(lastSeriesAgg, [matchingSeries[0].id, `field`]);
const matchingSeriesAggType = get(matchingSeries, '[0]type.name', '');
const matchingSeriesAggField = get(matchingSeries, '[0]params.field.name', '');

View file

@ -405,7 +405,7 @@ export const getVisualizeEmbeddableFactory: (deps: {
}
const currentVis = vis$.getValue();
if (!disableTriggers) {
const triggerId = get(
const triggerId: string = get(
VIS_EVENT_TO_TRIGGER,
event.name,
VIS_EVENT_TO_TRIGGER.filter

View file

@ -481,7 +481,11 @@ export class VisualizeEmbeddable
return;
}
if (!this.input.disableTriggers) {
const triggerId = get(VIS_EVENT_TO_TRIGGER, event.name, VIS_EVENT_TO_TRIGGER.filter);
const triggerId: string = get(
VIS_EVENT_TO_TRIGGER,
event.name,
VIS_EVENT_TO_TRIGGER.filter
);
let context;
if (triggerId === VIS_EVENT_TO_TRIGGER.applyFilter) {

View file

@ -49,8 +49,8 @@ export default function ({ getService }: FtrProviderContext) {
q: 'type:kql-telemetry',
})
.then((response) => {
const kqlTelemetryDoc = get(response, 'hits.hits[0]._source.kql-telemetry');
expect(kqlTelemetryDoc.optInCount).to.be(1);
const optInCount = get(response, 'hits.hits[0]._source.kql-telemetry.optInCount');
expect(optInCount).to.be(1);
});
});
@ -69,8 +69,8 @@ export default function ({ getService }: FtrProviderContext) {
q: 'type:kql-telemetry',
})
.then((response) => {
const kqlTelemetryDoc = get(response, 'hits.hits[0]._source.kql-telemetry');
expect(kqlTelemetryDoc.optOutCount).to.be(1);
const optOutCount = get(response, 'hits.hits[0]._source.kql-telemetry.optOutCount');
expect(optOutCount).to.be(1);
});
});

View file

@ -10,7 +10,7 @@ import _ from 'lodash';
export class KibanaPrivilege {
constructor(public readonly id: string, public readonly actions: string[] = []) {}
public get name() {
public get name(): string {
return _.upperFirst(this.id);
}

View file

@ -24,10 +24,10 @@ export const sanitizeBulkErrorResponse = (
(responseToUse.items ?? []).forEach(
(item: Partial<Record<estypes.BulkOperationType, estypes.BulkResponseItem>>) => {
for (const [_, responseItem] of Object.entries(item)) {
const reason: string = get(responseItem, 'error.reason');
const reason = get(responseItem, 'error.reason');
const redactIndex = reason ? reason.indexOf(`Preview of field's value:`) : -1;
if (redactIndex > 1) {
set(responseItem, 'error.reason', reason.substring(0, redactIndex - 1));
set(responseItem, 'error.reason', reason!.substring(0, redactIndex - 1));
}
}
}

View file

@ -52,7 +52,7 @@ export class ExtendedTemplate extends PureComponent<Props> {
// TODO: this should be in a helper, it's the same code from container_style
getArgValue = (name: string, alt: string) => {
return get(this.props.argValue, `chain.0.arguments.${name}.0`, alt);
return get(this.props.argValue, `chain.0.arguments.${name}.0`, alt) as string | undefined;
};
// TODO: this should be in a helper, it's the same code from container_style

View file

@ -46,9 +46,9 @@ const PERCENT_DECIMALS_FIELD = 'percentDecimals';
export const ExtendedTemplate: FunctionComponent<Props> = ({ onValueChange, argValue }) => {
const showLabels = getFieldValue(argValue, SHOW_FIELD);
const showValues = getFieldValue(argValue, VALUES_FIELD);
const valueFormat = getFieldValue(argValue, VALUES_FORMAT_FIELD);
const percentDecimals = getFieldValue(argValue, PERCENT_DECIMALS_FIELD);
const showValues = getFieldValue(argValue, VALUES_FIELD) as boolean;
const valueFormat = getFieldValue(argValue, VALUES_FORMAT_FIELD) as string;
const percentDecimals = getFieldValue(argValue, PERCENT_DECIMALS_FIELD) as string;
const positions: EuiSelectOption[] = [
{ text: strings.getPositionDefaultLabel(), value: 'default' },
@ -110,7 +110,7 @@ export const ExtendedTemplate: FunctionComponent<Props> = ({ onValueChange, argV
<EuiFormRow label={strings.getPositionLabel()} display="columnCompressed">
<EuiSelect
compressed
value={getFieldValue(argValue, POSITION_FIELD)}
value={getFieldValue(argValue, POSITION_FIELD) as string}
options={positions}
onChange={onCommonFieldChange(POSITION_FIELD)}
/>

View file

@ -39,7 +39,7 @@ export const SimpleTemplate: FunctionComponent<Props> = ({ onValueChange, argVal
[argValue, onValueChange, showValuePath]
);
const showLabels = getFieldValue(argValue, SHOW_FIELD, false);
const showLabels = getFieldValue(argValue, SHOW_FIELD, false) as boolean;
return (
<EuiSwitch compressed checked={showLabels} onChange={onToggle} showLabel={false} label="" />

View file

@ -18,7 +18,7 @@ export const getFieldValue = (
defaultValue?: unknown
) => {
if (!ast) {
return null;
return undefined;
}
return get(ast, getFieldPath(field), defaultValue);

View file

@ -45,7 +45,7 @@ export const ExtendedTemplate: FunctionComponent<Props> = (props) => {
} = props;
const chain = get(argValue, 'chain.0', {});
const chainArgs = get(chain, 'arguments', {});
const selectedSeries = get(chainArgs, 'label.0', '');
const selectedSeries = get(chainArgs, 'label.0', '') as string;
let name = '';
if (typeInstance) {
@ -101,7 +101,7 @@ export const ExtendedTemplate: FunctionComponent<Props> = (props) => {
<EuiFlexItem>
<EuiFormRow label={strings.getLineLabel()} display="rowCompressed">
<EuiSelect
value={get(chainArgs, 'lines.0', 0)}
value={get(chainArgs, 'lines.0', 0) as number}
options={values}
compressed
onChange={(ev) => handleChange('lines', ev)}
@ -113,7 +113,7 @@ export const ExtendedTemplate: FunctionComponent<Props> = (props) => {
<EuiFlexItem>
<EuiFormRow label={strings.getBarLabel()} display="rowCompressed">
<EuiSelect
value={get(chainArgs, 'bars.0', 0)}
value={get(chainArgs, 'bars.0', 0) as number}
options={values}
compressed
onChange={(ev) => handleChange('bars', ev)}
@ -125,7 +125,7 @@ export const ExtendedTemplate: FunctionComponent<Props> = (props) => {
<EuiFlexItem>
<EuiFormRow label={strings.getPointLabel()} display="rowCompressed">
<EuiSelect
value={get(chainArgs, 'points.0', 0)}
value={get(chainArgs, 'points.0', 0) as number}
options={values}
compressed
onChange={(ev) => handleChange('points', ev)}

View file

@ -33,13 +33,13 @@ const formatLabel = (label: string, props: Props) => {
const EnhancedExtendedTemplate = compose<ExtendedTemplateProps, Props>(
lifecycle<Props, {}>({
componentWillMount() {
const label = get(this.props.argValue, 'chain.0.arguments.label.0', '');
const label = get(this.props.argValue, 'chain.0.arguments.label.0', '') as string;
if (label) {
this.props.setLabel(formatLabel(label, this.props));
}
},
componentDidUpdate(prevProps) {
const newLabel = get(this.props.argValue, 'chain.0.arguments.label.0', '');
const newLabel = get(this.props.argValue, 'chain.0.arguments.label.0', '') as string;
if (newLabel && prevProps.label !== formatLabel(newLabel, this.props)) {
this.props.setLabel(formatLabel(newLabel, this.props));
}

View file

@ -44,7 +44,7 @@ export const SimpleTemplate: FunctionComponent<Props> = (props) => {
const { name } = typeInstance;
const chain = get(argValue, 'chain.0', {});
const chainArgs = get(chain, 'arguments', {});
const color: string = get(chainArgs, 'color.0', '');
const color: string = get(chainArgs, 'color.0', '') as string;
const handleChange: <T extends Argument>(key: T, val: string) => void = (argName, val) => {
const fn = val === '' ? del : set;

View file

@ -27,14 +27,14 @@ function getFiltersByGroup(allFilters: string[], groups?: string[], ungrouped =
// remove all allFilters that belong to a group
return allFilters.filter((filter: string) => {
const ast = fromExpression(filter);
const expGroups: string[] = get(ast, 'chain[0].arguments.filterGroup', []);
const expGroups: string[] = get(ast, 'chain[0].arguments.filterGroup', []) as string[];
return expGroups.length === 0;
});
}
return allFilters.filter((filter: string) => {
const ast = fromExpression(filter);
const expGroups: string[] = get(ast, 'chain[0].arguments.filterGroup', []);
const expGroups: string[] = get(ast, 'chain[0].arguments.filterGroup', []) as string[];
return expGroups.length > 0 && expGroups.every((expGroup) => groups.includes(expGroup));
});
}

View file

@ -38,7 +38,7 @@ export const getFlotAxisConfig = (
const config: Config = { show: true };
const axisType = get(columns, `${axis}.type`);
const axisType = get(columns, [axis, `type`]);
if (isAxisConfig(argValue)) {
const { position, min, max, tickSize } = argValue;

View file

@ -65,7 +65,7 @@ const excludeFiltersByGroups = (filters: Ast[], filterExprAst: AstFunction) => {
const groupsToExclude = filterExprAst.arguments.group ?? [];
const removeUngrouped = filterExprAst.arguments.ungrouped?.[0] ?? false;
return filters.filter((filter) => {
const groups: string[] = get(filter, 'chain[0].arguments.filterGroup', []).filter(
const groups: string[] = (get(filter, 'chain[0].arguments.filterGroup', []) as string[]).filter(
(group: string) => group !== ''
);
const noNeedToExcludeByGroup = !(
@ -89,7 +89,7 @@ const includeFiltersByGroups = (
const groupsToInclude = filterExprAst.arguments.group ?? [];
const includeOnlyUngrouped = filterExprAst.arguments.ungrouped?.[0] ?? false;
return filters.filter((filter) => {
const groups: string[] = get(filter, 'chain[0].arguments.filterGroup', []).filter(
const groups: string[] = (get(filter, 'chain[0].arguments.filterGroup', []) as string[]).filter(
(group: string) => group !== ''
);
const needToIncludeByGroup =

View file

@ -66,14 +66,14 @@ export const serializeMigrateAndAllocateActions = (
if (!isEmpty(originalActions?.allocate?.include)) {
actions.allocate = {
...actions.allocate,
include: { ...originalActions?.allocate?.include },
include: { ...(originalActions.allocate!.include as {}) },
};
}
if (!isEmpty(originalActions?.allocate?.exclude)) {
actions.allocate = {
...actions.allocate,
exclude: { ...originalActions?.allocate?.exclude },
exclude: { ...(originalActions.allocate!.exclude as {}) },
};
}
break;

View file

@ -695,6 +695,7 @@ export class ESSearchSource extends AbstractESSource implements IMvtVectorSource
);
}
// @ts-expect-error hit's type is `SearchHit<{}>` while `flattenHit` expects `Record<string, unknown[]>`
const properties = indexPattern.flattenHit(hit) as Record<string, string>;
indexPattern.metaFields.forEach((metaField: string) => {
if (!this._getTooltipPropertyNames().includes(metaField)) {

View file

@ -82,7 +82,7 @@ function groupFieldsByOrigin(fields: StyleField[]) {
type Props = {
fields: StyleField[];
selectedFieldName: string;
selectedFieldName?: string;
onChange: ({ field }: { field: StyleField | null }) => void;
styleName: VECTOR_STYLES;
} & Omit<

View file

@ -301,9 +301,7 @@ export class DynamicStyleProperty<T extends object>
return this.getDataMappingFunction() === DATA_MAPPING_FUNCTION.INTERPOLATE
? this._field.getExtendedStatsFieldMetaRequest()
: this._field.getPercentilesFieldMetaRequest(
this.getFieldMetaOptions().percentiles !== undefined
? this.getFieldMetaOptions().percentiles
: DEFAULT_PERCENTILES
this.getFieldMetaOptions().percentiles ?? DEFAULT_PERCENTILES
);
}
@ -331,7 +329,7 @@ export class DynamicStyleProperty<T extends object>
return this.usesFeatureState() ? MB_LOOKUP_FUNCTION.FEATURE_STATE : MB_LOOKUP_FUNCTION.GET;
}
getFieldMetaOptions() {
getFieldMetaOptions(): FieldMetaOptions {
const fieldMetaOptions = _.get(this.getOptions(), 'fieldMetaOptions', { isEnabled: true });
// In 8.0, UI changed to not allow setting isEnabled to false when fieldMeta from local not supported

View file

@ -69,7 +69,7 @@ export class Join extends Component<Props, State> {
this._isMounted = false;
}
async _loadRightFields(indexPatternId: string) {
async _loadRightFields(indexPatternId?: string) {
if (!indexPatternId) {
return;
}

View file

@ -1237,11 +1237,11 @@ export function anomalyChartsDataProvider(mlClient: MlClient, client: IScopedClu
// If the job uses aggregation or scripted fields, and if it's a config we don't support
// use model plot data if model plot is enabled
// else if source data can be plotted, use that, otherwise model plot will be available.
// @ts-ignore
// @ts-expect-error
const useSourceData = isSourceDataChartableForDetector(job, detectorIndex);
if (useSourceData) {
const datafeedQuery = get(config, 'datafeedConfig.query', null);
const datafeedQuery = get(config, 'datafeedConfig.query');
try {
return await fetchMetricData(

View file

@ -11,7 +11,7 @@ import { useKibana } from '@kbn/kibana-react-plugin/public';
// TODO: verify that works for all pages
export function useTitle(cluster: string, suffix: string) {
const { services } = useKibana();
let clusterName = get(cluster, 'cluster_name');
let clusterName: string | undefined = get(cluster, 'cluster_name');
clusterName = clusterName ? `- ${clusterName}` : '';
suffix = suffix ? `- ${suffix}` : '';

View file

@ -92,7 +92,7 @@ export const updateSetupModeData = async (uuid?: string, fetchWithoutClusterUuid
const clusterUuid = globalState.cluster_uuid;
if (!clusterUuid) {
const liveClusterUuid: string = get(data, '_meta.liveClusterUuid');
const liveClusterUuid: string | undefined = get(data, '_meta.liveClusterUuid');
const migratedEsNodes = Object.values(get(data, 'elasticsearch.byUuid', {})).filter(
(node: any) => node.isPartiallyMigrated || node.isFullyMigrated
);

View file

@ -41,6 +41,6 @@ describe('fetchLicenseType', () => {
})),
} as unknown as ElasticsearchClient;
const result = await fetchLicenseType(customCallCluster, availableCcs, clusterUuid);
expect(result).toStrictEqual(null);
expect(result).toBeUndefined();
});
});

View file

@ -56,5 +56,5 @@ export async function fetchLicenseType(
},
};
const response = await client.search(params);
return get(response, 'hits.hits[0]._source.license.type', null);
return get(response, 'hits.hits[0]._source.license.type') as string | undefined;
}

View file

@ -12,7 +12,7 @@ export interface MonitoringUsage {
export interface MonitoringClusterStackProductUsage {
clusterUuid: string;
license: string;
license?: string;
metricbeatUsed: boolean;
elasticsearch: StackProductUsage;
logstash: StackProductUsage;

View file

@ -82,7 +82,7 @@ describe('fetchCpuUsageNodeStats', () => {
containerUsage: undefined,
containerPeriods: undefined,
containerQuota: undefined,
ccs: null,
ccs: undefined,
},
]);
});
@ -149,7 +149,7 @@ describe('fetchCpuUsageNodeStats', () => {
containerUsage: 10,
containerPeriods: 5,
containerQuota: 50,
ccs: null,
ccs: undefined,
},
]);
});

View file

@ -170,12 +170,12 @@ export async function fetchCpuUsageNodeStats(
const stat = {
clusterUuid: clusterBucket.key,
nodeId: node.key,
nodeName: get(node, 'name.buckets[0].key'),
cpuUsage: get(node, 'average_cpu.value'),
containerUsage: get(lastBucket, 'usage_deriv.normalized_value'),
containerPeriods: get(lastBucket, 'periods_deriv.normalized_value'),
containerQuota: get(node, 'average_quota.value'),
ccs: indexName.includes(':') ? indexName.split(':')[0] : null,
nodeName: get(node, 'name.buckets[0].key') as unknown as string,
cpuUsage: get(node, 'average_cpu.value') as number,
containerUsage: get(lastBucket, 'usage_deriv.normalized_value') as unknown as number,
containerPeriods: get(lastBucket, 'periods_deriv.normalized_value') as unknown as number,
containerQuota: get(node, 'average_quota.value') as unknown as number,
ccs: indexName.includes(':') ? indexName.split(':')[0] : undefined,
};
stats.push(stat);
}

View file

@ -105,14 +105,14 @@ describe('fetchMissingMonitoringData', () => {
nodeName: 'nodeName1',
clusterUuid: 'clusterUuid1',
gapDuration: 1,
ccs: null,
ccs: undefined,
},
{
nodeId: 'nodeUuid2',
nodeName: 'nodeName2',
clusterUuid: 'clusterUuid1',
gapDuration: 8,
ccs: null,
ccs: undefined,
},
]);
});

View file

@ -163,7 +163,7 @@ export async function fetchMissingMonitoringData(
nodeName,
clusterUuid,
gapDuration: differenceInMs,
ccs: indexName.includes(':') ? indexName.split(':')[0] : null,
ccs: indexName.includes(':') ? indexName.split(':')[0] : undefined,
};
}
}

View file

@ -64,7 +64,7 @@ function defaultCalculation(
metric?: Metric,
defaultSizeInSeconds?: number
) {
const legacyValue: number = get(bucket, key, null);
const legacyValue: number = get(bucket, key, -1);
const mbValue = bucket.metric_mb_deriv?.normalized_value ?? null;
let value;
if (mbValue !== null && !isNaN(mbValue) && mbValue > 0) {

View file

@ -37,7 +37,7 @@ export function handleResponse(
cluster,
'elasticsearch.cluster.stats.state.master_node',
get(cluster, 'cluster_state.master_node')
);
) as string;
nodes = resp.aggregations?.nodes.buckets.reduce(normalizeNodeShards(masterNode), {}) ?? [];
}

View file

@ -66,7 +66,7 @@ export class QuotaMetric extends Metric {
};
this.calculation = (bucket: object) => {
const quota = get(bucket, 'quota.value');
const quota = get(bucket, 'quota.value', 0);
const deltaUsageDerivNormalizedValue = get(bucket, 'usage_deriv.normalized_value');
const periodsDerivNormalizedValue = get(bucket, 'periods_deriv.normalized_value');

View file

@ -82,7 +82,7 @@ export class DifferenceMetric extends ElasticsearchMetric {
this.getFields = () => [`${fieldSource}.${metric}`, `${fieldSource}.${metric2}`];
this.calculation = (bucket: object) => {
return _.get(bucket, 'metric_max.value') - _.get(bucket, 'metric2_max.value');
return _.get(bucket, 'metric_max.value', 0) - _.get(bucket, 'metric2_max.value', 0);
};
}
}
@ -369,7 +369,8 @@ export class WriteThreadPoolRejectedMetric extends ElasticsearchMetric {
const write = _.get(bucket, 'write_deriv.normalized_value', null);
if (index !== null || bulk !== null || write !== null) {
const valueOrZero = (value: number) => (value < 0 ? 0 : value || 0);
const valueOrZero = (value: number | null) =>
value === null || value < 0 ? 0 : value || 0;
return valueOrZero(index) + valueOrZero(bulk) + valueOrZero(write);
}
@ -394,7 +395,7 @@ export class MillisecondsToSecondsMetric extends ElasticsearchMetric {
}),
});
this.calculation = (bucket: object) => {
return _.get(bucket, 'metric.value') / 1000;
return _.get(bucket, 'metric.value', 0) / 1000;
};
}
}

View file

@ -301,8 +301,8 @@ export class LogstashPipelineQueueSizeMetric extends LogstashMetric {
},
};
this.calculation = (bucket: object) => {
const legacyQueueSize = _.get(bucket, 'pipelines.total_queue_size_for_node.value');
const mbQueueSize = _.get(bucket, 'pipelines_mb.total_queue_size_for_node.value');
const legacyQueueSize = _.get(bucket, 'pipelines.total_queue_size_for_node.value', 0);
const mbQueueSize = _.get(bucket, 'pipelines_mb.total_queue_size_for_node.value', 0);
return Math.max(legacyQueueSize, mbQueueSize);
};
}

View file

@ -328,6 +328,7 @@ export function ccrRoute(server: MonitoringCore) {
);
const follows = remoteCluster ? `${leaderIndex} on ${remoteCluster}` : leaderIndex;
// @ts-expect-error `shards.error` type mismatch (error: string | undefined vs. error: { error: string | undefined })
const shards: CcrShard[] = get(bucket, 'by_shard_id.buckets').map(
(shardBucket: CcrShardBucket) => buildShardStats({ bucket, fullStats, shardBucket })
);

View file

@ -91,7 +91,7 @@ export function esIndexRoute(server: MonitoringCore) {
cluster,
'elasticsearch.cluster.stats.state.state_uuid',
get(cluster, 'cluster_state.state_uuid')
);
) as string;
const allocationOptions = {
shardFilter,
stateUuid,

View file

@ -94,6 +94,7 @@ export function esNodeRoute(server: MonitoringCore) {
includeNodes: true,
nodeUuid,
});
// @ts-expect-error `clusterState.master_node` types are incompatible
const nodeSummary = await getNodeSummary(req, clusterState, shardStats, {
clusterUuid,
nodeUuid,
@ -119,7 +120,7 @@ export function esNodeRoute(server: MonitoringCore) {
cluster,
'cluster_state.state_uuid',
get(cluster, 'elasticsearch.cluster.stats.state.state_uuid')
);
)!;
const allocationOptions = {
shardFilter,
stateUuid,

View file

@ -156,12 +156,14 @@ function groupInstancesByCluster<T extends { cluster_uuid?: string }>(
// hits are sorted arbitrarily by product UUID
instances.map((instance) => {
const clusterUuid = instance._source!.cluster_uuid;
const version: string | undefined = get(
instance,
`_source.${product}_stats.${product}.version`
);
const cloud: CloudEntry | undefined = get(instance, `_source.${product}_stats.cloud`);
const os: OSData | undefined = get(instance, `_source.${product}_stats.os`);
const version: string | undefined = get(instance, [
`_source`,
`${product}_stats`,
product,
`version`,
]);
const cloud: CloudEntry | undefined = get(instance, [`_source`, `${product}_stats`, `cloud`]);
const os: OSData | undefined = get(instance, [`_source`, `${product}_stats`, `os`]);
if (clusterUuid) {
let cluster = clusterMap.get(clusterUuid);

View file

@ -90,9 +90,9 @@ function onPackagePolicyDelete({
const internalESClient = coreStart.elasticsearch.client.asInternalUser;
const [agentConfigApiKeyId] = get(packagePolicy, AGENT_CONFIG_API_KEY_PATH).split(':');
const [agentConfigApiKeyId] = get(packagePolicy, AGENT_CONFIG_API_KEY_PATH, '').split(':');
const [sourceMapApiKeyId] = get(packagePolicy, SOURCE_MAP_API_KEY_PATH).split(':');
const [sourceMapApiKeyId] = get(packagePolicy, SOURCE_MAP_API_KEY_PATH, '').split(':');
logger.debug(
`Deleting API keys: ${agentConfigApiKeyId}, ${sourceMapApiKeyId} (package policy: ${packagePolicy.id})`

View file

@ -70,7 +70,7 @@ export const getChartName = (
* just returns null if the color doesn't exists in the overrides.
*/
export const getChartColor = (seriesOverrides: SeriesOverrides | undefined, seriesId: string) => {
const rawColor: string | null = seriesOverrides
const rawColor: string | null | undefined = seriesOverrides
? get(seriesOverrides, [seriesId, 'color'])
: null;
if (!rawColor) {

View file

@ -44,8 +44,8 @@ export const getLogRateAnalysisEQQuery = (
return;
}
const group: Group[] | undefined = get(alert, 'fields["kibana.alert.group"]');
const optionalFilter: string | undefined = get(params.searchConfiguration, 'query.query');
const group = get(alert, 'fields["kibana.alert.group"]') as Group[] | undefined;
const optionalFilter = get(params.searchConfiguration, 'query.query') as string | undefined;
const groupByFilters = getGroupFilters(group);
const boolQuery = buildEsQuery({
kuery: getKuery(params.criteria[0].metrics, optionalFilter),

View file

@ -21,7 +21,7 @@ import type { FC } from 'react';
import React, { useCallback, useMemo, useRef, useState } from 'react';
import styled from 'styled-components';
import type { Cancelable } from 'lodash';
import type { DebouncedFunc } from 'lodash';
import { debounce } from 'lodash';
import type {
EqlOptionsData,
@ -79,7 +79,7 @@ export const EqlQueryBarFooter: FC<Props> = ({
}) => {
const [openEqlSettings, setIsOpenEqlSettings] = useState(false);
const [localSize, setLocalSize] = useState<string | number>(optionsSelected?.size ?? 100);
const debounceSize = useRef<Cancelable & SizeVoidFunc>();
const debounceSize = useRef<DebouncedFunc<SizeVoidFunc>>();
const openEqlSettingsHandler = useCallback(() => {
setIsOpenEqlSettings(true);

View file

@ -969,12 +969,12 @@ export const getAlertHighlightedFields = (
alertData: AlertData,
ruleCustomHighlightedFields: string[]
): EventSummaryField[] => {
const eventCategory = get(alertData, EVENT_CATEGORY);
const eventCategory = get(alertData, EVENT_CATEGORY) as string | string[];
const eventCode = get(alertData, EVENT_CODE);
const eventRuleType = get(alertData, KIBANA_ALERT_RULE_TYPE);
const eventCategories = {
primaryEventCategory: Array.isArray(eventCategory) ? eventCategory[0] : eventCategory,
allEventCategories: [eventCategory],
allEventCategories: Array.isArray(eventCategory) ? eventCategory : [eventCategory],
};
const fieldsToDisplay = getEventFieldsToDisplay({

View file

@ -13,6 +13,7 @@ import { EuiBetaBadge, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { ExpandablePanel } from '@kbn/security-solution-common';
import type { Type } from '@kbn/securitysolution-io-ts-alerting-types';
import {
CORRELATIONS_DETAILS_SUPPRESSED_ALERTS_SECTION_TEST_ID,
SUPPRESSED_ALERTS_SECTION_TECHNICAL_PREVIEW_TEST_ID,
@ -61,7 +62,7 @@ export const SuppressedAlerts: React.FC<SuppressedAlertsProps> = ({
values={{ count: alertSuppressionCount }}
/>
</EuiFlexItem>
{isSuppressionRuleInGA(ruleType) ? null : (
{isSuppressionRuleInGA(ruleType as Type) ? null : (
<EuiFlexItem>
<EuiBetaBadge
label={SUPPRESSED_ALERTS_COUNT_TECHNICAL_PREVIEW}

View file

@ -13,6 +13,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { ALERT_RULE_TYPE } from '@kbn/rule-data-utils';
import { ExpandablePanel } from '@kbn/security-solution-common';
import type { Type } from '@kbn/securitysolution-io-ts-alerting-types';
import { useShowRelatedAlertsBySession } from '../../shared/hooks/use_show_related_alerts_by_session';
import { RelatedAlertsBySession } from './related_alerts_by_session';
import { useShowRelatedAlertsBySameSourceEvent } from '../../shared/hooks/use_show_related_alerts_by_same_source_event';
@ -100,7 +101,7 @@ export const CorrelationsOverview: React.FC = () => {
showCases ||
showSuppressedAlerts;
const ruleType = get(dataAsNestedObject, ALERT_RULE_TYPE)?.[0];
const ruleType = get(dataAsNestedObject, ALERT_RULE_TYPE)?.[0] as Type | undefined;
const link = useMemo(
() =>

View file

@ -39,6 +39,9 @@ export const responseActionTasks = (
}
const signed = get(newActionDoc, '_source.signed');
if (!signed) {
throw new Error('no signed data in the action doc');
}
const signedDataBuffer = Buffer.from(signed.data, 'base64');
const signedDataJson = JSON.parse(signedDataBuffer.toString());
const tamperedData = {

View file

@ -19,6 +19,7 @@ const getIndicatorEcs = (data: Ecs): ThreatIndicatorEcs[] => {
} else if (!Array.isArray(threatData)) {
return [threatData];
}
// @ts-expect-error the returned type is ThreatEnrichmentEcs[]
return threatData;
};

View file

@ -82,7 +82,7 @@ describe('threatMatchRowRenderer', () => {
const NO_OF_MATCHES = 20;
const largeNoOfIndicatorMatches = new Array(NO_OF_MATCHES)
.fill({})
.map(() => get(threatMatchData, ENRICHMENT_DESTINATION_PATH)[0] as Fields);
.map(() => get(threatMatchData, ENRICHMENT_DESTINATION_PATH)![0] as Fields);
const modThreatMatchData: typeof threatMatchData = {
...threatMatchData,

View file

@ -15,7 +15,6 @@ import {
} from '../../../common/mocks/constants/session_view_process.mock';
import { AppContextTestRender, createAppRootMockRenderer } from '../../test';
import { ProcessDeps, ProcessTreeNode } from '.';
import { Cancelable } from 'lodash';
import { DEBOUNCE_TIMEOUT } from '../../../common/constants';
import { useDateFormat } from '../../hooks';
@ -101,10 +100,10 @@ describe('ProcessTreeNode component', () => {
current: {
...props.scrollerRef.current,
clientHeight: -500,
addEventListener: (_event: string, scrollFn: (() => void) & Cancelable) => {
addEventListener: (_event: string, scrollFn: () => void) => {
scrollFn();
},
removeEventListener: (_event: string, _fn: (() => void) & Cancelable) => {},
removeEventListener: (_event: string, _fn: () => void) => {},
},
} as RefObject<HTMLDivElement>;

View file

@ -297,7 +297,7 @@ function checkHitsForDateOutOfRange(
const outsideTimeRange = 'outside the query time range';
for (const hit of hits) {
const dateVal = get(hit, `_source.${timeField}`);
const dateVal = get(hit, [`_source`, timeField]);
const epochDate = getEpochDateFromString(dateVal);
if (epochDate) {

View file

@ -184,7 +184,7 @@ export default function apiKeyBackfillTests({ getService }: FtrProviderContext)
// check that the ad hoc run SO was created
const adHocRunSO1 = (await getAdHocRunSO(result[0].id)) as SavedObject<AdHocRunSO>;
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params');
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params')!;
expect(typeof adHocRun1.apiKeyId).to.be('string');
expect(typeof adHocRun1.apiKeyToUse).to.be('string');
expect(typeof adHocRun1.createdAt).to.be('string');

View file

@ -103,13 +103,13 @@ export default function deleteRuleForBackfillTests({ getService }: FtrProviderCo
// check that the ad hoc run SOs were created
const adHocRunSO1 = (await getAdHocRunSO(backfillId1)) as SavedObject<AdHocRunSO>;
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params');
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params')!;
expect(adHocRun1).not.to.be(undefined);
const adHocRunSO2 = (await getAdHocRunSO(backfillId2)) as SavedObject<AdHocRunSO>;
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params');
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params')!;
expect(adHocRun2).not.to.be(undefined);
const adHocRunSO3 = (await getAdHocRunSO(backfillId3)) as SavedObject<AdHocRunSO>;
const adHocRun3: AdHocRunSO = get(adHocRunSO3, 'ad_hoc_run_params');
const adHocRun3: AdHocRunSO = get(adHocRunSO3, 'ad_hoc_run_params')!;
expect(adHocRun3).not.to.be(undefined);
// check that the scheduled tasks were created

View file

@ -232,9 +232,15 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
// check that the ad hoc run SO was created
const adHocRunSO1 = (await getAdHocRunSO(result[0].id)) as SavedObject<AdHocRunSO>;
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params');
const adHocRun1: AdHocRunSO = get(
adHocRunSO1,
'ad_hoc_run_params'
) as unknown as AdHocRunSO;
const adHocRunSO2 = (await getAdHocRunSO(result[1].id)) as SavedObject<AdHocRunSO>;
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params');
const adHocRun2: AdHocRunSO = get(
adHocRunSO2,
'ad_hoc_run_params'
) as unknown as AdHocRunSO;
expect(typeof adHocRun1.apiKeyId).to.be('string');
expect(typeof adHocRun1.apiKeyToUse).to.be('string');
@ -435,11 +441,11 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
// check that the ad hoc run SO was created
const adHocRunSO1 = (await getAdHocRunSO(result[0].id)) as SavedObject<AdHocRunSO>;
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params');
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params')!;
const adHocRunSO2 = (await getAdHocRunSO(result[1].id)) as SavedObject<AdHocRunSO>;
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params');
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params')!;
const adHocRunSO3 = (await getAdHocRunSO(result[2].id)) as SavedObject<AdHocRunSO>;
const adHocRun3: AdHocRunSO = get(adHocRunSO3, 'ad_hoc_run_params');
const adHocRun3: AdHocRunSO = get(adHocRunSO3, 'ad_hoc_run_params')!;
expect(typeof adHocRun1.apiKeyId).to.be('string');
expect(typeof adHocRun1.apiKeyToUse).to.be('string');
@ -940,11 +946,11 @@ export default function scheduleBackfillTests({ getService }: FtrProviderContext
// check that the expected ad hoc run SOs were created
const adHocRunSO1 = (await getAdHocRunSO(result[0].id)) as SavedObject<AdHocRunSO>;
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params');
const adHocRun1: AdHocRunSO = get(adHocRunSO1, 'ad_hoc_run_params')!;
const adHocRunSO2 = (await getAdHocRunSO(result[1].id)) as SavedObject<AdHocRunSO>;
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params');
const adHocRun2: AdHocRunSO = get(adHocRunSO2, 'ad_hoc_run_params')!;
const adHocRunSO3 = (await getAdHocRunSO(result[5].id)) as SavedObject<AdHocRunSO>;
const adHocRun3: AdHocRunSO = get(adHocRunSO3, 'ad_hoc_run_params');
const adHocRun3: AdHocRunSO = get(adHocRunSO3, 'ad_hoc_run_params')!;
expect(typeof adHocRun1.apiKeyId).to.be('string');
expect(typeof adHocRun1.apiKeyToUse).to.be('string');

View file

@ -142,7 +142,7 @@ export default function ApiTest(ftrProviderContext: FtrProviderContext) {
});
it('has api key that provides access to source maps only', async () => {
const [id, apiKey] = get(apmPackagePolicy, SOURCE_MAP_API_KEY_PATH).split(':');
const [id, apiKey] = get(apmPackagePolicy, SOURCE_MAP_API_KEY_PATH, '').split(':');
expect(id).to.not.be.empty();
expect(apiKey).to.not.be.empty();
@ -152,7 +152,7 @@ export default function ApiTest(ftrProviderContext: FtrProviderContext) {
});
it('has api api key that provides access to the agent configurations index', async () => {
const [id, apiKey] = get(apmPackagePolicy, AGENT_CONFIG_API_KEY_PATH).split(':');
const [id, apiKey] = get(apmPackagePolicy, AGENT_CONFIG_API_KEY_PATH, '').split(':');
expect(id).to.not.be.empty();
expect(apiKey).to.not.be.empty();
@ -165,7 +165,7 @@ export default function ApiTest(ftrProviderContext: FtrProviderContext) {
});
it('throws when querying agent config index with source map api key', async () => {
const [id, apiKey] = get(apmPackagePolicy, SOURCE_MAP_API_KEY_PATH).split(':');
const [id, apiKey] = get(apmPackagePolicy, SOURCE_MAP_API_KEY_PATH, '').split(':');
expect(id).to.not.be.empty();
expect(apiKey).to.not.be.empty();
@ -189,7 +189,7 @@ export default function ApiTest(ftrProviderContext: FtrProviderContext) {
});
it('sets the expected agent configs on the new package policy object', async () => {
const agentConfigs = get(packagePolicyWithAgentConfig, AGENT_CONFIG_PATH);
const agentConfigs = get(packagePolicyWithAgentConfig, AGENT_CONFIG_PATH)!;
const { service, config } = agentConfigs[0];
expect(service).to.eql({});
expect(config).to.eql({ transaction_sample_rate: '0.55' });

View file

@ -56,8 +56,8 @@ export default function ({ getService }: FtrProviderContext) {
q: 'type:kql-telemetry',
})
.then((response) => {
const kqlTelemetryDoc = get(response, 'hits.hits[0]._source.kql-telemetry');
expect(kqlTelemetryDoc.optInCount).to.be(1);
const optInCount = get(response, 'hits.hits[0]._source.kql-telemetry.optInCount');
expect(optInCount).to.be(1);
});
});
@ -73,8 +73,8 @@ export default function ({ getService }: FtrProviderContext) {
q: 'type:kql-telemetry',
})
.then((response) => {
const kqlTelemetryDoc = get(response, 'hits.hits[0]._source.kql-telemetry');
expect(kqlTelemetryDoc.optOutCount).to.be(1);
const optOutCount = get(response, 'hits.hits[0]._source.kql-telemetry.optOutCount');
expect(optOutCount).to.be(1);
});
});

View file

@ -10858,11 +10858,6 @@
"@types/node" "*"
"@types/webpack" "^4"
"@types/lodash@^4.14.159":
version "4.14.159"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.159.tgz#61089719dc6fdd9c5cb46efc827f2571d1517065"
integrity sha512-gF7A72f7WQN33DpqOWw9geApQPh4M3PxluMtaHxWHXEGSN12/WbcEk/eNSqWNQcQhF66VSZ06vCF94CrHwXJDg==
"@types/lodash@^4.14.167":
version "4.14.184"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe"
@ -10873,6 +10868,11 @@
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.0.tgz#d774355e41f372d5350a4d0714abb48194a489c3"
integrity sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==
"@types/lodash@^4.17.10":
version "4.17.10"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.10.tgz#64f3edf656af2fe59e7278b73d3e62404144a6e6"
integrity sha512-YpS0zzoduEhuOWjAotS6A5AVCva7X4lVlYLF0FYHAY9sdraBfnatttHItlWeZdGhuEkf+OzMNg2ZYAx8t+52uQ==
"@types/long@^4.0.1":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"