From f115f61286c8da2e0b415b37651f022363e554d6 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 24 Jun 2020 00:54:02 +0100 Subject: [PATCH] chore(NA): migrate to lodash4 on dev_tools, discover, embeddable, es_ui)shared, expressions, home plugins --- src/plugins/dev_tools/public/plugin.ts | 2 +- src/plugins/discover/public/application/angular/context.js | 2 +- .../public/application/angular/context/api/anchor.js | 2 +- .../angular/context/api/context.predecessors.test.js | 2 +- .../angular/context/api/context.successors.test.js | 2 +- .../public/application/angular/context/query/actions.js | 4 ++-- .../application/angular/context/query_parameters/actions.js | 2 +- .../discover/public/application/angular/context_app.js | 2 +- .../discover/public/application/angular/context_state.ts | 2 +- .../directives/collapsible_sidebar/collapsible_sidebar.ts | 2 +- .../application/angular/directives/debounce/debounce.js | 2 +- .../public/application/angular/directives/fixed_scroll.js | 2 +- src/plugins/discover/public/application/angular/discover.js | 2 +- .../discover/public/application/angular/discover_state.ts | 2 +- .../application/angular/doc_table/components/table_row.ts | 2 +- .../public/application/angular/doc_table/lib/get_sort.ts | 2 +- .../public/application/angular/get_painless_error.ts | 2 +- .../public/application/angular/helpers/point_series.ts | 2 +- .../components/sidebar/discover_sidebar.test.tsx | 2 +- .../application/components/sidebar/discover_sidebar.tsx | 2 +- .../application/components/sidebar/lib/field_calculator.js | 2 +- .../components/sidebar/lib/field_calculator.test.ts | 4 ++-- .../components/sidebar/lib/get_index_pattern_field_list.ts | 2 +- .../discover/public/application/components/table/table.tsx | 2 +- .../public/application/embeddable/search_embeddable.ts | 2 +- src/plugins/discover/public/kibana_services.ts | 2 ++ .../embeddable/public/lib/embeddables/embeddable.tsx | 2 +- .../public/components/cron_editor/cron_editor.js | 6 +++--- .../public/components/json_editor/json_editor.tsx | 2 +- .../ace/modes/lexer_rules/x_json_highlight_rules.ts | 2 +- .../__tests__/json_xjson_translation_tools.test.ts | 2 +- .../static/forms/hook_form_lib/hooks/use_form.ts | 2 +- .../es_ui_shared/static/forms/hook_form_lib/lib/utils.ts | 2 +- src/plugins/expressions/common/execution/execution.ts | 2 +- .../common/expression_functions/specs/kibana_context.ts | 6 +++--- .../common/expression_functions/specs/tests/utils.ts | 2 +- .../expressions/common/expression_types/specs/datatable.ts | 4 ++-- .../common/expression_types/specs/kibana_datatable.ts | 4 ++-- src/plugins/expressions/public/loader.ts | 3 ++- .../public/application/components/sample_data_set_cards.js | 2 +- .../home/public/application/components/tutorial/tutorial.js | 2 +- .../public/application/components/tutorial_directory.js | 2 +- src/plugins/home/public/application/load_tutorials.js | 2 +- .../home/server/services/sample_data/routes/uninstall.ts | 2 +- .../server/services/sample_data/usage/collector_fetch.ts | 2 +- 45 files changed, 55 insertions(+), 52 deletions(-) diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index 130d07b441b83cc..3d0ef64819ad944 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -20,7 +20,7 @@ import { BehaviorSubject } from 'rxjs'; import { AppUpdater, CoreSetup, Plugin } from 'kibana/public'; import { i18n } from '@kbn/i18n'; -import { sortBy } from 'lodash'; +import { sortBy } from 'lodash4'; import { KibanaLegacySetup } from '../../kibana_legacy/public'; import { CreateDevToolArgs, DevToolApp, createDevToolApp } from './dev_tool'; import { AppNavLinkStatus, DEFAULT_APP_CATEGORIES } from '../../../core/public'; diff --git a/src/plugins/discover/public/application/angular/context.js b/src/plugins/discover/public/application/angular/context.js index a6f591eebb52d08..2db7735dbc091b4 100644 --- a/src/plugins/discover/public/application/angular/context.js +++ b/src/plugins/discover/public/application/angular/context.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { i18n } from '@kbn/i18n'; import { CONTEXT_DEFAULT_SIZE_SETTING } from '../../../common'; import { getAngularModule, getServices } from '../../kibana_services'; diff --git a/src/plugins/discover/public/application/angular/context/api/anchor.js b/src/plugins/discover/public/application/angular/context/api/anchor.js index 4df5ba989f7985d..74aa2404497fc3d 100644 --- a/src/plugins/discover/public/application/angular/context/api/anchor.js +++ b/src/plugins/discover/public/application/angular/context/api/anchor.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { i18n } from '@kbn/i18n'; export function fetchAnchorProvider(indexPatterns, searchSource) { diff --git a/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js b/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js index fcde2ade0b2c6df..2e656a7bb3caf04 100644 --- a/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js +++ b/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js @@ -18,7 +18,7 @@ */ import moment from 'moment'; -import * as _ from 'lodash'; +import * as _ from 'lodash4'; import { createIndexPatternsStub, createContextSearchSourceStub } from './_stubs'; import { fetchContextProvider } from './context'; import { setServices } from '../../../../kibana_services'; diff --git a/src/plugins/discover/public/application/angular/context/api/context.successors.test.js b/src/plugins/discover/public/application/angular/context/api/context.successors.test.js index 0f84aa82a989a60..64ed20c06d67080 100644 --- a/src/plugins/discover/public/application/angular/context/api/context.successors.test.js +++ b/src/plugins/discover/public/application/angular/context/api/context.successors.test.js @@ -18,7 +18,7 @@ */ import moment from 'moment'; -import * as _ from 'lodash'; +import * as _ from 'lodash4'; import { createIndexPatternsStub, createContextSearchSourceStub } from './_stubs'; import { setServices } from '../../../../kibana_services'; diff --git a/src/plugins/discover/public/application/angular/context/query/actions.js b/src/plugins/discover/public/application/angular/context/query/actions.js index 0e057e0a715c415..b639e73e3c097dd 100644 --- a/src/plugins/discover/public/application/angular/context/query/actions.js +++ b/src/plugins/discover/public/application/angular/context/query/actions.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { getServices } from '../../../../kibana_services'; @@ -70,7 +70,7 @@ export function QueryActionsProvider(Promise) { setLoadingStatus(state)('anchor'); return Promise.try(() => - fetchAnchor(indexPatternId, anchorId, [_.zipObject([sort]), { [tieBreakerField]: sort[1] }]) + fetchAnchor(indexPatternId, anchorId, [_.fromPairs([sort]), { [tieBreakerField]: sort[1] }]) ).then( (anchorDocument) => { setLoadedStatus(state)('anchor'); diff --git a/src/plugins/discover/public/application/angular/context/query_parameters/actions.js b/src/plugins/discover/public/application/angular/context/query_parameters/actions.js index fcd4b8ac02cfb44..a0fc64ad12ad4fc 100644 --- a/src/plugins/discover/public/application/angular/context/query_parameters/actions.js +++ b/src/plugins/discover/public/application/angular/context/query_parameters/actions.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { esFilters } from '../../../../../../data/public'; import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE, QUERY_PARAMETER_KEYS } from './constants'; diff --git a/src/plugins/discover/public/application/angular/context_app.js b/src/plugins/discover/public/application/angular/context_app.js index f698ed84a8948f5..274eff2ffa24cb4 100644 --- a/src/plugins/discover/public/application/angular/context_app.js +++ b/src/plugins/discover/public/application/angular/context_app.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { CONTEXT_STEP_SETTING, CONTEXT_TIE_BREAKER_FIELDS_SETTING } from '../../../common'; import { getAngularModule, getServices } from '../../kibana_services'; import contextAppTemplate from './context_app.html'; diff --git a/src/plugins/discover/public/application/angular/context_state.ts b/src/plugins/discover/public/application/angular/context_state.ts index 7a92a6ace125b31..fa76d31e66de97f 100644 --- a/src/plugins/discover/public/application/angular/context_state.ts +++ b/src/plugins/discover/public/application/angular/context_state.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { History } from 'history'; import { createStateContainer, diff --git a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts index 16fbb0af9f3fd45..edbc7affd32151a 100644 --- a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts +++ b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import $ from 'jquery'; import { IScope } from 'angular'; diff --git a/src/plugins/discover/public/application/angular/directives/debounce/debounce.js b/src/plugins/discover/public/application/angular/directives/debounce/debounce.js index 586e8ed4fab593d..b41ba00cd7e800a 100644 --- a/src/plugins/discover/public/application/angular/directives/debounce/debounce.js +++ b/src/plugins/discover/public/application/angular/directives/debounce/debounce.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; // Debounce service, angularized version of lodash debounce // borrowed heavily from https://github.com/shahata/angular-debounce diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.js b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js index 182b4aeca9a23e4..d8fbfbf42b89e5c 100644 --- a/src/plugins/discover/public/application/angular/directives/fixed_scroll.js +++ b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js @@ -18,7 +18,7 @@ */ import $ from 'jquery'; -import _ from 'lodash'; +import _ from 'lodash4'; import { DebounceProvider } from './debounce'; const SCROLLER_HEIGHT = 20; diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 8ff5af1e3a7672d..7caac582da1e2b3 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import React from 'react'; import { Subscription, Subject, merge } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; diff --git a/src/plugins/discover/public/application/angular/discover_state.ts b/src/plugins/discover/public/application/angular/discover_state.ts index 46500d9fdf85e2e..79cd8f397b0542d 100644 --- a/src/plugins/discover/public/application/angular/discover_state.ts +++ b/src/plugins/discover/public/application/angular/discover_state.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { isEqual } from 'lodash'; +import { isEqual } from 'lodash4'; import { History } from 'history'; import { createStateContainer, diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts index b1e6d27d7665638..bff18b865e658e2 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import $ from 'jquery'; // @ts-ignore import rison from 'rison-node'; diff --git a/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts b/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts index c28519692318e70..30dc7f97b1b0fbf 100644 --- a/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts +++ b/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { IndexPattern } from '../../../../../../data/public'; export type SortPairObj = Record; diff --git a/src/plugins/discover/public/application/angular/get_painless_error.ts b/src/plugins/discover/public/application/angular/get_painless_error.ts index e1e98d9df27b196..ccdc2443c01ebcd 100644 --- a/src/plugins/discover/public/application/angular/get_painless_error.ts +++ b/src/plugins/discover/public/application/angular/get_painless_error.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { get } from 'lodash'; +import { get } from 'lodash4'; export function getPainlessError(error: Error) { const rootCause: Array<{ lang: string; script: string }> | undefined = get( diff --git a/src/plugins/discover/public/application/angular/helpers/point_series.ts b/src/plugins/discover/public/application/angular/helpers/point_series.ts index 4c280bf43ea1264..a963a2fa4344744 100644 --- a/src/plugins/discover/public/application/angular/helpers/point_series.ts +++ b/src/plugins/discover/public/application/angular/helpers/point_series.ts @@ -17,7 +17,7 @@ * under the License. */ -import { uniq } from 'lodash'; +import { uniq } from 'lodash4'; import { Duration, Moment } from 'moment'; import { Unit } from '@elastic/datemath'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx index 90ade60d2073de1..0a2edcf69f90bb7 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { ReactWrapper } from 'enzyme'; // @ts-ignore import { findTestSubject } from '@elastic/eui/lib/test'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index 96e04c13d70e981..58092960107db90 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -20,7 +20,7 @@ import './discover_sidebar.scss'; import React, { useCallback, useEffect, useState, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonIcon, EuiTitle } from '@elastic/eui'; -import { sortBy } from 'lodash'; +import { sortBy } from 'lodash4'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { DiscoverField } from './discover_field'; import { DiscoverIndexPattern } from './discover_index_pattern'; diff --git a/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.js b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.js index e055d644e1f9153..eb09ba5bffe0bb0 100644 --- a/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.js +++ b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { i18n } from '@kbn/i18n'; function getFieldValues(hits, field) { diff --git a/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts index 875cbf4075aa2f4..8cc5f384672e462 100644 --- a/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; // @ts-ignore import realHits from 'fixtures/real_hits.js'; // @ts-ignore @@ -186,7 +186,7 @@ describe('fieldCalculator', function () { expect(extensions).toBeInstanceOf(Object); expect(extensions.buckets).toBeInstanceOf(Array); expect(extensions.buckets.length).toBe(3); - expect(_.pluck(extensions.buckets, 'value')).toEqual(['html', 'php', 'gif']); + expect(_.map(extensions.buckets, 'value')).toEqual(['html', 'php', 'gif']); expect(extensions.error).toBe(undefined); }); diff --git a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts index 0fcbe925e079839..19995babd9c9e78 100644 --- a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { difference, map } from 'lodash'; +import { difference, map } from 'lodash4'; import { IndexPattern, IndexPatternField } from 'src/plugins/data/public'; import { DiscoverServices } from '../../../../build_services'; diff --git a/src/plugins/discover/public/application/components/table/table.tsx b/src/plugins/discover/public/application/components/table/table.tsx index 9b95f2fc6bd27f5..4733727aac25cdf 100644 --- a/src/plugins/discover/public/application/components/table/table.tsx +++ b/src/plugins/discover/public/application/components/table/table.tsx @@ -17,7 +17,7 @@ * under the License. */ import React, { useState } from 'react'; -import { escapeRegExp } from 'lodash'; +import { escapeRegExp } from 'lodash4'; import { DocViewTableRow } from './table_row'; import { arrayContainsObjects, trimAngularSpan } from './table_helper'; import { DocViewRenderProps } from '../../doc_views/doc_views_types'; diff --git a/src/plugins/discover/public/application/embeddable/search_embeddable.ts b/src/plugins/discover/public/application/embeddable/search_embeddable.ts index e03a6b938bc4f49..8e750e2e165500c 100644 --- a/src/plugins/discover/public/application/embeddable/search_embeddable.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable.ts @@ -18,7 +18,7 @@ */ import './search_embeddable.scss'; import angular from 'angular'; -import _ from 'lodash'; +import _ from 'lodash4'; import * as Rx from 'rxjs'; import { Subscription } from 'rxjs'; import { i18n } from '@kbn/i18n'; diff --git a/src/plugins/discover/public/kibana_services.ts b/src/plugins/discover/public/kibana_services.ts index bbd0357f41ed4e1..c7929de2ac062b2 100644 --- a/src/plugins/discover/public/kibana_services.ts +++ b/src/plugins/discover/public/kibana_services.ts @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ + +import _ from 'lodash4'; import { createHashHistory } from 'history'; import { ScopedHistory } from 'kibana/public'; import { DiscoverServices } from './build_services'; diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx b/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx index 9c544e86e189ab1..6572525fa608385 100644 --- a/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx +++ b/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx @@ -17,7 +17,7 @@ * under the License. */ -import { cloneDeep, isEqual } from 'lodash'; +import { cloneDeep, isEqual } from 'lodash4'; import * as Rx from 'rxjs'; import { Adapters, ViewMode } from '../types'; import { IContainer } from '../containers'; diff --git a/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.js b/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.js index 18e9ffcb27c56fc..b38900aece94d86 100644 --- a/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.js +++ b/src/plugins/es_ui_shared/public/components/cron_editor/cron_editor.js @@ -19,7 +19,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; -import { padLeft } from 'lodash'; +import { padStart } from 'lodash4'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; @@ -55,12 +55,12 @@ function makeSequence(min, max) { const MINUTE_OPTIONS = makeSequence(0, 59).map((value) => ({ value: value.toString(), - text: padLeft(value, 2, '0'), + text: padStart(value, 2, '0'), })); const HOUR_OPTIONS = makeSequence(0, 23).map((value) => ({ value: value.toString(), - text: padLeft(value, 2, '0'), + text: padStart(value, 2, '0'), })); const DAY_OPTIONS = makeSequence(1, 7).map((value) => ({ diff --git a/src/plugins/es_ui_shared/public/components/json_editor/json_editor.tsx b/src/plugins/es_ui_shared/public/components/json_editor/json_editor.tsx index 8c63cc8494a8b69..19986d63c18932d 100644 --- a/src/plugins/es_ui_shared/public/components/json_editor/json_editor.tsx +++ b/src/plugins/es_ui_shared/public/components/json_editor/json_editor.tsx @@ -19,7 +19,7 @@ import React, { useCallback } from 'react'; import { EuiFormRow, EuiCodeEditor } from '@elastic/eui'; -import { debounce } from 'lodash'; +import { debounce } from 'lodash4'; import { isJSON } from '../../../static/validators/string'; import { useJson, OnJsonEditorUpdateHandler } from './use_json'; diff --git a/src/plugins/es_ui_shared/public/console_lang/ace/modes/lexer_rules/x_json_highlight_rules.ts b/src/plugins/es_ui_shared/public/console_lang/ace/modes/lexer_rules/x_json_highlight_rules.ts index 951cf5fa279b5b6..9e31e6661888dcd 100644 --- a/src/plugins/es_ui_shared/public/console_lang/ace/modes/lexer_rules/x_json_highlight_rules.ts +++ b/src/plugins/es_ui_shared/public/console_lang/ace/modes/lexer_rules/x_json_highlight_rules.ts @@ -17,7 +17,7 @@ * under the License. */ -import * as _ from 'lodash'; +import * as _ from 'lodash4'; import ace from 'brace'; import 'brace/mode/json'; diff --git a/src/plugins/es_ui_shared/public/console_lang/lib/json_xjson_translation_tools/__tests__/json_xjson_translation_tools.test.ts b/src/plugins/es_ui_shared/public/console_lang/lib/json_xjson_translation_tools/__tests__/json_xjson_translation_tools.test.ts index 419e80ad1608f02..59d9a3110958160 100644 --- a/src/plugins/es_ui_shared/public/console_lang/lib/json_xjson_translation_tools/__tests__/json_xjson_translation_tools.test.ts +++ b/src/plugins/es_ui_shared/public/console_lang/lib/json_xjson_translation_tools/__tests__/json_xjson_translation_tools.test.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; // @ts-ignore import collapsingTests from './utils_string_collapsing.txt'; // @ts-ignore diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts index f9286d99cbf8049..2bb4461dbfe5614 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.ts @@ -18,7 +18,7 @@ */ import { useState, useRef, useEffect, useMemo } from 'react'; -import { get } from 'lodash'; +import { get } from 'lodash4'; import { FormHook, FieldHook, FormData, FieldConfig, FieldsMap, FormConfig } from '../types'; import { mapFormFields, unflattenObject, Subject, Subscription } from '../lib'; diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/utils.ts b/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/utils.ts index 65cd7792a0189e9..fcbd1311c655e0f 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/utils.ts +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/lib/utils.ts @@ -17,7 +17,7 @@ * under the License. */ -import { set } from 'lodash'; +import { set } from 'lodash4'; import { FieldHook } from '../types'; export const unflattenObject = (object: any) => diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index 7bfb14b8bfa1c29..95d2a1ba7c6f684 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -17,7 +17,7 @@ * under the License. */ -import { keys, last, mapValues, reduce, zipObject } from 'lodash'; +import { keys, last, mapValues, reduce, zipObject } from 'lodash4'; import { Executor } from '../executor'; import { createExecutionContainer, ExecutionContainer } from './container'; import { createError } from '../util'; diff --git a/src/plugins/expressions/common/expression_functions/specs/kibana_context.ts b/src/plugins/expressions/common/expression_functions/specs/kibana_context.ts index b8be273d7bbd32b..7b0180ff47d8189 100644 --- a/src/plugins/expressions/common/expression_functions/specs/kibana_context.ts +++ b/src/plugins/expressions/common/expression_functions/specs/kibana_context.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { uniq } from 'lodash'; +import { uniqBy } from 'lodash4'; import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from '../../expression_functions'; import { KibanaContext } from '../../expression_types'; @@ -40,9 +40,9 @@ const getParsedValue = (data: any, defaultValue: any) => typeof data === 'string' && data.length ? JSON.parse(data) || defaultValue : defaultValue; const mergeQueries = (first: Query | Query[] = [], second: Query | Query[]) => - uniq( + uniqBy( [...(Array.isArray(first) ? first : [first]), ...(Array.isArray(second) ? second : [second])], - (n: any) => JSON.stringify(n.query) + (n: any) => JSON.stringify(n.query) as any ); export const kibanaContextFunction: ExpressionFunctionKibanaContext = { diff --git a/src/plugins/expressions/common/expression_functions/specs/tests/utils.ts b/src/plugins/expressions/common/expression_functions/specs/tests/utils.ts index 016208aefdfc6f9..7d2def0ef46853e 100644 --- a/src/plugins/expressions/common/expression_functions/specs/tests/utils.ts +++ b/src/plugins/expressions/common/expression_functions/specs/tests/utils.ts @@ -17,7 +17,7 @@ * under the License. */ -import { mapValues } from 'lodash'; +import { mapValues } from 'lodash4'; import { AnyExpressionFunctionDefinition } from '../../types'; import { ExecutionContext } from '../../../execution/types'; diff --git a/src/plugins/expressions/common/expression_types/specs/datatable.ts b/src/plugins/expressions/common/expression_types/specs/datatable.ts index c113765f8e7e72f..f30c106b10018e5 100644 --- a/src/plugins/expressions/common/expression_types/specs/datatable.ts +++ b/src/plugins/expressions/common/expression_types/specs/datatable.ts @@ -17,7 +17,7 @@ * under the License. */ -import { map, pick, zipObject } from 'lodash'; +import { map, pick, zipObject } from 'lodash4'; import { ExpressionTypeDefinition } from '../types'; import { PointSeries } from './pointseries'; @@ -109,7 +109,7 @@ export const datatable: ExpressionTypeDefinition ({ type: name, rows: value.rows, - columns: map(value.columns, (val, colName) => { + columns: map(value.columns, (val: any, colName) => { return { name: colName!, type: val.type }; }), }), diff --git a/src/plugins/expressions/common/expression_types/specs/kibana_datatable.ts b/src/plugins/expressions/common/expression_types/specs/kibana_datatable.ts index 7f2f3c37c587c12..3dbdafc3cc420a3 100644 --- a/src/plugins/expressions/common/expression_types/specs/kibana_datatable.ts +++ b/src/plugins/expressions/common/expression_types/specs/kibana_datatable.ts @@ -17,7 +17,7 @@ * under the License. */ -import { map } from 'lodash'; +import { map } from 'lodash4'; import { SerializedFieldFormat } from '../../types/common'; import { Datatable, PointSeries } from '.'; @@ -62,7 +62,7 @@ export const kibanaDatatable = { }; }, pointseries: (context: PointSeries) => { - const columns = map(context.columns, (column, n) => { + const columns = map(context.columns, (column: any, n) => { return { id: n, name: n, ...column }; }); return { diff --git a/src/plugins/expressions/public/loader.ts b/src/plugins/expressions/public/loader.ts index 9428d7db1d9d0de..76a5adcbe62e116 100644 --- a/src/plugins/expressions/public/loader.ts +++ b/src/plugins/expressions/public/loader.ts @@ -19,6 +19,7 @@ import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { filter, map } from 'rxjs/operators'; +import { defaults } from 'lodash4'; import { Adapters } from '../../inspector/public'; import { IExpressionLoaderParams } from './types'; import { ExpressionAstExpression } from '../common'; @@ -168,7 +169,7 @@ export class ExpressionLoader { } if (params.searchContext) { - this.params.searchContext = _.defaults( + this.params.searchContext = defaults( {}, params.searchContext, this.params.searchContext || {} diff --git a/src/plugins/home/public/application/components/sample_data_set_cards.js b/src/plugins/home/public/application/components/sample_data_set_cards.js index 255fc5705408350..55d9b5eae29f759 100644 --- a/src/plugins/home/public/application/components/sample_data_set_cards.js +++ b/src/plugins/home/public/application/components/sample_data_set_cards.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import React from 'react'; import PropTypes from 'prop-types'; import { EuiFlexGrid, EuiFlexItem } from '@elastic/eui'; diff --git a/src/plugins/home/public/application/components/tutorial/tutorial.js b/src/plugins/home/public/application/components/tutorial/tutorial.js index 576f732278b8e46..6b17105b9b716ff 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import React from 'react'; import PropTypes from 'prop-types'; import { Footer } from './footer'; diff --git a/src/plugins/home/public/application/components/tutorial_directory.js b/src/plugins/home/public/application/components/tutorial_directory.js index 774b23af11ac85b..94498d289a7711a 100644 --- a/src/plugins/home/public/application/components/tutorial_directory.js +++ b/src/plugins/home/public/application/components/tutorial_directory.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import React from 'react'; import PropTypes from 'prop-types'; import { Synopsis } from './synopsis'; diff --git a/src/plugins/home/public/application/load_tutorials.js b/src/plugins/home/public/application/load_tutorials.js index 6d42c9a1072d60c..27cea7ccf71e27d 100644 --- a/src/plugins/home/public/application/load_tutorials.js +++ b/src/plugins/home/public/application/load_tutorials.js @@ -17,7 +17,7 @@ * under the License. */ -import _ from 'lodash'; +import _ from 'lodash4'; import { getServices } from './kibana_services'; import { i18n } from '@kbn/i18n'; diff --git a/src/plugins/home/server/services/sample_data/routes/uninstall.ts b/src/plugins/home/server/services/sample_data/routes/uninstall.ts index 9bb260460b38aef..327710e1cb0bfca 100644 --- a/src/plugins/home/server/services/sample_data/routes/uninstall.ts +++ b/src/plugins/home/server/services/sample_data/routes/uninstall.ts @@ -17,7 +17,7 @@ * under the License. */ import { schema } from '@kbn/config-schema'; -import _ from 'lodash'; +import _ from 'lodash4'; import { IRouter } from 'src/core/server'; import { SampleDatasetSchema } from '../lib/sample_dataset_registry_types'; import { createIndexName } from '../lib/create_index_name'; diff --git a/src/plugins/home/server/services/sample_data/usage/collector_fetch.ts b/src/plugins/home/server/services/sample_data/usage/collector_fetch.ts index 4c7316c8530181b..3428d569b313045 100644 --- a/src/plugins/home/server/services/sample_data/usage/collector_fetch.ts +++ b/src/plugins/home/server/services/sample_data/usage/collector_fetch.ts @@ -17,7 +17,7 @@ * under the License. */ -import { get } from 'lodash'; +import { get } from 'lodash4'; import moment from 'moment'; interface SearchHit {