Skip to content

Commit

Permalink
Fix malformed geo alerts call to transformResults (#98094) (#99131)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Aaron Caldwell and kibanamachine authored May 3, 2021
1 parent 0c4ad87 commit 89164bf
Show file tree
Hide file tree
Showing 6 changed files with 1,068 additions and 373 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export interface GeoContainmentParams extends AlertTypeParams {
export interface GeoContainmentState extends AlertTypeState {
shapesFilters: Record<string, unknown>;
shapesIdsNamesMap: Record<string, unknown>;
prevLocationMap: Record<string, unknown>;
}
export interface GeoContainmentInstanceState extends AlertInstanceState {
location: number[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
GeoContainmentInstanceState,
GeoContainmentAlertType,
GeoContainmentInstanceContext,
GeoContainmentState,
} from './alert_type';

export type LatestEntityLocation = GeoContainmentInstanceState;
Expand Down Expand Up @@ -141,7 +142,7 @@ export const getGeoContainmentExecutor = (log: Logger): GeoContainmentAlertType[
params,
alertId,
state,
}) {
}): Promise<GeoContainmentState> {
const { shapesFilters, shapesIdsNamesMap } = state.shapesFilters
? state
: await getShapesFilters(
Expand Down Expand Up @@ -176,8 +177,7 @@ export const getGeoContainmentExecutor = (log: Logger): GeoContainmentAlertType[
}

const currLocationMap: Map<string, LatestEntityLocation[]> = transformResults(
// @ts-expect-error body doesn't exist on currentIntervalResults
currentIntervalResults?.body,
currentIntervalResults,
params.dateField,
params.geoField
);
Expand Down
Loading

0 comments on commit 89164bf

Please sign in to comment.