Skip to content

Commit 505f981

Browse files
committed
Minimize dependencies required by our telemetry middleware
1. we need our redux actions for our telemetry middleware, which: 2. require types from an index file, which: 3. includes all of our model types, and everything involved in them By moving these types to a separate file and importing _that_instead, we bypass inclusion of 2 and 3 in our plugin, which equates to ~550kB (of a total of ~600kB).
1 parent 2366513 commit 505f981

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

x-pack/plugins/siem/public/lib/telemetry/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { Action, Dispatch, MiddlewareAPI } from 'redux';
88

99
import { track, METRIC_TYPE, TELEMETRY_EVENT } from './';
10-
import { timelineActions } from '../../store/actions';
10+
import * as timelineActions from '../../store/timeline/actions';
1111

1212
export const telemetryMiddleware = (api: MiddlewareAPI) => (next: Dispatch) => (action: Action) => {
1313
if (timelineActions.endTimelineSaving.match(action)) {

x-pack/plugins/siem/public/store/model.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,4 @@ export { dragAndDropModel } from './drag_and_drop';
99
export { hostsModel } from './hosts';
1010
export { inputsModel } from './inputs';
1111
export { networkModel } from './network';
12-
13-
export type KueryFilterQueryKind = 'kuery' | 'lucene';
14-
15-
export interface KueryFilterQuery {
16-
kind: KueryFilterQueryKind;
17-
expression: string;
18-
}
19-
20-
export interface SerializedFilterQuery {
21-
kuery: KueryFilterQuery | null;
22-
serializedQuery: string;
23-
}
12+
export * from './types';

x-pack/plugins/siem/public/store/timeline/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
DataProvider,
1313
QueryOperator,
1414
} from '../../components/timeline/data_providers/data_provider';
15-
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
15+
import { KueryFilterQuery, SerializedFilterQuery } from '../types';
1616

1717
import { EventType, KqlMode, TimelineModel, ColumnHeaderOptions } from './model';
1818
import { TimelineNonEcsData } from '../../graphql/types';
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
export type KueryFilterQueryKind = 'kuery' | 'lucene';
8+
9+
export interface KueryFilterQuery {
10+
kind: KueryFilterQueryKind;
11+
expression: string;
12+
}
13+
14+
export interface SerializedFilterQuery {
15+
kuery: KueryFilterQuery | null;
16+
serializedQuery: string;
17+
}

0 commit comments

Comments
 (0)