Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES body removal] @elastic/kibana-cloud-security-posture #204860

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { EuiBadge, EuiIcon, EuiTextColor } from '@elastic/eui';
import React from 'react';
import { css } from '@emotion/react';
import { float } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { float } from '@elastic/elasticsearch/lib/api/types';
import type { VulnSeverity } from '@kbn/cloud-security-posture-common';
import { getCvsScoreColor, getSeverityStatusColor } from '../utils/get_vulnerability_colors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ export const useMisconfigurationFindings = (options: UseCspOptions) => {
rawResponse: { hits, aggregations },
} = await lastValueFrom(
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
params: buildMisconfigurationsFindingsQuery(options, rulesStates!),
params: buildMisconfigurationsFindingsQuery(
options,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
rulesStates!
) as LatestFindingsRequest['params'],
})
);
if (!aggregations && options.ignore_unavailable === false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ export const useMisconfigurationPreview = (options: UseCspOptions) => {
rawResponse: { aggregations },
} = await lastValueFrom(
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
params: buildMisconfigurationsFindingsQuery(options, rulesStates!),
params: buildMisconfigurationsFindingsQuery(
options,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
rulesStates!
) as LatestFindingsRequest['params'],
})
);
if (!aggregations && options.ignore_unavailable === false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
SearchResponse,
AggregationsMultiBucketAggregateBase,
AggregationsStringRareTermsBucketKeys,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
} from '@elastic/elasticsearch/lib/api/types';
import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest';
import type { CoreStart } from '@kbn/core/public';
import type { CspClientPluginStartDeps, UseCspOptions } from '../types';
Expand Down Expand Up @@ -47,7 +47,7 @@ export const useVulnerabilitiesFindings = (options: UseCspOptions) => {
rawResponse: { aggregations, hits },
} = await lastValueFrom(
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
params: getVulnerabilitiesQuery(options, pageParam),
params: getVulnerabilitiesQuery(options, pageParam) as LatestFindingsRequest['params'],
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
SearchResponse,
AggregationsMultiBucketAggregateBase,
AggregationsStringRareTermsBucketKeys,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
} from '@elastic/elasticsearch/lib/api/types';
import type { CspVulnerabilityFinding } from '@kbn/cloud-security-posture-common/schema/vulnerabilities/latest';
import type { CoreStart } from '@kbn/core/public';
import type { CspClientPluginStartDeps, UseCspOptions } from '../types';
Expand Down Expand Up @@ -42,7 +42,7 @@ export const useVulnerabilitiesPreview = (options: UseCspOptions) => {
rawResponse: { aggregations },
} = await lastValueFrom(
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
params: getVulnerabilitiesQuery(options, true),
params: getVulnerabilitiesQuery(options, true) as LatestFindingsRequest['params'],
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
import { SharePluginStart } from '@kbn/share-plugin/public';
import { SpacesPluginStart } from '@kbn/spaces-plugin/public';
import { CspFinding } from '@kbn/cloud-security-posture-common';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-types';

import type { BoolQuery } from '@kbn/es-query';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import {
AggregationBuckets,
getVulnerabilitiesAggregationCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import {
buildMutedRulesFilter,
CDR_MISCONFIGURATIONS_INDEX_PATTERN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types';

export const getPackagePolicyIdRuntimeMapping = (): MappingRuntimeFields => ({
package_policy_identifier: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SearchResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { SearchResponse } from '@elastic/elasticsearch/lib/api/types';
import type { IKibanaSearchResponse } from '@kbn/search-types';
import { GenericBuckets, GroupingQuery, RootAggregation } from '@kbn/grouping/src';
import { useQuery } from '@tanstack/react-query';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useInfiniteQuery } from '@tanstack/react-query';
import { number } from 'io-ts';
import { lastValueFrom } from 'rxjs';
import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-types';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type * as estypes from '@elastic/elasticsearch/lib/api/types';
import { buildDataTableRecord } from '@kbn/discover-utils';
import { EsHitRecord } from '@kbn/discover-utils/types';
import { showErrorToast } from '@kbn/cloud-security-posture';
Expand Down Expand Up @@ -150,7 +150,11 @@ export const useLatestFindings = (options: UseFindingsOptions) => {
rawResponse: { hits, aggregations },
} = await lastValueFrom(
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
params: getFindingsQuery(options, rulesStates!, pageParam), // ruleStates always exists since it under the `enabled` dependency.
params: getFindingsQuery(
options,
rulesStates!,
pageParam
) as LatestFindingsRequest['params'], // ruleStates always exists since it under the `enabled` dependency.
})
);
if (!aggregations) throw new Error('expected aggregations to be an defined');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SearchResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { SearchResponse } from '@elastic/elasticsearch/lib/api/types';
import type { IKibanaSearchResponse } from '@kbn/search-types';
import { GenericBuckets, GroupingQuery, RootAggregation } from '@kbn/grouping/src';
import { useQuery } from '@tanstack/react-query';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
SearchResponse,
AggregationsMultiBucketAggregateBase,
AggregationsStringRareTermsBucketKeys,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
} from '@elastic/elasticsearch/lib/api/types';
import { buildDataTableRecord } from '@kbn/discover-utils';
import { EsHitRecord } from '@kbn/discover-utils/types';
import {
Expand Down Expand Up @@ -118,7 +118,7 @@ export const useLatestVulnerabilities = (options: VulnerabilitiesQuery) => {
rawResponse: { hits },
} = await lastValueFrom(
data.search.search<LatestFindingsRequest, LatestFindingsResponse>({
params: getVulnerabilitiesQuery(options, pageParam),
params: getVulnerabilitiesQuery(options, pageParam) as LatestFindingsRequest['params'],
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
* 2.0.
*/

import {
IndicesIndexTemplateSummary,
Metadata,
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { IndicesIndexTemplateSummary, Metadata } from '@elastic/elasticsearch/lib/api/types';

export interface LatestIndexConfig {
findings: IndexConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SavedObjectsClientContract,
} from '@kbn/core-saved-objects-api-server';
import { transformError } from '@kbn/securitysolution-es-utils';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
import { buildMutedRulesFilter } from '@kbn/cloud-security-posture-common';
import type { CspBenchmarkRulesStates } from '@kbn/cloud-security-posture-common/schema/rules/latest';
import type { CspSettings } from '@kbn/cloud-security-posture-common/schema/rules/v4';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types';
import type { ElasticsearchClient, Logger } from '@kbn/core/server';
import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server';
import type { CspBenchmarkRule } from '@kbn/cloud-security-posture-common/schema/rules/latest';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SearchResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { SearchResponse } from '@elastic/elasticsearch/lib/api/types';
import { schema } from '@kbn/config-schema';
import { ElasticsearchClient } from '@kbn/core-elasticsearch-server';
import { transformError } from '@kbn/securitysolution-es-utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { SortCombinations } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { SortCombinations } from '@elastic/elasticsearch/lib/api/types';
import { transformError } from '@kbn/securitysolution-es-utils';
import { schema } from '@kbn/config-schema';
import type { ElasticsearchClient } from '@kbn/core/server';
Expand Down
Loading