Skip to content

Commit

Permalink
Minimize dependencies required by our telemetry middleware (#64665) (#…
Browse files Browse the repository at this point in the history
…64818)

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).
  • Loading branch information
rylnd authored Apr 30, 2020
1 parent 824b83f commit 26c7b79
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/siem/public/lib/telemetry/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Action, Dispatch, MiddlewareAPI } from 'redux';

import { track, METRIC_TYPE, TELEMETRY_EVENT } from './';
import { timelineActions } from '../../store/actions';
import * as timelineActions from '../../store/timeline/actions';

export const telemetryMiddleware = (api: MiddlewareAPI) => (next: Dispatch) => (action: Action) => {
if (timelineActions.endTimelineSaving.match(action)) {
Expand Down
13 changes: 1 addition & 12 deletions x-pack/plugins/siem/public/store/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,4 @@ export { dragAndDropModel } from './drag_and_drop';
export { hostsModel } from './hosts';
export { inputsModel } from './inputs';
export { networkModel } from './network';

export type KueryFilterQueryKind = 'kuery' | 'lucene';

export interface KueryFilterQuery {
kind: KueryFilterQueryKind;
expression: string;
}

export interface SerializedFilterQuery {
kuery: KueryFilterQuery | null;
serializedQuery: string;
}
export * from './types';
2 changes: 1 addition & 1 deletion x-pack/plugins/siem/public/store/timeline/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
DataProvider,
QueryOperator,
} from '../../components/timeline/data_providers/data_provider';
import { KueryFilterQuery, SerializedFilterQuery } from '../model';
import { KueryFilterQuery, SerializedFilterQuery } from '../types';

import { EventType, KqlMode, TimelineModel, ColumnHeaderOptions } from './model';
import { TimelineNonEcsData } from '../../graphql/types';
Expand Down
17 changes: 17 additions & 0 deletions x-pack/plugins/siem/public/store/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export type KueryFilterQueryKind = 'kuery' | 'lucene';

export interface KueryFilterQuery {
kind: KueryFilterQueryKind;
expression: string;
}

export interface SerializedFilterQuery {
kuery: KueryFilterQuery | null;
serializedQuery: string;
}

0 comments on commit 26c7b79

Please sign in to comment.