From 4625e3dcebdbe91ea178f01fca1ebea3326c7998 Mon Sep 17 00:00:00 2001 From: Mikhail Shustov Date: Mon, 23 Nov 2020 15:17:05 +0300 Subject: [PATCH] [DX] Prettier v2.2 (#83899) * update prettier with ts version support * mute type-error * run prettier on codebase * fix examples * fix errors after master merged # Conflicts: # x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx # x-pack/plugins/upgrade_assistant/server/lib/telemetry/usage_collector.ts --- .../public/book/book_embeddable_factory.tsx | 13 +- package.json | 6 +- .../lib/snapshots/decorate_snapshot_ui.ts | 1 + .../elasticsearch_service.test.ts | 4 +- .../server/saved_objects/migrations/mocks.ts | 4 +- .../saved_objects_service.test.ts | 5 +- .../lib/repository_create_repository.test.ts | 4 +- .../legacy_core_editor/legacy_core_editor.ts | 29 ++-- .../__tests__/integration.test.js | 145 +++++++++--------- src/plugins/dashboard/public/plugin.tsx | 4 +- .../common/search/aggs/param_types/agg.ts | 6 +- .../search_source/legacy/call_client.ts | 7 +- src/plugins/embeddable/common/mocks.ts | 4 +- .../public/lib/containers/container.ts | 7 +- .../components/form_data_provider.test.tsx | 24 +-- .../components/use_field.test.tsx | 6 +- .../hook_form_lib/hooks/use_form.test.tsx | 12 +- .../expressions/common/ast/build_function.ts | 6 +- .../expressions/common/execution/execution.ts | 9 +- src/plugins/expressions/public/render.ts | 6 +- src/plugins/expressions/public/services.ts | 14 +- .../step_index_pattern/step_index_pattern.tsx | 6 +- .../create_edit_field/create_edit_field.tsx | 9 +- .../edit_index_pattern/tabs/tabs.tsx | 8 +- .../editors/static_lookup/static_lookup.tsx | 4 +- .../index_pattern_management/public/types.ts | 4 +- .../public/angular/kbn_top_nav.d.ts | 9 +- .../kibana_legacy/public/paginate/paginate.js | 42 ++--- .../public/utils/kbn_accessible_click.d.ts | 9 +- .../collectors/application_usage/rollups.ts | 6 +- .../public/management_sections_service.ts | 7 +- .../public/saved_object/saved_object.test.ts | 6 +- .../public/services/service_registry.ts | 4 +- .../number_list/number_row.test.tsx | 6 +- .../public/helpers/plugin_services.ts | 7 +- .../server/series_functions/legend.js | 37 ++--- .../server/series_functions/yaxis.js | 121 +++++++-------- .../find_list_items.test.ts | 5 +- src/plugins/visualizations/public/services.ts | 7 +- .../public/alert_types/always_firing.tsx | 7 +- .../plugins/actions/server/actions_client.ts | 8 +- .../actions_authorization.test.ts | 24 +-- .../server/alerts_client/alerts_client.ts | 40 +++-- .../server/alerts_client/tests/create.test.ts | 8 +- .../server/alerts_client/tests/update.test.ts | 4 +- .../server/alerts_client_factory.test.ts | 6 +- .../alerts_authorization.test.ts | 84 +++++----- .../invalidate_pending_api_keys/task.ts | 7 +- .../partially_update_alert.test.ts | 4 +- .../anomaly_detection_setup_link.tsx | 4 +- .../ErrorGroupDetails/DetailView/index.tsx | 4 +- .../ErrorGroupDetails/Distribution/index.tsx | 4 +- .../app/ErrorGroupOverview/List/index.tsx | 4 +- .../VisitorBreakdownMap/EmbeddedMap.tsx | 6 +- .../components/app/ServiceMetrics/index.tsx | 4 +- .../app/ServiceNodeOverview/index.tsx | 4 +- .../app/Settings/anomaly_detection/index.tsx | 4 +- .../TransactionDetails/Distribution/index.tsx | 8 +- .../WaterfallWithSummmary/index.tsx | 4 +- .../TransactionList.stories.tsx | 4 +- .../TransactionList/index.tsx | 4 +- .../app/TransactionOverview/index.tsx | 4 +- .../app/service_inventory/index.tsx | 4 +- .../index.tsx | 4 +- .../hooks/useTransactionDistribution.ts | 4 +- .../apm/public/hooks/useTransactionList.ts | 4 +- .../charts/get_anomaly_data/transform.ts | 4 +- .../charts/get_timeseries_data/transform.ts | 8 +- .../server/routes/custom_elements/update.ts | 7 +- .../server/routes/api/cases/get_case.test.ts | 6 +- ...cted_background_session_indicator.test.tsx | 5 +- ...ypted_saved_object_type_definition.test.ts | 18 ++- .../applications/fleet/types/ui_extensions.ts | 8 +- .../fleet/server/routes/agent/handlers.ts | 12 +- .../server/routes/agent_policy/handlers.ts | 6 +- .../routes/enrollment_api_key/handler.ts | 12 +- .../fleet/server/routes/epm/handlers.ts | 6 +- .../fleet/server/routes/output/handler.ts | 6 +- .../server/routes/package_policy/handlers.ts | 6 +- .../elasticsearch/transform/transform.test.ts | 6 +- .../routes/integration_tests/find.test.ts | 4 +- .../public/providers/application.test.ts | 12 +- .../components/settings/settings.test.tsx | 6 +- .../component_template_list_container.tsx | 6 +- .../mappings_editor/mappings_editor.tsx | 7 +- .../missing_setup_privileges_tooltip.tsx | 7 +- .../plugins/infra/public/hooks/use_kibana.ts | 4 +- .../use_log_entry_categories_results.ts | 7 +- .../use_log_entry_anomalies_results.ts | 7 +- .../editor_frame/expression_helpers.ts | 7 +- .../dimension_panel/dimension_panel.tsx | 8 +- x-pack/plugins/lens/server/migrations.ts | 24 +-- .../exception_list_item_schema.mock.ts | 4 +- .../response/exception_list_schema.mock.ts | 4 +- x-pack/plugins/lists/public/lists/api.ts | 6 +- .../symbol/icon_map_select.test.tsx | 4 +- .../supported_fields_message.tsx | 7 +- ...omaly_swimlane_embeddable_factory.test.tsx | 5 +- .../monitoring/public/angular/app_modules.ts | 41 ++--- .../server/export_types/csv/create_job.ts | 7 +- .../server/export_types/csv/execute_job.ts | 6 +- .../export_types/png/create_job/index.ts | 7 +- .../export_types/png/execute_job/index.ts | 6 +- .../printable_pdf/create_job/index.ts | 7 +- .../printable_pdf/execute_job/index.ts | 6 +- .../runtime_fields/public/load_editor.tsx | 6 +- .../public/plugin.test.ts | 4 +- .../feature_table/__fixtures__/index.ts | 12 +- .../plugins/security/public/plugin.test.tsx | 6 +- .../common/endpoint/types/index.ts | 4 +- .../cypress/support/commands.js | 22 +-- .../components/settings/resilient/fields.tsx | 6 +- .../components/settings/servicenow/fields.tsx | 6 +- .../add_exception_modal/index.test.tsx | 12 +- .../edit_exception_modal/index.test.tsx | 6 +- .../exceptions/use_add_exception.test.tsx | 18 +-- ...tch_or_create_rule_exception_list.test.tsx | 6 +- .../components/url_state/test_dependencies.ts | 12 +- .../events/last_event_time/index.ts | 14 +- .../containers/matrix_histogram/index.ts | 7 +- .../hosts/first_last_seen/index.tsx | 7 +- .../kpi_hosts/authentications/index.tsx | 7 +- .../view/details/endpoint_details.tsx | 33 ++-- .../pages/endpoint_hosts/view/index.tsx | 23 +-- .../view/policy_forms/events/windows.tsx | 12 +- .../view/policy_forms/protections/malware.tsx | 12 +- .../pages/trusted_apps/store/action.ts | 4 +- .../public/network/components/details/mock.ts | 7 +- .../kpi_network/network_events/index.tsx | 7 +- .../kpi_network/tls_handshakes/index.tsx | 7 +- .../kpi_network/unique_flows/index.tsx | 7 +- .../kpi_network/unique_private_ips/index.tsx | 7 +- .../network_top_countries/index.tsx | 7 +- .../public/resolver/store/data/selectors.ts | 29 ++-- .../view/panels/deep_object_entries.test.ts | 12 +- .../resolver/view/panels/node_detail.tsx | 6 +- .../server/endpoint/mocks.ts | 4 +- .../endpoint/routes/metadata/metadata.test.ts | 4 +- .../routes/metadata/metadata_v1.test.ts | 4 +- .../server/endpoint/routes/policy/service.ts | 7 +- .../routes/resolver/queries/events.ts | 6 +- .../manifest_manager/manifest_manager.test.ts | 4 +- .../server/graphql/note/resolvers.ts | 8 +- .../server/graphql/pinned_event/resolvers.ts | 16 +- .../server/graphql/timeline/resolvers.ts | 4 +- .../routes/__mocks__/request_responses.ts | 8 +- .../create_rule_actions_saved_object.ts | 15 +- .../get_rule_actions_saved_object.ts | 8 +- .../server/lib/sources/configuration.ts | 6 +- .../server/usage/endpoints/endpoint.test.ts | 6 +- .../management/management_service.test.ts | 15 +- .../spaces_saved_objects_client.test.ts | 18 +-- .../geo_threshold/query_builder/index.tsx | 7 +- .../alert_types/threshold/expression.tsx | 7 +- .../server/monitoring/task_run_statistics.ts | 7 +- .../task_manager/server/polling_lifecycle.ts | 7 +- .../server/saved_objects/migrations.ts | 4 +- .../plugins/task_manager/server/task_store.ts | 13 +- .../public/app/hooks/use_pivot_data.ts | 7 +- .../email/email_connector.tsx | 6 +- .../es_index/es_index_connector.tsx | 6 +- .../pagerduty/pagerduty_connectors.tsx | 6 +- .../server_log/server_log_params.tsx | 6 +- .../servicenow/servicenow_connectors.tsx | 6 +- .../servicenow/servicenow_params.tsx | 6 +- .../slack/slack_connectors.tsx | 6 +- .../teams/teams_connectors.tsx | 6 +- .../webhook/webhook_connectors.tsx | 6 +- .../application/components/error_banner.tsx | 7 +- .../server/lib/telemetry/usage_collector.ts | 47 +++--- .../typings/elasticsearch/aggregations.d.ts | 8 +- yarn.lock | 23 +-- 172 files changed, 897 insertions(+), 953 deletions(-) diff --git a/examples/embeddable_examples/public/book/book_embeddable_factory.tsx b/examples/embeddable_examples/public/book/book_embeddable_factory.tsx index aab191111e92e..8eb54d68d48cf 100644 --- a/examples/embeddable_examples/public/book/book_embeddable_factory.tsx +++ b/examples/embeddable_examples/public/book/book_embeddable_factory.tsx @@ -127,9 +127,10 @@ export class BookEmbeddableFactoryDefinition private async unwrapMethod(savedObjectId: string): Promise { const { savedObjectsClient } = await this.getStartServices(); - const savedObject: SimpleSavedObject = await savedObjectsClient.get< - BookSavedObjectAttributes - >(this.type, savedObjectId); + const savedObject: SimpleSavedObject = await savedObjectsClient.get( + this.type, + savedObjectId + ); return { ...savedObject.attributes }; } @@ -163,9 +164,9 @@ export class BookEmbeddableFactoryDefinition private async getAttributeService() { if (!this.attributeService) { - this.attributeService = (await this.getStartServices()).getAttributeService< - BookSavedObjectAttributes - >(this.type, { + this.attributeService = ( + await this.getStartServices() + ).getAttributeService(this.type, { saveMethod: this.saveMethod.bind(this), unwrapMethod: this.unwrapMethod.bind(this), checkForDuplicateTitle: this.checkForDuplicateTitleMethod.bind(this), diff --git a/package.json b/package.json index f3338864fafb6..4bbad7147154c 100644 --- a/package.json +++ b/package.json @@ -508,7 +508,7 @@ "@types/pdfmake": "^0.1.15", "@types/pegjs": "^0.10.1", "@types/pngjs": "^3.4.0", - "@types/prettier": "^2.0.2", + "@types/prettier": "^2.1.5", "@types/pretty-ms": "^5.0.0", "@types/prop-types": "^15.7.3", "@types/proper-lockfile": "^3.0.1", @@ -624,7 +624,7 @@ "enzyme-adapter-utils": "^1.13.0", "enzyme-to-json": "^3.4.4", "eslint": "^6.8.0", - "eslint-config-prettier": "^6.11.0", + "eslint-config-prettier": "^6.15.0", "eslint-import-resolver-node": "0.3.2", "eslint-import-resolver-webpack": "0.11.1", "eslint-module-utils": "2.5.0", @@ -760,7 +760,7 @@ "postcss": "^7.0.32", "postcss-loader": "^3.0.0", "postcss-prefix-selector": "^1.7.2", - "prettier": "^2.1.1", + "prettier": "^2.2.0", "pretty-ms": "5.0.0", "proxyquire": "1.8.0", "querystring": "^0.2.0", diff --git a/packages/kbn-test/src/functional_test_runner/lib/snapshots/decorate_snapshot_ui.ts b/packages/kbn-test/src/functional_test_runner/lib/snapshots/decorate_snapshot_ui.ts index 45550b55e73c7..59596f44e7fd6 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/snapshots/decorate_snapshot_ui.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/snapshots/decorate_snapshot_ui.ts @@ -197,6 +197,7 @@ function getSnapshotState(file: string, test: Test, updateSnapshots: boolean) { path.join(dirname + `/__snapshots__/` + filename.replace(path.extname(filename), '.snap')), { updateSnapshot: updateSnapshots ? 'all' : 'new', + // @ts-expect-error getPrettier: () => prettier, getBabelTraverse: () => babelTraverse, } diff --git a/src/core/server/elasticsearch/elasticsearch_service.test.ts b/src/core/server/elasticsearch/elasticsearch_service.test.ts index e527fdb915970..7be3a31624df2 100644 --- a/src/core/server/elasticsearch/elasticsearch_service.test.ts +++ b/src/core/server/elasticsearch/elasticsearch_service.test.ts @@ -57,7 +57,9 @@ let coreContext: CoreContext; const logger = loggingSystemMock.create(); let mockClusterClientInstance: ReturnType; -let mockLegacyClusterClientInstance: ReturnType; +let mockLegacyClusterClientInstance: ReturnType< + typeof elasticsearchServiceMock.createLegacyCustomClusterClient +>; beforeEach(() => { env = Env.createDefault(REPO_ROOT, getEnvOptions()); diff --git a/src/core/server/saved_objects/migrations/mocks.ts b/src/core/server/saved_objects/migrations/mocks.ts index 1c4e55566b61b..50a7191393472 100644 --- a/src/core/server/saved_objects/migrations/mocks.ts +++ b/src/core/server/saved_objects/migrations/mocks.ts @@ -20,9 +20,7 @@ import { SavedObjectMigrationContext } from './types'; import { SavedObjectsMigrationLogger } from './core'; -export const createSavedObjectsMigrationLoggerMock = (): jest.Mocked< - SavedObjectsMigrationLogger -> => { +export const createSavedObjectsMigrationLoggerMock = (): jest.Mocked => { const mock = { debug: jest.fn(), info: jest.fn(), diff --git a/src/core/server/saved_objects/saved_objects_service.test.ts b/src/core/server/saved_objects/saved_objects_service.test.ts index d6b30889eba5f..8e4c73137033d 100644 --- a/src/core/server/saved_objects/saved_objects_service.test.ts +++ b/src/core/server/saved_objects/saved_objects_service.test.ts @@ -217,9 +217,8 @@ describe('SavedObjectsService', () => { await soService.setup(setupDeps); soService.start(createStartDeps()); expect(migratorInstanceMock.runMigrations).toHaveBeenCalledTimes(0); - ((setupDeps.elasticsearch.esNodesCompatibility$ as any) as BehaviorSubject< - NodesVersionCompatibility - >).next({ + ((setupDeps.elasticsearch + .esNodesCompatibility$ as any) as BehaviorSubject).next({ isCompatible: true, incompatibleNodes: [], warningNodes: [], diff --git a/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts b/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts index ea881805e1ae6..0ba874c02e8ed 100644 --- a/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts +++ b/src/core/server/saved_objects/service/lib/repository_create_repository.test.ts @@ -66,9 +66,7 @@ describe('SavedObjectsRepository#createRepository', () => { }); const migrator = mockKibanaMigrator.create({ types: typeRegistry.getAllTypes() }); - const RepositoryConstructor = (SavedObjectsRepository as unknown) as jest.Mock< - SavedObjectsRepository - >; + const RepositoryConstructor = (SavedObjectsRepository as unknown) as jest.Mock; beforeEach(() => { RepositoryConstructor.mockClear(); diff --git a/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts index 393b7eee346f5..84b12c97f1856 100644 --- a/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts +++ b/src/plugins/console/public/application/models/legacy_core_editor/legacy_core_editor.ts @@ -368,20 +368,21 @@ export class LegacyCoreEditor implements CoreEditor { // disable standard context based autocompletion. // @ts-ignore - ace.define('ace/autocomplete/text_completer', ['require', 'exports', 'module'], function ( - require: any, - exports: any - ) { - exports.getCompletions = function ( - innerEditor: any, - session: any, - pos: any, - prefix: any, - callback: any - ) { - callback(null, []); - }; - }); + ace.define( + 'ace/autocomplete/text_completer', + ['require', 'exports', 'module'], + function (require: any, exports: any) { + exports.getCompletions = function ( + innerEditor: any, + session: any, + pos: any, + prefix: any, + callback: any + ) { + callback(null, []); + }; + } + ); const langTools = ace.acequire('ace/ext/language_tools'); diff --git a/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js b/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js index 0b443ef400d6f..89880528943e5 100644 --- a/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js +++ b/src/plugins/console/public/application/models/sense_editor/__tests__/integration.test.js @@ -84,90 +84,93 @@ describe('Integration', () => { changeListener: function () {}, }; // mimic auto complete - senseEditor.autocomplete._test.getCompletions(senseEditor, null, cursor, '', function ( - err, - terms - ) { - if (testToRun.assertThrows) { - done(); - return; - } + senseEditor.autocomplete._test.getCompletions( + senseEditor, + null, + cursor, + '', + function (err, terms) { + if (testToRun.assertThrows) { + done(); + return; + } - if (err) { - throw err; - } + if (err) { + throw err; + } - if (testToRun.no_context) { - expect(!terms || terms.length === 0).toBeTruthy(); - } else { - expect(terms).not.toBeNull(); - expect(terms.length).toBeGreaterThan(0); - } + if (testToRun.no_context) { + expect(!terms || terms.length === 0).toBeTruthy(); + } else { + expect(terms).not.toBeNull(); + expect(terms.length).toBeGreaterThan(0); + } - if (!terms || terms.length === 0) { - done(); - return; - } + if (!terms || terms.length === 0) { + done(); + return; + } - if (testToRun.autoCompleteSet) { - const expectedTerms = _.map(testToRun.autoCompleteSet, function (t) { - if (typeof t !== 'object') { - t = { name: t }; - } - return t; - }); - if (terms.length !== expectedTerms.length) { - expect(_.map(terms, 'name')).toEqual(_.map(expectedTerms, 'name')); - } else { - const filteredActualTerms = _.map(terms, function (actualTerm, i) { - const expectedTerm = expectedTerms[i]; - const filteredTerm = {}; - _.each(expectedTerm, function (v, p) { - filteredTerm[p] = actualTerm[p]; - }); - return filteredTerm; + if (testToRun.autoCompleteSet) { + const expectedTerms = _.map(testToRun.autoCompleteSet, function (t) { + if (typeof t !== 'object') { + t = { name: t }; + } + return t; }); - expect(filteredActualTerms).toEqual(expectedTerms); + if (terms.length !== expectedTerms.length) { + expect(_.map(terms, 'name')).toEqual(_.map(expectedTerms, 'name')); + } else { + const filteredActualTerms = _.map(terms, function (actualTerm, i) { + const expectedTerm = expectedTerms[i]; + const filteredTerm = {}; + _.each(expectedTerm, function (v, p) { + filteredTerm[p] = actualTerm[p]; + }); + return filteredTerm; + }); + expect(filteredActualTerms).toEqual(expectedTerms); + } } - } - const context = terms[0].context; - const { - cursor: { lineNumber, column }, - } = testToRun; - senseEditor.autocomplete._test.addReplacementInfoToContext( - context, - { lineNumber, column }, - terms[0].value - ); + const context = terms[0].context; + const { + cursor: { lineNumber, column }, + } = testToRun; + senseEditor.autocomplete._test.addReplacementInfoToContext( + context, + { lineNumber, column }, + terms[0].value + ); - function ac(prop, propTest) { - if (typeof testToRun[prop] !== 'undefined') { - if (propTest) { - propTest(context[prop], testToRun[prop], prop); - } else { - expect(context[prop]).toEqual(testToRun[prop]); + function ac(prop, propTest) { + if (typeof testToRun[prop] !== 'undefined') { + if (propTest) { + propTest(context[prop], testToRun[prop], prop); + } else { + expect(context[prop]).toEqual(testToRun[prop]); + } } } - } - function posCompare(actual, expected) { - expect(actual.lineNumber).toEqual(expected.lineNumber + lineOffset); - expect(actual.column).toEqual(expected.column); - } + function posCompare(actual, expected) { + expect(actual.lineNumber).toEqual(expected.lineNumber + lineOffset); + expect(actual.column).toEqual(expected.column); + } - function rangeCompare(actual, expected, name) { - posCompare(actual.start, expected.start, name + '.start'); - posCompare(actual.end, expected.end, name + '.end'); - } + function rangeCompare(actual, expected, name) { + posCompare(actual.start, expected.start, name + '.start'); + posCompare(actual.end, expected.end, name + '.end'); + } - ac('prefixToAdd'); - ac('suffixToAdd'); - ac('addTemplate'); - ac('textBoxPosition', posCompare); - ac('rangeToReplace', rangeCompare); - done(); - }); + ac('prefixToAdd'); + ac('suffixToAdd'); + ac('addTemplate'); + ac('textBoxPosition', posCompare); + ac('rangeToReplace', rangeCompare); + done(); + } + ); }); } diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 24bf736cfa274..c47a4c2d21b11 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -179,9 +179,7 @@ export class DashboardPlugin core: CoreSetup, { share, uiActions, embeddable, home, urlForwarding, data, usageCollection }: SetupDependencies ): DashboardSetup { - this.dashboardFeatureFlagConfig = this.initializerContext.config.get< - DashboardFeatureFlagConfig - >(); + this.dashboardFeatureFlagConfig = this.initializerContext.config.get(); const expandPanelAction = new ExpandPanelAction(); uiActions.registerAction(expandPanelAction); uiActions.attachAction(CONTEXT_MENU_TRIGGER, expandPanelAction.id); diff --git a/src/plugins/data/common/search/aggs/param_types/agg.ts b/src/plugins/data/common/search/aggs/param_types/agg.ts index e3f8c7c922170..af9ee5fa628c4 100644 --- a/src/plugins/data/common/search/aggs/param_types/agg.ts +++ b/src/plugins/data/common/search/aggs/param_types/agg.ts @@ -20,9 +20,9 @@ import { AggConfig, IAggConfig, AggConfigSerialized } from '../agg_config'; import { BaseParamType } from './base'; -export class AggParamType extends BaseParamType< - TAggConfig -> { +export class AggParamType< + TAggConfig extends IAggConfig = IAggConfig +> extends BaseParamType { makeAgg: (agg: TAggConfig, state?: AggConfigSerialized) => TAggConfig; allowedAggs: string[] = []; diff --git a/src/plugins/data/common/search/search_source/legacy/call_client.ts b/src/plugins/data/common/search/search_source/legacy/call_client.ts index cb6295dd701ee..eb6f298c8b220 100644 --- a/src/plugins/data/common/search/search_source/legacy/call_client.ts +++ b/src/plugins/data/common/search/search_source/legacy/call_client.ts @@ -28,10 +28,9 @@ export function callClient( fetchHandlers: FetchHandlers ) { // Correlate the options with the request that they're associated with - const requestOptionEntries: Array<[ - SearchRequest, - ISearchOptions - ]> = searchRequests.map((request, i) => [request, requestsOptions[i]]); + const requestOptionEntries: Array< + [SearchRequest, ISearchOptions] + > = searchRequests.map((request, i) => [request, requestsOptions[i]]); const requestOptionsMap = new Map(requestOptionEntries); const requestResponseMap = new Map>>(); diff --git a/src/plugins/embeddable/common/mocks.ts b/src/plugins/embeddable/common/mocks.ts index a9ac144d1f276..060c2003868c1 100644 --- a/src/plugins/embeddable/common/mocks.ts +++ b/src/plugins/embeddable/common/mocks.ts @@ -19,9 +19,7 @@ import { EmbeddablePersistableStateService } from './types'; -export const createEmbeddablePersistableStateServiceMock = (): jest.Mocked< - EmbeddablePersistableStateService -> => { +export const createEmbeddablePersistableStateServiceMock = (): jest.Mocked => { return { inject: jest.fn((state, references) => state), extract: jest.fn((state) => ({ state, references: [] })), diff --git a/src/plugins/embeddable/public/lib/containers/container.ts b/src/plugins/embeddable/public/lib/containers/container.ts index a5c5133dbc702..292d7d3bf7a1e 100644 --- a/src/plugins/embeddable/public/lib/containers/container.ts +++ b/src/plugins/embeddable/public/lib/containers/container.ts @@ -244,9 +244,10 @@ export abstract class Container< private createNewExplicitEmbeddableInput< TEmbeddableInput extends EmbeddableInput = EmbeddableInput, - TEmbeddable extends IEmbeddable = IEmbeddable< - TEmbeddableInput - > + TEmbeddable extends IEmbeddable< + TEmbeddableInput, + EmbeddableOutput + > = IEmbeddable >( id: string, factory: EmbeddableFactory, diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/form_data_provider.test.tsx b/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/form_data_provider.test.tsx index a086b447994eb..260f06f27ea56 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/form_data_provider.test.tsx +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/form_data_provider.test.tsx @@ -58,9 +58,9 @@ describe('', () => { expect(onFormData.mock.calls.length).toBe(1); - const [formDataInitial] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + const [formDataInitial] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(formDataInitial).toEqual({ name: 'Initial value', @@ -77,9 +77,9 @@ describe('', () => { expect(onFormData).toBeCalledTimes(2); - const [formDataUpdated] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + const [formDataUpdated] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(formDataUpdated).toEqual({ name: 'updated value', @@ -135,9 +135,9 @@ describe('', () => { expect(onFormData.mock.calls.length).toBe(2); - const [formDataUpdated] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + const [formDataUpdated] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(formDataUpdated).toEqual({ name: 'updated value', @@ -236,9 +236,9 @@ describe('', () => { expect(onFormData.mock.calls.length).toBe(2); // 2 as the form "isValid" change caused a re-render - const [formData] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + const [formData] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(formData).toEqual({ name: 'updated value', diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.test.tsx b/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.test.tsx index 1a7f8832e4a4e..e62bc483b539c 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.test.tsx +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/components/use_field.test.tsx @@ -54,9 +54,9 @@ describe('', () => { setup(); - const [{ data }] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + const [{ data }] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(data.internal).toEqual({ name: 'John', diff --git a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.test.tsx b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.test.tsx index 9626aaa9b2459..386d33a462849 100644 --- a/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.test.tsx +++ b/src/plugins/es_ui_shared/static/forms/hook_form_lib/hooks/use_form.test.tsx @@ -255,9 +255,9 @@ describe('useForm() hook', () => { setInputValue('usernameField', 'John'); }); - [{ data, isValid }] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + [{ data, isValid }] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(data.internal).toEqual({ user: { name: 'John' } }); // Transform name to uppercase as decalred in our serializer func @@ -305,9 +305,9 @@ describe('useForm() hook', () => { expect(onFormData.mock.calls.length).toBe(1); - const [{ data }] = onFormData.mock.calls[onFormData.mock.calls.length - 1] as Parameters< - OnUpdateHandler - >; + const [{ data }] = onFormData.mock.calls[ + onFormData.mock.calls.length - 1 + ] as Parameters; expect(data.internal).toEqual({ title: defaultValue.title, diff --git a/src/plugins/expressions/common/ast/build_function.ts b/src/plugins/expressions/common/ast/build_function.ts index 6cd16b2bc1354..a5260f9ba5800 100644 --- a/src/plugins/expressions/common/ast/build_function.ts +++ b/src/plugins/expressions/common/ast/build_function.ts @@ -45,9 +45,9 @@ export type InferFunctionDefinition< : never; // Shortcut for inferring args from a function definition. -type FunctionArgs = InferFunctionDefinition< - FnDef ->['arguments']; +type FunctionArgs< + FnDef extends AnyExpressionFunctionDefinition +> = InferFunctionDefinition['arguments']; // Gets a list of possible arg names for a given function. type FunctionArgName = { diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index 50a469c338d73..e53a6f7d58e1c 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -359,9 +359,12 @@ export class Execution< // Check for missing required arguments. for (const argDef of Object.values(argDefs)) { - const { aliases, default: argDefault, name: argName, required } = argDef as ArgumentType< - any - > & { name: string }; + const { + aliases, + default: argDefault, + name: argName, + required, + } = argDef as ArgumentType & { name: string }; if ( typeof argDefault !== 'undefined' || !required || diff --git a/src/plugins/expressions/public/render.ts b/src/plugins/expressions/public/render.ts index 401c71cba8f1d..924f8d4830f73 100644 --- a/src/plugins/expressions/public/render.ts +++ b/src/plugins/expressions/public/render.ts @@ -68,9 +68,9 @@ export class ExpressionRenderHandler { this.onRenderError = onRenderError || defaultRenderErrorHandler; this.renderSubject = new Rx.BehaviorSubject(null as any | null); - this.render$ = this.renderSubject.asObservable().pipe(filter((_) => _ !== null)) as Observable< - any - >; + this.render$ = this.renderSubject + .asObservable() + .pipe(filter((_) => _ !== null)) as Observable; this.updateSubject = new Rx.Subject(); this.update$ = this.updateSubject.asObservable(); diff --git a/src/plugins/expressions/public/services.ts b/src/plugins/expressions/public/services.ts index e296566e661cd..3501c4971d1ec 100644 --- a/src/plugins/expressions/public/services.ts +++ b/src/plugins/expressions/public/services.ts @@ -25,10 +25,12 @@ export const [getNotifications, setNotifications] = createGetterSetter('Renderers registry'); +export const [ + getRenderersRegistry, + setRenderersRegistry, +] = createGetterSetter('Renderers registry'); -export const [getExpressionsService, setExpressionsService] = createGetterSetter< - ExpressionsService ->('ExpressionsService'); +export const [ + getExpressionsService, + setExpressionsService, +] = createGetterSetter('ExpressionsService'); diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx index 386514de68d4d..97ff0306f8eae 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/components/step_index_pattern/step_index_pattern.tsx @@ -129,9 +129,9 @@ export class StepIndexPattern extends Component { - const { savedObjects } = await this.context.services.savedObjects.client.find< - IndexPatternAttributes - >({ + const { + savedObjects, + } = await this.context.services.savedObjects.client.find({ type: 'index-pattern', fields: ['title'], perPage: 10000, diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx index 545eb86311dad..423d6c3287cd8 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/create_edit_field/create_edit_field.tsx @@ -44,9 +44,12 @@ const newFieldPlaceholder = i18n.translate( export const CreateEditField = withRouter( ({ indexPattern, mode, fieldName, history }: CreateEditFieldProps) => { - const { uiSettings, chrome, notifications, data } = useKibana< - IndexPatternManagmentContext - >().services; + const { + uiSettings, + chrome, + notifications, + data, + } = useKibana().services; const spec = mode === 'edit' && fieldName ? indexPattern.fields.getByName(fieldName)?.spec diff --git a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx index 5c29dfafd3c07..f7f6af6e3cc1b 100644 --- a/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx +++ b/src/plugins/index_pattern_management/public/components/edit_index_pattern/tabs/tabs.tsx @@ -74,9 +74,11 @@ const filterPlaceholder = i18n.translate( ); export function Tabs({ indexPattern, saveIndexPattern, fields, history, location }: TabsProps) { - const { uiSettings, indexPatternManagementStart, docLinks } = useKibana< - IndexPatternManagmentContext - >().services; + const { + uiSettings, + indexPatternManagementStart, + docLinks, + } = useKibana().services; const [fieldFilter, setFieldFilter] = useState(''); const [indexedFieldTypeFilter, setIndexedFieldTypeFilter] = useState(''); const [scriptedFieldLanguageFilter, setScriptedFieldLanguageFilter] = useState(''); diff --git a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.tsx b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.tsx index 0f80bfa681bf3..4b51ae478a178 100644 --- a/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.tsx +++ b/src/plugins/index_pattern_management/public/components/field_editor/components/field_format_editor/editors/static_lookup/static_lookup.tsx @@ -36,9 +36,7 @@ interface StaticLookupItem { index: number; } -export class StaticLookupFormatEditor extends DefaultFormatEditor< - StaticLookupFormatEditorFormatParams -> { +export class StaticLookupFormatEditor extends DefaultFormatEditor { static formatId = 'static_lookup'; onLookupChange = (newLookupParams: { value?: string; key?: string }, index: number) => { const lookupEntries = [...this.props.formatParams.lookupEntries]; diff --git a/src/plugins/index_pattern_management/public/types.ts b/src/plugins/index_pattern_management/public/types.ts index 2876bd6227350..e184fcb338b0c 100644 --- a/src/plugins/index_pattern_management/public/types.ts +++ b/src/plugins/index_pattern_management/public/types.ts @@ -47,9 +47,7 @@ export interface IndexPatternManagmentContext { getMlCardState: () => MlCardState; } -export type IndexPatternManagmentContextValue = KibanaReactContextValue< - IndexPatternManagmentContext ->; +export type IndexPatternManagmentContextValue = KibanaReactContextValue; export enum MlCardState { HIDDEN, diff --git a/src/plugins/kibana_legacy/public/angular/kbn_top_nav.d.ts b/src/plugins/kibana_legacy/public/angular/kbn_top_nav.d.ts index 3d1dcdbef3f4b..6ef666f585120 100644 --- a/src/plugins/kibana_legacy/public/angular/kbn_top_nav.d.ts +++ b/src/plugins/kibana_legacy/public/angular/kbn_top_nav.d.ts @@ -19,12 +19,9 @@ import { Injectable, IDirectiveFactory, IScope, IAttributes, IController } from 'angular'; -export const createTopNavDirective: Injectable>; +export const createTopNavDirective: Injectable< + IDirectiveFactory +>; export const createTopNavHelper: ( options: unknown ) => Injectable>; diff --git a/src/plugins/kibana_legacy/public/paginate/paginate.js b/src/plugins/kibana_legacy/public/paginate/paginate.js index f424c33ba7b02..6c181778721f3 100644 --- a/src/plugins/kibana_legacy/public/paginate/paginate.js +++ b/src/plugins/kibana_legacy/public/paginate/paginate.js @@ -76,30 +76,30 @@ export function PaginateDirectiveProvider($parse, $compile) { self.init = function () { self.perPage = _.parseInt(self.perPage) || $scope[self.perPageProp]; - $scope.$watchMulti(['paginate.perPage', self.perPageProp, self.otherWidthGetter], function ( - vals, - oldVals - ) { - const intChanges = vals[0] !== oldVals[0]; - - if (intChanges) { - if (!setPerPage(self.perPage)) { - // if we are not able to set the external value, - // render now, otherwise wait for the external value - // to trigger the watcher again - self.renderList(); + $scope.$watchMulti( + ['paginate.perPage', self.perPageProp, self.otherWidthGetter], + function (vals, oldVals) { + const intChanges = vals[0] !== oldVals[0]; + + if (intChanges) { + if (!setPerPage(self.perPage)) { + // if we are not able to set the external value, + // render now, otherwise wait for the external value + // to trigger the watcher again + self.renderList(); + } + return; } - return; - } - self.perPage = _.parseInt(self.perPage) || $scope[self.perPageProp]; - if (self.perPage == null) { - self.perPage = ALL; - return; - } + self.perPage = _.parseInt(self.perPage) || $scope[self.perPageProp]; + if (self.perPage == null) { + self.perPage = ALL; + return; + } - self.renderList(); - }); + self.renderList(); + } + ); $scope.$watch('page', self.changePage); $scope.$watchCollection(self.getList, function (list) { diff --git a/src/plugins/kibana_legacy/public/utils/kbn_accessible_click.d.ts b/src/plugins/kibana_legacy/public/utils/kbn_accessible_click.d.ts index e4ef43fe8d443..8b4996109444f 100644 --- a/src/plugins/kibana_legacy/public/utils/kbn_accessible_click.d.ts +++ b/src/plugins/kibana_legacy/public/utils/kbn_accessible_click.d.ts @@ -19,9 +19,6 @@ import { Injectable, IDirectiveFactory, IScope, IAttributes, IController } from 'angular'; -export const KbnAccessibleClickProvider: Injectable>; +export const KbnAccessibleClickProvider: Injectable< + IDirectiveFactory +>; diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/rollups.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/rollups.ts index 3020147e95d98..54699a64aacda 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/rollups.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/rollups.ts @@ -51,9 +51,9 @@ export async function rollDailyData(logger: Logger, savedObjectsClient?: ISavedO let toCreate: Map; do { toCreate = new Map(); - const { saved_objects: rawApplicationUsageTransactional } = await savedObjectsClient.find< - ApplicationUsageTransactional - >({ + const { + saved_objects: rawApplicationUsageTransactional, + } = await savedObjectsClient.find({ type: SAVED_OBJECTS_TRANSACTIONAL_TYPE, perPage: 1000, // Process 1000 at a time as a compromise of speed and overload }); diff --git a/src/plugins/management/public/management_sections_service.ts b/src/plugins/management/public/management_sections_service.ts index b9dc2dd416d9a..4d78ce32cf33f 100644 --- a/src/plugins/management/public/management_sections_service.ts +++ b/src/plugins/management/public/management_sections_service.ts @@ -36,9 +36,10 @@ import { } from './types'; import { createGetterSetter } from '../../kibana_utils/public'; -const [getSectionsServiceStartPrivate, setSectionsServiceStartPrivate] = createGetterSetter< - ManagementSectionsStartPrivate ->('SectionsServiceStartPrivate'); +const [ + getSectionsServiceStartPrivate, + setSectionsServiceStartPrivate, +] = createGetterSetter('SectionsServiceStartPrivate'); export { getSectionsServiceStartPrivate }; diff --git a/src/plugins/saved_objects/public/saved_object/saved_object.test.ts b/src/plugins/saved_objects/public/saved_object/saved_object.test.ts index e4f784e121058..84a35861b7596 100644 --- a/src/plugins/saved_objects/public/saved_object/saved_object.test.ts +++ b/src/plugins/saved_objects/public/saved_object/saved_object.test.ts @@ -216,9 +216,9 @@ describe('Saved Object', () => { return createInitializedSavedObject({ type: 'dashboard', id: 'myId' }).then( (savedObject) => { - stubSavedObjectsClientCreate({ id: 'myId' } as SimpleSavedObject< - SavedObjectAttributes - >); + stubSavedObjectsClientCreate({ + id: 'myId', + } as SimpleSavedObject); return savedObject.save({ confirmOverwrite: false }).then(() => { expect(startMock.overlays.openModal).not.toHaveBeenCalled(); diff --git a/src/plugins/saved_objects_management/public/services/service_registry.ts b/src/plugins/saved_objects_management/public/services/service_registry.ts index d4dc6d6166e46..fc169c100c6b5 100644 --- a/src/plugins/saved_objects_management/public/services/service_registry.ts +++ b/src/plugins/saved_objects_management/public/services/service_registry.ts @@ -25,9 +25,7 @@ export interface SavedObjectsManagementServiceRegistryEntry { title: string; } -export type ISavedObjectsManagementServiceRegistry = PublicMethodsOf< - SavedObjectsManagementServiceRegistry ->; +export type ISavedObjectsManagementServiceRegistry = PublicMethodsOf; export class SavedObjectsManagementServiceRegistry { private readonly registry = new Map(); diff --git a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx index 2173d92819e3d..cd8078a739b3e 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx @@ -60,9 +60,9 @@ describe('NumberRow', () => { test('should call onChange', () => { const comp = shallow(); - comp.find('EuiFieldNumber').prop('onChange')!({ target: { value: '5' } } as React.ChangeEvent< - HTMLInputElement - >); + comp.find('EuiFieldNumber').prop('onChange')!({ + target: { value: '5' }, + } as React.ChangeEvent); expect(defaultProps.onChange).lastCalledWith({ id: defaultProps.model.id, value: '5' }); }); diff --git a/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts b/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts index 6a549ac6f8e0a..47c8cfd8cf134 100644 --- a/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts +++ b/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts @@ -27,6 +27,7 @@ export const [getIndexPatterns, setIndexPatterns] = createGetterSetter('Search'); -export const [getSavedObjectsClient, setSavedObjectsClient] = createGetterSetter< - SavedObjectsClientContract ->('SavedObjectsClient'); +export const [ + getSavedObjectsClient, + setSavedObjectsClient, +] = createGetterSetter('SavedObjectsClient'); diff --git a/src/plugins/vis_type_timelion/server/series_functions/legend.js b/src/plugins/vis_type_timelion/server/series_functions/legend.js index aae5b723e30bf..2f7d526d6e461 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/legend.js +++ b/src/plugins/vis_type_timelion/server/series_functions/legend.js @@ -113,27 +113,24 @@ export default new Chainable('legend', { defaultMessage: 'Set the position and style of the legend on the plot', }), fn: function legendFn(args) { - return alter(args, function ( - eachSeries, - position, - columns, - showTime = true, - timeFormat = DEFAULT_TIME_FORMAT - ) { - eachSeries._global = eachSeries._global || {}; - eachSeries._global.legend = eachSeries._global.legend || {}; - eachSeries._global.legend.noColumns = columns; - eachSeries._global.legend.showTime = showTime; - eachSeries._global.legend.timeFormat = timeFormat; + return alter( + args, + function (eachSeries, position, columns, showTime = true, timeFormat = DEFAULT_TIME_FORMAT) { + eachSeries._global = eachSeries._global || {}; + eachSeries._global.legend = eachSeries._global.legend || {}; + eachSeries._global.legend.noColumns = columns; + eachSeries._global.legend.showTime = showTime; + eachSeries._global.legend.timeFormat = timeFormat; - if (position === false) { - eachSeries._global.legend.show = false; - eachSeries._global.legend.showTime = false; - } else { - eachSeries._global.legend.position = position; - } + if (position === false) { + eachSeries._global.legend.show = false; + eachSeries._global.legend.showTime = false; + } else { + eachSeries._global.legend.position = position; + } - return eachSeries; - }); + return eachSeries; + } + ); }, }); diff --git a/src/plugins/vis_type_timelion/server/series_functions/yaxis.js b/src/plugins/vis_type_timelion/server/series_functions/yaxis.js index 7a249305ee76e..2c5bcccde5484 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/yaxis.js +++ b/src/plugins/vis_type_timelion/server/series_functions/yaxis.js @@ -106,86 +106,79 @@ export default new Chainable('yaxis', { 'Configures a variety of y-axis options, the most important likely being the ability to add an Nth (eg 2nd) y-axis', }), fn: function yaxisFn(args) { - return alter(args, function ( - eachSeries, - yaxis, - min, - max, - position, - label, - color, - units, - tickDecimals - ) { - yaxis = yaxis || 1; + return alter( + args, + function (eachSeries, yaxis, min, max, position, label, color, units, tickDecimals) { + yaxis = yaxis || 1; - eachSeries.yaxis = yaxis; - eachSeries._global = eachSeries._global || {}; + eachSeries.yaxis = yaxis; + eachSeries._global = eachSeries._global || {}; - eachSeries._global.yaxes = eachSeries._global.yaxes || []; - eachSeries._global.yaxes[yaxis - 1] = eachSeries._global.yaxes[yaxis - 1] || {}; + eachSeries._global.yaxes = eachSeries._global.yaxes || []; + eachSeries._global.yaxes[yaxis - 1] = eachSeries._global.yaxes[yaxis - 1] || {}; - const myAxis = eachSeries._global.yaxes[yaxis - 1]; - myAxis.position = position || (yaxis % 2 ? 'left' : 'right'); - myAxis.min = min; - myAxis.max = max; - myAxis.axisLabelFontSizePixels = 11; - myAxis.axisLabel = label; - myAxis.axisLabelColour = color; - myAxis.axisLabelUseCanvas = true; + const myAxis = eachSeries._global.yaxes[yaxis - 1]; + myAxis.position = position || (yaxis % 2 ? 'left' : 'right'); + myAxis.min = min; + myAxis.max = max; + myAxis.axisLabelFontSizePixels = 11; + myAxis.axisLabel = label; + myAxis.axisLabelColour = color; + myAxis.axisLabelUseCanvas = true; - if (tickDecimals) { - myAxis.tickDecimals = tickDecimals < 0 ? 0 : tickDecimals; - } - - if (units) { - const unitTokens = units.split(':'); - const unitType = unitTokens[0]; - if (!tickFormatters[unitType]) { - throw new Error( - i18n.translate( - 'timelion.serverSideErrors.yaxisFunction.notSupportedUnitTypeErrorMessage', - { - defaultMessage: '{units} is not a supported unit type.', - values: { units }, - } - ) - ); + if (tickDecimals) { + myAxis.tickDecimals = tickDecimals < 0 ? 0 : tickDecimals; } - if (unitType === 'currency') { - const threeLetterCode = /^[A-Za-z]{3}$/; - const currency = unitTokens[1]; - if (currency && !threeLetterCode.test(currency)) { + + if (units) { + const unitTokens = units.split(':'); + const unitType = unitTokens[0]; + if (!tickFormatters[unitType]) { throw new Error( i18n.translate( - 'timelion.serverSideErrors.yaxisFunction.notValidCurrencyFormatErrorMessage', + 'timelion.serverSideErrors.yaxisFunction.notSupportedUnitTypeErrorMessage', { - defaultMessage: 'Currency must be a three letter code', + defaultMessage: '{units} is not a supported unit type.', + values: { units }, } ) ); } - } + if (unitType === 'currency') { + const threeLetterCode = /^[A-Za-z]{3}$/; + const currency = unitTokens[1]; + if (currency && !threeLetterCode.test(currency)) { + throw new Error( + i18n.translate( + 'timelion.serverSideErrors.yaxisFunction.notValidCurrencyFormatErrorMessage', + { + defaultMessage: 'Currency must be a three letter code', + } + ) + ); + } + } - myAxis.units = { - type: unitType, - prefix: unitTokens[1] || '', - suffix: unitTokens[2] || '', - }; + myAxis.units = { + type: unitType, + prefix: unitTokens[1] || '', + suffix: unitTokens[2] || '', + }; - if (unitType === 'percent') { - // jquery.flot uses axis.tickDecimals to generate tick values - // need 2 extra decimal places to preserve precision when percent shifts value to left - myAxis.units.tickDecimalsShift = 2; - if (tickDecimals) { - myAxis.tickDecimals += myAxis.units.tickDecimalsShift; - } else { - myAxis.tickDecimals = myAxis.units.tickDecimalsShift; + if (unitType === 'percent') { + // jquery.flot uses axis.tickDecimals to generate tick values + // need 2 extra decimal places to preserve precision when percent shifts value to left + myAxis.units.tickDecimalsShift = 2; + if (tickDecimals) { + myAxis.tickDecimals += myAxis.units.tickDecimalsShift; + } else { + myAxis.tickDecimals = myAxis.units.tickDecimalsShift; + } } } - } - return eachSeries; - }); + return eachSeries; + } + ); }, }); diff --git a/src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts b/src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts index 3acfcb5230cb1..a7c15dbfed8d8 100644 --- a/src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts +++ b/src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts @@ -24,9 +24,8 @@ import { VisTypeAlias } from '../vis_types'; describe('saved_visualizations', () => { function testProps() { - const savedObjects = coreMock.createStart().savedObjects.client as jest.Mocked< - SavedObjectsClientContract - >; + const savedObjects = coreMock.createStart().savedObjects + .client as jest.Mocked; (savedObjects.find as jest.Mock).mockImplementation(() => ({ total: 0, savedObjects: [], diff --git a/src/plugins/visualizations/public/services.ts b/src/plugins/visualizations/public/services.ts index 08537b4ac3081..1c7dd7a72e3bc 100644 --- a/src/plugins/visualizations/public/services.ts +++ b/src/plugins/visualizations/public/services.ts @@ -83,9 +83,10 @@ export const [getExpressions, setExpressions] = createGetterSetter('UiActions'); -export const [getSavedVisualizationsLoader, setSavedVisualizationsLoader] = createGetterSetter< - SavedVisualizationsLoader ->('SavedVisualisationsLoader'); +export const [ + getSavedVisualizationsLoader, + setSavedVisualizationsLoader, +] = createGetterSetter('SavedVisualisationsLoader'); export const [getAggs, setAggs] = createGetterSetter( 'AggConfigs' diff --git a/x-pack/examples/alerting_example/public/alert_types/always_firing.tsx b/x-pack/examples/alerting_example/public/alert_types/always_firing.tsx index abbe1d2a48d11..6e44479d058d8 100644 --- a/x-pack/examples/alerting_example/public/alert_types/always_firing.tsx +++ b/x-pack/examples/alerting_example/public/alert_types/always_firing.tsx @@ -64,10 +64,9 @@ const DEFAULT_THRESHOLDS: AlwaysFiringParams['thresholds'] = { large: 10000, }; -export const AlwaysFiringExpression: React.FunctionComponent> = ({ alertParams, setAlertParams, actionGroups, defaultActionGroupId }) => { +export const AlwaysFiringExpression: React.FunctionComponent< + AlertTypeParamsExpressionProps +> = ({ alertParams, setAlertParams, actionGroups, defaultActionGroupId }) => { const { instances = DEFAULT_INSTANCES_TO_GENERATE, thresholds = pick(DEFAULT_THRESHOLDS, defaultActionGroupId), diff --git a/x-pack/plugins/actions/server/actions_client.ts b/x-pack/plugins/actions/server/actions_client.ts index 2735a1ab44521..0d41b520501ad 100644 --- a/x-pack/plugins/actions/server/actions_client.ts +++ b/x-pack/plugins/actions/server/actions_client.ts @@ -155,9 +155,11 @@ export class ActionsClient { 'update' ); } - const { attributes, references, version } = await this.unsecuredSavedObjectsClient.get< - RawAction - >('action', id); + const { + attributes, + references, + version, + } = await this.unsecuredSavedObjectsClient.get('action', id); const { actionTypeId } = attributes; const { name, config, secrets } = action; const actionType = this.actionTypeRegistry.get(actionTypeId); diff --git a/x-pack/plugins/actions/server/authorization/actions_authorization.test.ts b/x-pack/plugins/actions/server/authorization/actions_authorization.test.ts index a19a662f8323c..b5676fc837fe8 100644 --- a/x-pack/plugins/actions/server/authorization/actions_authorization.test.ts +++ b/x-pack/plugins/actions/server/authorization/actions_authorization.test.ts @@ -64,9 +64,9 @@ describe('ensureAuthorized', () => { test('ensures the user has privileges to use the operation on the Actions Saved Object type', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const actionsAuthorization = new ActionsAuthorization({ request, @@ -105,9 +105,9 @@ describe('ensureAuthorized', () => { test('ensures the user has privileges to execute an Actions Saved Object type', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const actionsAuthorization = new ActionsAuthorization({ request, @@ -156,9 +156,9 @@ describe('ensureAuthorized', () => { test('throws if user lacks the required privieleges', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const actionsAuthorization = new ActionsAuthorization({ request, @@ -198,9 +198,9 @@ describe('ensureAuthorized', () => { test('exempts users from requiring privileges to execute actions when authorizationMode is Legacy', async () => { const { authorization, authentication } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const actionsAuthorization = new ActionsAuthorization({ request, diff --git a/x-pack/plugins/alerts/server/alerts_client/alerts_client.ts b/x-pack/plugins/alerts/server/alerts_client/alerts_client.ts index c08ff9449d151..c83e24c5a45f4 100644 --- a/x-pack/plugins/alerts/server/alerts_client/alerts_client.ts +++ b/x-pack/plugins/alerts/server/alerts_client/alerts_client.ts @@ -454,9 +454,11 @@ export class AlertsClient { let attributes: RawAlert; try { - const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser< - RawAlert - >('alert', id, { namespace: this.namespace }); + const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser( + 'alert', + id, + { namespace: this.namespace } + ); apiKeyToInvalidate = decryptedAlert.attributes.apiKey; taskIdToRemove = decryptedAlert.attributes.scheduledTaskId; attributes = decryptedAlert.attributes; @@ -505,9 +507,11 @@ export class AlertsClient { let alertSavedObject: SavedObject; try { - alertSavedObject = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser< - RawAlert - >('alert', id, { namespace: this.namespace }); + alertSavedObject = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser( + 'alert', + id, + { namespace: this.namespace } + ); } catch (e) { // We'll skip invalidating the API key since we failed to load the decrypted saved object this.logger.error( @@ -636,9 +640,11 @@ export class AlertsClient { let version: string | undefined; try { - const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser< - RawAlert - >('alert', id, { namespace: this.namespace }); + const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser( + 'alert', + id, + { namespace: this.namespace } + ); apiKeyToInvalidate = decryptedAlert.attributes.apiKey; attributes = decryptedAlert.attributes; version = decryptedAlert.version; @@ -707,9 +713,11 @@ export class AlertsClient { let version: string | undefined; try { - const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser< - RawAlert - >('alert', id, { namespace: this.namespace }); + const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser( + 'alert', + id, + { namespace: this.namespace } + ); apiKeyToInvalidate = decryptedAlert.attributes.apiKey; attributes = decryptedAlert.attributes; version = decryptedAlert.version; @@ -789,9 +797,11 @@ export class AlertsClient { let version: string | undefined; try { - const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser< - RawAlert - >('alert', id, { namespace: this.namespace }); + const decryptedAlert = await this.encryptedSavedObjectsClient.getDecryptedAsInternalUser( + 'alert', + id, + { namespace: this.namespace } + ); apiKeyToInvalidate = decryptedAlert.attributes.apiKey; attributes = decryptedAlert.attributes; version = decryptedAlert.version; diff --git a/x-pack/plugins/alerts/server/alerts_client/tests/create.test.ts b/x-pack/plugins/alerts/server/alerts_client/tests/create.test.ts index 6d259029ac480..171ed13763c46 100644 --- a/x-pack/plugins/alerts/server/alerts_client/tests/create.test.ts +++ b/x-pack/plugins/alerts/server/alerts_client/tests/create.test.ts @@ -378,9 +378,7 @@ describe('create()', () => { "scheduledTaskId": "task-123", } `); - const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked< - ActionsClient - >; + const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked; expect(actionsClient.isActionTypeEnabled).toHaveBeenCalledWith('test', { notifyUsage: true }); }); @@ -702,9 +700,7 @@ describe('create()', () => { test('throws error if loading actions fails', async () => { const data = getMockData(); // Reset from default behaviour - const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked< - ActionsClient - >; + const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked; actionsClient.getBulk.mockReset(); actionsClient.getBulk.mockRejectedValueOnce(new Error('Test Error')); alertsClientParams.getActionsClient.mockResolvedValue(actionsClient); diff --git a/x-pack/plugins/alerts/server/alerts_client/tests/update.test.ts b/x-pack/plugins/alerts/server/alerts_client/tests/update.test.ts index d0bb2607f7a47..046d7ec63c048 100644 --- a/x-pack/plugins/alerts/server/alerts_client/tests/update.test.ts +++ b/x-pack/plugins/alerts/server/alerts_client/tests/update.test.ts @@ -328,9 +328,7 @@ describe('update()', () => { "version": "123", } `); - const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked< - ActionsClient - >; + const actionsClient = (await alertsClientParams.getActionsClient()) as jest.Mocked; expect(actionsClient.isActionTypeEnabled).toHaveBeenCalledWith('test', { notifyUsage: true }); expect(actionsClient.isActionTypeEnabled).toHaveBeenCalledWith('test2', { notifyUsage: true }); }); diff --git a/x-pack/plugins/alerts/server/alerts_client_factory.test.ts b/x-pack/plugins/alerts/server/alerts_client_factory.test.ts index bdbfc726dab8f..49a90c62bc581 100644 --- a/x-pack/plugins/alerts/server/alerts_client_factory.test.ts +++ b/x-pack/plugins/alerts/server/alerts_client_factory.test.ts @@ -68,9 +68,9 @@ const actionsAuthorization = actionsAuthorizationMock.create(); beforeEach(() => { jest.resetAllMocks(); alertsClientFactoryParams.actions = actionsMock.createStart(); - (alertsClientFactoryParams.actions as jest.Mocked< - ActionsStartContract - >).getActionsAuthorizationWithRequest.mockReturnValue(actionsAuthorization); + (alertsClientFactoryParams.actions as jest.Mocked).getActionsAuthorizationWithRequest.mockReturnValue( + actionsAuthorization + ); alertsClientFactoryParams.getSpaceId.mockReturnValue('default'); alertsClientFactoryParams.spaceIdToNamespace.mockReturnValue('default'); }); diff --git a/x-pack/plugins/alerts/server/authorization/alerts_authorization.test.ts b/x-pack/plugins/alerts/server/authorization/alerts_authorization.test.ts index b3c7ada26c456..eb116b9e208dc 100644 --- a/x-pack/plugins/alerts/server/authorization/alerts_authorization.test.ts +++ b/x-pack/plugins/alerts/server/authorization/alerts_authorization.test.ts @@ -240,9 +240,9 @@ describe('AlertsAuthorization', () => { test('ensures the user has privileges to execute the specified type, operation and consumer', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const alertAuthorization = new AlertsAuthorization({ request, @@ -283,9 +283,9 @@ describe('AlertsAuthorization', () => { test('ensures the user has privileges to execute the specified type and operation without consumer when consumer is alerts', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const alertAuthorization = new AlertsAuthorization({ request, @@ -326,9 +326,9 @@ describe('AlertsAuthorization', () => { test('ensures the user has privileges to execute the specified type, operation and producer when producer is different from consumer', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -377,9 +377,9 @@ describe('AlertsAuthorization', () => { test('throws if user lacks the required privieleges for the consumer', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const alertAuthorization = new AlertsAuthorization({ request, @@ -428,9 +428,9 @@ describe('AlertsAuthorization', () => { test('throws if user lacks the required privieleges for the producer', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const alertAuthorization = new AlertsAuthorization({ request, @@ -479,9 +479,9 @@ describe('AlertsAuthorization', () => { test('throws if user lacks the required privieleges for both consumer and producer', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); const alertAuthorization = new AlertsAuthorization({ request, @@ -594,9 +594,9 @@ describe('AlertsAuthorization', () => { test('creates a filter based on the privileged types', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -625,9 +625,9 @@ describe('AlertsAuthorization', () => { test('creates an `ensureAlertTypeIsAuthorized` function which throws if type is unauthorized', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -686,9 +686,9 @@ describe('AlertsAuthorization', () => { test('creates an `ensureAlertTypeIsAuthorized` function which is no-op if type is authorized', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -736,9 +736,9 @@ describe('AlertsAuthorization', () => { test('creates an `logSuccessfulAuthorization` function which logs every authorized type', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -913,9 +913,9 @@ describe('AlertsAuthorization', () => { test('augments a list of types with consumers under which the operation is authorized', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -1001,9 +1001,9 @@ describe('AlertsAuthorization', () => { test('authorizes user under the Alerts consumer when they are authorized by the producer', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -1062,9 +1062,9 @@ describe('AlertsAuthorization', () => { test('augments a list of types with consumers under which multiple operations are authorized', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', @@ -1174,9 +1174,9 @@ describe('AlertsAuthorization', () => { test('omits types which have no consumers under which the operation is authorized', async () => { const { authorization } = mockSecurity(); - const checkPrivileges: jest.MockedFunction> = jest.fn(); + const checkPrivileges: jest.MockedFunction< + ReturnType + > = jest.fn(); authorization.checkPrivilegesDynamicallyWithRequest.mockReturnValue(checkPrivileges); checkPrivileges.mockResolvedValueOnce({ username: 'some-user', diff --git a/x-pack/plugins/alerts/server/invalidate_pending_api_keys/task.ts b/x-pack/plugins/alerts/server/invalidate_pending_api_keys/task.ts index 77cbb9f4a4a85..119c3b697fd2e 100644 --- a/x-pack/plugins/alerts/server/invalidate_pending_api_keys/task.ts +++ b/x-pack/plugins/alerts/server/invalidate_pending_api_keys/task.ts @@ -202,9 +202,10 @@ async function invalidateApiKeys( let totalInvalidated = 0; await Promise.all( apiKeysToInvalidate.saved_objects.map(async (apiKeyObj) => { - const decryptedApiKey = await encryptedSavedObjectsClient.getDecryptedAsInternalUser< - InvalidatePendingApiKey - >('api_key_pending_invalidation', apiKeyObj.id); + const decryptedApiKey = await encryptedSavedObjectsClient.getDecryptedAsInternalUser( + 'api_key_pending_invalidation', + apiKeyObj.id + ); const apiKeyId = decryptedApiKey.attributes.apiKeyId; const response = await invalidateAPIKey({ id: apiKeyId }, securityPluginSetup); if (response.apiKeysEnabled === true && response.result.error_count > 0) { diff --git a/x-pack/plugins/alerts/server/saved_objects/partially_update_alert.test.ts b/x-pack/plugins/alerts/server/saved_objects/partially_update_alert.test.ts index 8041ec551bb0d..c272e0490cbab 100644 --- a/x-pack/plugins/alerts/server/saved_objects/partially_update_alert.test.ts +++ b/x-pack/plugins/alerts/server/saved_objects/partially_update_alert.test.ts @@ -14,9 +14,7 @@ import { partiallyUpdateAlert, PartiallyUpdateableAlertAttributes } from './part import { savedObjectsClientMock } from '../../../../../src/core/server/mocks'; const MockSavedObjectsClientContract = savedObjectsClientMock.create(); -const MockISavedObjectsRepository = (MockSavedObjectsClientContract as unknown) as jest.Mocked< - ISavedObjectsRepository ->; +const MockISavedObjectsRepository = (MockSavedObjectsClientContract as unknown) as jest.Mocked; describe('partially_update_alert', () => { beforeEach(() => { diff --git a/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx b/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx index e08bd01a1842b..e6fc80ed7c3b7 100644 --- a/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx +++ b/x-pack/plugins/apm/public/application/action_menu/anomaly_detection_setup_link.tsx @@ -23,9 +23,7 @@ import { useUrlParams } from '../../hooks/useUrlParams'; import { APIReturnType } from '../../services/rest/createCallApmApi'; import { units } from '../../style/variables'; -export type AnomalyDetectionApiResponse = APIReturnType< - 'GET /api/apm/settings/anomaly-detection' ->; +export type AnomalyDetectionApiResponse = APIReturnType<'GET /api/apm/settings/anomaly-detection'>; const DEFAULT_DATA = { jobs: [], hasLegacyJobs: false }; diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx index 777ee014d3e58..643064b2f3176 100644 --- a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/DetailView/index.tsx @@ -55,9 +55,7 @@ const TransactionLinkName = styled.div` `; interface Props { - errorGroup: APIReturnType< - 'GET /api/apm/services/{serviceName}/errors/{groupId}' - >; + errorGroup: APIReturnType<'GET /api/apm/services/{serviceName}/errors/{groupId}'>; urlParams: IUrlParams; location: Location; } diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx index fd656b8be6ec7..99316e3520a76 100644 --- a/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ErrorGroupDetails/Distribution/index.tsx @@ -22,9 +22,7 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { asRelativeDateTimeRange } from '../../../../../common/utils/formatters'; import { useTheme } from '../../../../hooks/useTheme'; -type ErrorDistributionAPIResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/errors/distribution' ->; +type ErrorDistributionAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/errors/distribution'>; interface FormattedBucket { x0: number; diff --git a/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx b/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx index bfa426985d1c6..be1078ea860c3 100644 --- a/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ErrorGroupOverview/List/index.tsx @@ -48,9 +48,7 @@ const Culprit = styled.div` font-family: ${fontFamilyCode}; `; -type ErrorGroupListAPIResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/errors' ->; +type ErrorGroupListAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/errors'>; interface Props { items: ErrorGroupListAPIResponse; diff --git a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx index b757635af1702..3a5c3d80ca7d1 100644 --- a/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx +++ b/x-pack/plugins/apm/public/components/app/RumDashboard/VisitorBreakdownMap/EmbeddedMap.tsx @@ -61,9 +61,9 @@ export function EmbeddedMapComponent() { MapEmbeddable | ErrorEmbeddable | undefined >(); - const embeddableRoot: React.RefObject = useRef< - HTMLDivElement - >(null); + const embeddableRoot: React.RefObject = useRef( + null + ); const { services: { embeddable: embeddablePlugin }, diff --git a/x-pack/plugins/apm/public/components/app/ServiceMetrics/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceMetrics/index.tsx index 5808c54d578c6..01bcc4ddb801f 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceMetrics/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ServiceMetrics/index.tsx @@ -34,7 +34,9 @@ export function ServiceMetrics({ const { data } = useServiceMetricCharts(urlParams, agentName); const { start, end } = urlParams; - const localFiltersConfig: React.ComponentProps = useMemo( + const localFiltersConfig: React.ComponentProps< + typeof LocalUIFilters + > = useMemo( () => ({ filterNames: ['host', 'containerId', 'podName', 'serviceVersion'], params: { diff --git a/x-pack/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx b/x-pack/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx index 89c5c801a5683..74e7b652d0ebe 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/ServiceNodeOverview/index.tsx @@ -45,7 +45,9 @@ function ServiceNodeOverview({ serviceName }: ServiceNodeOverviewProps) { const { uiFilters, urlParams } = useUrlParams(); const { start, end } = urlParams; - const localFiltersConfig: React.ComponentProps = useMemo( + const localFiltersConfig: React.ComponentProps< + typeof LocalUIFilters + > = useMemo( () => ({ filterNames: ['host', 'containerId', 'podName'], params: { diff --git a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx index debf3fa85d935..2cda5fcf85909 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/index.tsx @@ -17,9 +17,7 @@ import { LicensePrompt } from '../../../shared/LicensePrompt'; import { useLicense } from '../../../../hooks/useLicense'; import { APIReturnType } from '../../../../services/rest/createCallApmApi'; -export type AnomalyDetectionApiResponse = APIReturnType< - 'GET /api/apm/settings/anomaly-detection' ->; +export type AnomalyDetectionApiResponse = APIReturnType<'GET /api/apm/settings/anomaly-detection'>; const DEFAULT_VALUE: AnomalyDetectionApiResponse = { jobs: [], diff --git a/x-pack/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx b/x-pack/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx index ac4af7b126468..e92a6c7db8445 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx @@ -33,13 +33,9 @@ import { unit } from '../../../../style/variables'; import { ChartContainer } from '../../../shared/charts/chart_container'; import { EmptyMessage } from '../../../shared/EmptyMessage'; -type TransactionDistributionAPIResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups/distribution' ->; +type TransactionDistributionAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>; -type DistributionApiResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups/distribution' ->; +type DistributionApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>; type DistributionBucket = DistributionApiResponse['buckets'][0]; diff --git a/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx b/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx index 86221a6e92853..c9420dbb81cb9 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionDetails/WaterfallWithSummmary/index.tsx @@ -27,9 +27,7 @@ import { MaybeViewTraceLink } from './MaybeViewTraceLink'; import { TransactionTabs } from './TransactionTabs'; import { IWaterfall } from './WaterfallContainer/Waterfall/waterfall_helpers/waterfall_helpers'; -type DistributionApiResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups/distribution' ->; +type DistributionApiResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>; type DistributionBucket = DistributionApiResponse['buckets'][0]; diff --git a/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/TransactionList.stories.tsx b/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/TransactionList.stories.tsx index 65dfdd19fa0c5..953397b9f3d5f 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/TransactionList.stories.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/TransactionList.stories.tsx @@ -10,9 +10,7 @@ import { APIReturnType } from '../../../../services/rest/createCallApmApi'; import { MockApmPluginContextWrapper } from '../../../../context/ApmPluginContext/MockApmPluginContext'; import { TransactionList } from './'; -type TransactionGroup = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups' ->['items'][0]; +type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>['items'][0]; export default { title: 'app/TransactionOverview/TransactionList', diff --git a/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/index.tsx b/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/index.tsx index b084d05ee16e8..ece923631a2f7 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/index.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/index.tsx @@ -20,9 +20,7 @@ import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt'; import { EmptyMessage } from '../../../shared/EmptyMessage'; import { TransactionDetailLink } from '../../../shared/Links/apm/TransactionDetailLink'; -type TransactionGroup = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups' ->['items'][0]; +type TransactionGroup = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>['items'][0]; // Truncate both the link and the child span (the tooltip anchor.) The link so // it doesn't overflow, and the anchor so we get the ellipsis. diff --git a/x-pack/plugins/apm/public/components/app/TransactionOverview/index.tsx b/x-pack/plugins/apm/public/components/app/TransactionOverview/index.tsx index 8208916c20337..2803eaef44dee 100644 --- a/x-pack/plugins/apm/public/components/app/TransactionOverview/index.tsx +++ b/x-pack/plugins/apm/public/components/app/TransactionOverview/index.tsx @@ -96,7 +96,9 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) { status: transactionListStatus, } = useTransactionList(urlParams); - const localFiltersConfig: React.ComponentProps = useMemo( + const localFiltersConfig: React.ComponentProps< + typeof LocalUIFilters + > = useMemo( () => ({ filterNames: [ 'transactionResult', diff --git a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx index 3fa047d840dda..3c84b3982642d 100644 --- a/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_inventory/index.tsx @@ -99,7 +99,9 @@ export function ServiceInventory() { useTrackPageview({ app: 'apm', path: 'services_overview' }); useTrackPageview({ app: 'apm', path: 'services_overview', delay: 15000 }); - const localFiltersConfig: React.ComponentProps = useMemo( + const localFiltersConfig: React.ComponentProps< + typeof LocalUIFilters + > = useMemo( () => ({ filterNames: ['host', 'agentName'], projection: Projection.services, diff --git a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx index e91ab338c4a27..e241bc2fed05a 100644 --- a/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx +++ b/x-pack/plugins/apm/public/components/app/service_overview/service_overview_transactions_table/index.tsx @@ -36,9 +36,7 @@ import { ImpactBar } from '../../../shared/ImpactBar'; import { ServiceOverviewTable } from '../service_overview_table'; type ServiceTransactionGroupItem = ValuesType< - APIReturnType< - 'GET /api/apm/services/{serviceName}/overview_transaction_groups' - >['transactionGroups'] + APIReturnType<'GET /api/apm/services/{serviceName}/overview_transaction_groups'>['transactionGroups'] >; interface Props { diff --git a/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts b/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts index 9980569ee54dd..9cbfee37d1253 100644 --- a/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts +++ b/x-pack/plugins/apm/public/hooks/useTransactionDistribution.ts @@ -13,9 +13,7 @@ import { toQuery, fromQuery } from '../components/shared/Links/url_helpers'; import { maybe } from '../../common/utils/maybe'; import { APIReturnType } from '../services/rest/createCallApmApi'; -type APIResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups/distribution' ->; +type APIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups/distribution'>; const INITIAL_DATA = { buckets: [] as APIResponse['buckets'], diff --git a/x-pack/plugins/apm/public/hooks/useTransactionList.ts b/x-pack/plugins/apm/public/hooks/useTransactionList.ts index e847309fd0265..92b54beb715db 100644 --- a/x-pack/plugins/apm/public/hooks/useTransactionList.ts +++ b/x-pack/plugins/apm/public/hooks/useTransactionList.ts @@ -10,9 +10,7 @@ import { IUrlParams } from '../context/UrlParamsContext/types'; import { APIReturnType } from '../services/rest/createCallApmApi'; import { useFetcher } from './useFetcher'; -type TransactionsAPIResponse = APIReturnType< - 'GET /api/apm/services/{serviceName}/transaction_groups' ->; +type TransactionsAPIResponse = APIReturnType<'GET /api/apm/services/{serviceName}/transaction_groups'>; const DEFAULT_RESPONSE: Partial = { items: undefined, diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts index 393a73f7c1ccd..b971a1c28397d 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_anomaly_data/transform.ts @@ -10,9 +10,7 @@ import { ESResponse } from './fetcher'; type IBucket = ReturnType; function getBucket( - bucket: Required< - ESResponse - >['aggregations']['ml_avg_response_times']['buckets'][0] + bucket: Required['aggregations']['ml_avg_response_times']['buckets'][0] ) { return { x: bucket.key, diff --git a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts index e5d6aad693869..eecb3e7177ef6 100644 --- a/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts +++ b/x-pack/plugins/apm/server/lib/transactions/charts/get_timeseries_data/transform.ts @@ -42,9 +42,7 @@ export function timeseriesTransformer({ }; } -type TransactionResultBuckets = Required< - ESResponse ->['aggregations']['transaction_results']['buckets']; +type TransactionResultBuckets = Required['aggregations']['transaction_results']['buckets']; export function getTpmBuckets({ transactionResultBuckets = [], @@ -86,9 +84,7 @@ export function getTpmBuckets({ ); } -type ResponseTimeBuckets = Required< - ESResponse ->['aggregations']['response_times']['buckets']; +type ResponseTimeBuckets = Required['aggregations']['response_times']['buckets']; function getResponseTime(responseTimeBuckets: ResponseTimeBuckets = []) { return responseTimeBuckets.reduce( diff --git a/x-pack/plugins/canvas/server/routes/custom_elements/update.ts b/x-pack/plugins/canvas/server/routes/custom_elements/update.ts index a65d23d8c1406..cac60fea784d3 100644 --- a/x-pack/plugins/canvas/server/routes/custom_elements/update.ts +++ b/x-pack/plugins/canvas/server/routes/custom_elements/update.ts @@ -37,9 +37,10 @@ export function initializeUpdateCustomElementRoute(deps: RouteInitializerDeps) { const now = new Date().toISOString(); - const customElementObject = await context.core.savedObjects.client.get< - CustomElementAttributes - >(CUSTOM_ELEMENT_TYPE, id); + const customElementObject = await context.core.savedObjects.client.get( + CUSTOM_ELEMENT_TYPE, + id + ); await context.core.savedObjects.client.create( CUSTOM_ELEMENT_TYPE, diff --git a/x-pack/plugins/case/server/routes/api/cases/get_case.test.ts b/x-pack/plugins/case/server/routes/api/cases/get_case.test.ts index 6e2dfdc59f1b1..ca6598fcb288c 100644 --- a/x-pack/plugins/case/server/routes/api/cases/get_case.test.ts +++ b/x-pack/plugins/case/server/routes/api/cases/get_case.test.ts @@ -46,9 +46,9 @@ describe('GET case', () => { ); const response = await routeHandler(theContext, request, kibanaResponseFactory); - const savedObject = (mockCases.find((s) => s.id === 'mock-id-1') as unknown) as SavedObject< - ESCaseAttributes - >; + const savedObject = (mockCases.find( + (s) => s.id === 'mock-id-1' + ) as unknown) as SavedObject; expect(response.status).toEqual(200); expect(response.payload).toEqual( flattenCaseSavedObject({ diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_background_session_indicator/connected_background_session_indicator.test.tsx b/x-pack/plugins/data_enhanced/public/search/ui/connected_background_session_indicator/connected_background_session_indicator.test.tsx index b21081e10bbe1..d97d10512783c 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_background_session_indicator/connected_background_session_indicator.test.tsx +++ b/x-pack/plugins/data_enhanced/public/search/ui/connected_background_session_indicator/connected_background_session_indicator.test.tsx @@ -11,9 +11,8 @@ import { createConnectedBackgroundSessionIndicator } from './connected_backgroun import { BehaviorSubject } from 'rxjs'; import { ISessionService } from '../../../../../../../src/plugins/data/public'; -const sessionService = dataPluginMock.createStartContract().search.session as jest.Mocked< - ISessionService ->; +const sessionService = dataPluginMock.createStartContract().search + .session as jest.Mocked; test("shouldn't show indicator in case no active search session", async () => { const BackgroundSessionIndicator = createConnectedBackgroundSessionIndicator({ sessionService }); diff --git a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts index a82a162a14e2b..f528843cf9ea3 100644 --- a/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts +++ b/x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_object_type_definition.test.ts @@ -9,14 +9,16 @@ import { EncryptedSavedObjectAttributesDefinition } from './encrypted_saved_obje it('correctly determines attribute properties', () => { const attributes = ['attr#1', 'attr#2', 'attr#3', 'attr#4']; - const cases: Array<[ - EncryptedSavedObjectTypeRegistration, - { - shouldBeEncrypted: boolean[]; - shouldBeExcludedFromAAD: boolean[]; - shouldBeStripped: boolean[]; - } - ]> = [ + const cases: Array< + [ + EncryptedSavedObjectTypeRegistration, + { + shouldBeEncrypted: boolean[]; + shouldBeExcludedFromAAD: boolean[]; + shouldBeStripped: boolean[]; + } + ] + > = [ [ { type: 'so-type', diff --git a/x-pack/plugins/fleet/public/applications/fleet/types/ui_extensions.ts b/x-pack/plugins/fleet/public/applications/fleet/types/ui_extensions.ts index fbede8af95b66..a8a961ca949b6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/types/ui_extensions.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/types/ui_extensions.ts @@ -19,9 +19,7 @@ export interface UIExtensionsStorage { * UI Component Extension is used on the pages displaying the ability to edit an * Integration Policy */ -export type PackagePolicyEditExtensionComponent = ComponentType< - PackagePolicyEditExtensionComponentProps ->; +export type PackagePolicyEditExtensionComponent = ComponentType; export interface PackagePolicyEditExtensionComponentProps { /** The current integration policy being edited */ @@ -51,9 +49,7 @@ export interface PackagePolicyEditExtension { * UI Component Extension is used on the pages displaying the ability to Create an * Integration Policy */ -export type PackagePolicyCreateExtensionComponent = ComponentType< - PackagePolicyCreateExtensionComponentProps ->; +export type PackagePolicyCreateExtensionComponent = ComponentType; export interface PackagePolicyCreateExtensionComponentProps { /** The integration policy being created */ diff --git a/x-pack/plugins/fleet/server/routes/agent/handlers.ts b/x-pack/plugins/fleet/server/routes/agent/handlers.ts index 5e075cbbcdf5e..eff7d3c3c5cf3 100644 --- a/x-pack/plugins/fleet/server/routes/agent/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent/handlers.ts @@ -35,9 +35,9 @@ import * as AgentService from '../../services/agents'; import * as APIKeyService from '../../services/api_keys'; import { appContextService } from '../../services/app_context'; -export const getAgentHandler: RequestHandler> = async (context, request, response) => { +export const getAgentHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; try { const agent = await AgentService.getAgent(soClient, request.params.agentId); @@ -94,9 +94,9 @@ export const getAgentEventsHandler: RequestHandler< } }; -export const deleteAgentHandler: RequestHandler> = async (context, request, response) => { +export const deleteAgentHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; try { await AgentService.deleteAgent(soClient, request.params.agentId); diff --git a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts index 91a033a5379df..25aaf5f9a4656 100644 --- a/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/agent_policy/handlers.ts @@ -70,9 +70,9 @@ export const getAgentPoliciesHandler: RequestHandler< } }; -export const getOneAgentPolicyHandler: RequestHandler> = async (context, request, response) => { +export const getOneAgentPolicyHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; try { const agentPolicy = await agentPolicyService.get(soClient, request.params.agentPolicyId); diff --git a/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts b/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts index 50014b388e0fd..afecd7bd7d828 100644 --- a/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts +++ b/x-pack/plugins/fleet/server/routes/enrollment_api_key/handler.ts @@ -60,9 +60,9 @@ export const postEnrollmentApiKeyHandler: RequestHandler< } }; -export const deleteEnrollmentApiKeyHandler: RequestHandler> = async (context, request, response) => { +export const deleteEnrollmentApiKeyHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; try { await APIKeyService.deleteEnrollmentApiKey(soClient, request.params.keyId); @@ -80,9 +80,9 @@ export const deleteEnrollmentApiKeyHandler: RequestHandler> = async (context, request, response) => { +export const getOneEnrollmentApiKeyHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; try { const apiKey = await APIKeyService.getEnrollmentAPIKey(soClient, request.params.keyId); diff --git a/x-pack/plugins/fleet/server/routes/epm/handlers.ts b/x-pack/plugins/fleet/server/routes/epm/handlers.ts index 1d221b8b1eead..c513f47cabe9f 100644 --- a/x-pack/plugins/fleet/server/routes/epm/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/epm/handlers.ts @@ -240,9 +240,9 @@ export const installPackageByUploadHandler: RequestHandler< } }; -export const deletePackageHandler: RequestHandler> = async (context, request, response) => { +export const deletePackageHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { try { const { pkgkey } = request.params; const savedObjectsClient = context.core.savedObjects.client; diff --git a/x-pack/plugins/fleet/server/routes/output/handler.ts b/x-pack/plugins/fleet/server/routes/output/handler.ts index 9cdab757acc87..1c46915cac3fc 100644 --- a/x-pack/plugins/fleet/server/routes/output/handler.ts +++ b/x-pack/plugins/fleet/server/routes/output/handler.ts @@ -29,9 +29,9 @@ export const getOutputsHandler: RequestHandler = async (context, request, respon } }; -export const getOneOuputHandler: RequestHandler> = async (context, request, response) => { +export const getOneOuputHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; try { const output = await outputService.get(soClient, request.params.outputId); diff --git a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts index 3a2b9ba7a744f..b154aa2a2782f 100644 --- a/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/package_policy/handlers.ts @@ -41,9 +41,9 @@ export const getPackagePoliciesHandler: RequestHandler< } }; -export const getOnePackagePolicyHandler: RequestHandler> = async (context, request, response) => { +export const getOnePackagePolicyHandler: RequestHandler< + TypeOf +> = async (context, request, response) => { const soClient = context.core.savedObjects.client; const { packagePolicyId } = request.params; const notFoundResponse = () => diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts index 0472fd67c6cf0..3ba158df309f8 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/transform/transform.test.ts @@ -297,9 +297,9 @@ describe('test transform install', () => { (getInstallationObject as jest.MockedFunction< typeof getInstallationObject >).mockReturnValueOnce( - Promise.resolve(({ attributes: { installed_es: [] } } as unknown) as SavedObject< - Installation - >) + Promise.resolve(({ + attributes: { installed_es: [] }, + } as unknown) as SavedObject) ); legacyScopedClusterClient.callAsCurrentUser = jest.fn(); await installTransform( diff --git a/x-pack/plugins/global_search/server/routes/integration_tests/find.test.ts b/x-pack/plugins/global_search/server/routes/integration_tests/find.test.ts index 01bd68ca38b12..ed28786782c35 100644 --- a/x-pack/plugins/global_search/server/routes/integration_tests/find.test.ts +++ b/x-pack/plugins/global_search/server/routes/integration_tests/find.test.ts @@ -33,7 +33,9 @@ const expectedResults = (...ids: string[]) => ids.map((id) => expect.objectConta describe('POST /internal/global_search/find', () => { let server: SetupServerReturn['server']; let httpSetup: SetupServerReturn['httpSetup']; - let globalSearchHandlerContext: ReturnType; + let globalSearchHandlerContext: ReturnType< + typeof globalSearchPluginMock.createRouteHandlerContext + >; beforeEach(async () => { ({ server, httpSetup } = await setupServer(pluginId)); diff --git a/x-pack/plugins/global_search_providers/public/providers/application.test.ts b/x-pack/plugins/global_search_providers/public/providers/application.test.ts index 385ce91d8f981..8acbda5e0a6d4 100644 --- a/x-pack/plugins/global_search_providers/public/providers/application.test.ts +++ b/x-pack/plugins/global_search_providers/public/providers/application.test.ts @@ -173,9 +173,9 @@ describe('applicationResultProvider', () => { // test scheduler doesnt play well with promises. need to workaround by passing // an observable instead. Behavior with promise is asserted in previous tests of the suite - const applicationPromise = (hot('a', { a: application }) as unknown) as Promise< - ApplicationStart - >; + const applicationPromise = (hot('a', { + a: application, + }) as unknown) as Promise; const provider = createApplicationResultProvider(applicationPromise); @@ -198,9 +198,9 @@ describe('applicationResultProvider', () => { // test scheduler doesnt play well with promises. need to workaround by passing // an observable instead. Behavior with promise is asserted in previous tests of the suite - const applicationPromise = (hot('a', { a: application }) as unknown) as Promise< - ApplicationStart - >; + const applicationPromise = (hot('a', { + a: application, + }) as unknown) as Promise; const provider = createApplicationResultProvider(applicationPromise); diff --git a/x-pack/plugins/graph/public/components/settings/settings.test.tsx b/x-pack/plugins/graph/public/components/settings/settings.test.tsx index 135b9744765c6..9b9a964bdf71a 100644 --- a/x-pack/plugins/graph/public/components/settings/settings.test.tsx +++ b/x-pack/plugins/graph/public/components/settings/settings.test.tsx @@ -164,9 +164,9 @@ describe('settings', () => { }); it('should set advanced settings', () => { - input('Sample size').prop('onChange')!({ target: { valueAsNumber: 13 } } as React.ChangeEvent< - HTMLInputElement - >); + input('Sample size').prop('onChange')!({ + target: { valueAsNumber: 13 }, + } as React.ChangeEvent); expect(dispatchSpy).toHaveBeenCalledWith( updateSettings( diff --git a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_list/component_template_list_container.tsx b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_list/component_template_list_container.tsx index d0636da8cf93a..1f25a53daf1ba 100644 --- a/x-pack/plugins/index_management/public/application/components/component_templates/component_template_list/component_template_list_container.tsx +++ b/x-pack/plugins/index_management/public/application/components/component_templates/component_template_list/component_template_list_container.tsx @@ -15,9 +15,9 @@ interface MatchParams { componentTemplateName?: string; } -export const ComponentTemplateListContainer: React.FunctionComponent> = ({ +export const ComponentTemplateListContainer: React.FunctionComponent< + RouteComponentProps +> = ({ match: { params: { componentTemplateName }, }, diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx index 5882496f6dc0a..af7b10abcfe38 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx @@ -46,9 +46,10 @@ interface Props { } export const MappingsEditor = React.memo(({ onChange, value, indexSettings }: Props) => { - const { parsedDefaultValue, multipleMappingsDeclared, mappingsType } = useMemo< - MappingsEditorParsedMetadata - >(() => { + const { + parsedDefaultValue, + multipleMappingsDeclared, + } = useMemo(() => { const mappingsDefinition = extractMappingsDefinition(value); if (mappingsDefinition === null) { diff --git a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_tooltip.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_tooltip.tsx index ccd207129e471..e76e03279f73f 100644 --- a/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_tooltip.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_tooltip.tsx @@ -11,10 +11,9 @@ import { missingMlSetupPrivilegesDescription, } from './missing_privileges_messages'; -export const MissingSetupPrivilegesToolTip: React.FC, - 'content' | 'title' ->> = (props) => ( +export const MissingSetupPrivilegesToolTip: React.FC< + Omit, 'content' | 'title'> +> = (props) => ( KibanaReactContextValue< - PluginKibanaContextValue ->; +export const useKibanaContextForPlugin = useKibana as () => KibanaReactContextValue; diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts index 0a12c433db60a..9f193d796e8e8 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts @@ -37,9 +37,10 @@ export const useLogEntryCategoriesResults = ({ }) => { const { services } = useKibanaContextForPlugin(); const [topLogEntryCategories, setTopLogEntryCategories] = useState([]); - const [logEntryCategoryDatasets, setLogEntryCategoryDatasets] = useState< - LogEntryCategoryDatasets - >([]); + const [ + logEntryCategoryDatasets, + setLogEntryCategoryDatasets, + ] = useState([]); const [getTopLogEntryCategoriesRequest, getTopLogEntryCategories] = useTrackedPromise( { diff --git a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts index e626e7477f2c0..396c1ad3e1857 100644 --- a/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_anomalies_results.ts @@ -284,9 +284,10 @@ export const useLogEntryAnomaliesResults = ({ ); // Anomalies datasets - const [logEntryAnomaliesDatasets, setLogEntryAnomaliesDatasets] = useState< - LogEntryAnomaliesDatasets - >([]); + const [ + logEntryAnomaliesDatasets, + setLogEntryAnomaliesDatasets, + ] = useState([]); const [getLogEntryAnomaliesDatasetsRequest, getLogEntryAnomaliesDatasets] = useTrackedPromise( { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/expression_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/expression_helpers.ts index e7568147dc568..f1451c0bb3006 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/expression_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/expression_helpers.ts @@ -35,10 +35,9 @@ export function prependDatasourceExpression( if (datasourceExpressions.length === 0 || visualizationExpression === null) { return null; } - const parsedDatasourceExpressions: Array<[ - string, - Ast - ]> = datasourceExpressions.map(([layerId, expr]) => [ + const parsedDatasourceExpressions: Array< + [string, Ast] + > = datasourceExpressions.map(([layerId, expr]) => [ layerId, typeof expr === 'string' ? fromExpression(expr) : expr, ]); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx index 94018bd84b517..2444a6a81c2a0 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.tsx @@ -18,15 +18,11 @@ import { DimensionEditor } from './dimension_editor'; import { DateRange } from '../../../common'; import { getOperationSupportMatrix } from './operation_support'; -export type IndexPatternDimensionTriggerProps = DatasourceDimensionTriggerProps< - IndexPatternPrivateState -> & { +export type IndexPatternDimensionTriggerProps = DatasourceDimensionTriggerProps & { uniqueLabel: string; }; -export type IndexPatternDimensionEditorProps = DatasourceDimensionEditorProps< - IndexPatternPrivateState -> & { +export type IndexPatternDimensionEditorProps = DatasourceDimensionEditorProps & { uiSettings: IUiSettingsClient; storage: IStorageWrapper; savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/lens/server/migrations.ts b/x-pack/plugins/lens/server/migrations.ts index 3ec3abdfd6260..670a66d87e6d5 100644 --- a/x-pack/plugins/lens/server/migrations.ts +++ b/x-pack/plugins/lens/server/migrations.ts @@ -218,18 +218,18 @@ const removeInvalidAccessors: SavedObjectMigrationFn< if (newDoc.attributes.visualizationType === 'lnsXY') { const datasourceLayers = newDoc.attributes.state.datasourceStates.indexpattern.layers || {}; const xyState = newDoc.attributes.state.visualization; - (newDoc.attributes as LensDocShapePre710< - XYStatePost77 - >).state.visualization.layers = xyState.layers.map((layer: XYLayerPre77) => { - const layerId = layer.layerId; - const datasource = datasourceLayers[layerId]; - return { - ...layer, - xAccessor: datasource?.columns[layer.xAccessor] ? layer.xAccessor : undefined, - splitAccessor: datasource?.columns[layer.splitAccessor] ? layer.splitAccessor : undefined, - accessors: layer.accessors.filter((accessor) => !!datasource?.columns[accessor]), - }; - }); + (newDoc.attributes as LensDocShapePre710).state.visualization.layers = xyState.layers.map( + (layer: XYLayerPre77) => { + const layerId = layer.layerId; + const datasource = datasourceLayers[layerId]; + return { + ...layer, + xAccessor: datasource?.columns[layer.xAccessor] ? layer.xAccessor : undefined, + splitAccessor: datasource?.columns[layer.splitAccessor] ? layer.splitAccessor : undefined, + accessors: layer.accessors.filter((accessor) => !!datasource?.columns[accessor]), + }; + } + ); } return newDoc; }; diff --git a/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.mock.ts b/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.mock.ts index c2a751c03ee13..451bbaecca7e1 100644 --- a/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/response/exception_list_item_schema.mock.ts @@ -47,9 +47,7 @@ export const getExceptionListItemSchemaMock = (): ExceptionListItemSchema => ({ * This is useful for end to end tests where we remove the auto generated parts for comparisons * such as created_at, updated_at, and id. */ -export const getExceptionListItemResponseMockWithoutAutoGeneratedValues = (): Partial< - ExceptionListItemSchema -> => ({ +export const getExceptionListItemResponseMockWithoutAutoGeneratedValues = (): Partial => ({ comments: [], created_by: ELASTIC_USER, description: DESCRIPTION, diff --git a/x-pack/plugins/lists/common/schemas/response/exception_list_schema.mock.ts b/x-pack/plugins/lists/common/schemas/response/exception_list_schema.mock.ts index 7371a9d16fd4d..495f88b880620 100644 --- a/x-pack/plugins/lists/common/schemas/response/exception_list_schema.mock.ts +++ b/x-pack/plugins/lists/common/schemas/response/exception_list_schema.mock.ts @@ -60,9 +60,7 @@ export const getTrustedAppsListSchemaMock = (): ExceptionListSchema => { * This is useful for end to end tests where we remove the auto generated parts for comparisons * such as created_at, updated_at, and id. */ -export const getExceptionResponseMockWithoutAutoGeneratedValues = (): Partial< - ExceptionListSchema -> => ({ +export const getExceptionResponseMockWithoutAutoGeneratedValues = (): Partial => ({ created_by: ELASTIC_USER, description: DESCRIPTION, immutable: IMMUTABLE, diff --git a/x-pack/plugins/lists/public/lists/api.ts b/x-pack/plugins/lists/public/lists/api.ts index 2b123280474df..8d4b419190bb6 100644 --- a/x-pack/plugins/lists/public/lists/api.ts +++ b/x-pack/plugins/lists/public/lists/api.ts @@ -87,9 +87,9 @@ const importList = async ({ list_id, type, signal, -}: ApiParams & ImportListItemSchemaEncoded & ImportListItemQuerySchemaEncoded): Promise< - ListSchema -> => { +}: ApiParams & + ImportListItemSchemaEncoded & + ImportListItemQuerySchemaEncoded): Promise => { const formData = new FormData(); formData.append('file', file as Blob); diff --git a/x-pack/plugins/maps/public/classes/styles/vector/components/symbol/icon_map_select.test.tsx b/x-pack/plugins/maps/public/classes/styles/vector/components/symbol/icon_map_select.test.tsx index 4d9579e9e4c00..72e8b3494da24 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/components/symbol/icon_map_select.test.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/components/symbol/icon_map_select.test.tsx @@ -47,9 +47,7 @@ class MockDynamicStyleProperty { const defaultProps = { iconPaletteId: 'filledShapes', onChange: () => {}, - styleProperty: (new MockDynamicStyleProperty() as unknown) as IDynamicStyleProperty< - IconDynamicOptions - >, + styleProperty: (new MockDynamicStyleProperty() as unknown) as IDynamicStyleProperty, isCustomOnly: false, }; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx index 310cd4e3b3a79..6039b29289d48 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/supported_fields_message.tsx @@ -65,9 +65,10 @@ interface Props { } export const SupportedFieldsMessage: FC = ({ jobType }) => { - const [sourceIndexContainsSupportedFields, setSourceIndexContainsSupportedFields] = useState< - boolean - >(true); + const [ + sourceIndexContainsSupportedFields, + setSourceIndexContainsSupportedFields, + ] = useState(true); const [sourceIndexFieldsCheckFailed, setSourceIndexFieldsCheckFailed] = useState(false); const { fields } = newJobCapsService; diff --git a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.test.tsx b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.test.tsx index 12813ad6277aa..83c2d86afca8b 100644 --- a/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.test.tsx +++ b/x-pack/plugins/ml/public/embeddables/anomaly_swimlane/anomaly_swimlane_embeddable_factory.test.tsx @@ -33,9 +33,8 @@ describe('AnomalySwimlaneEmbeddableFactory', () => { } as AnomalySwimlaneEmbeddableInput); // assert - const mockCalls = ((AnomalySwimlaneEmbeddable as unknown) as jest.Mock< - AnomalySwimlaneEmbeddable - >).mock.calls[0]; + const mockCalls = ((AnomalySwimlaneEmbeddable as unknown) as jest.Mock) + .mock.calls[0]; const input = mockCalls[0]; const createServices = mockCalls[1]; diff --git a/x-pack/plugins/monitoring/public/angular/app_modules.ts b/x-pack/plugins/monitoring/public/angular/app_modules.ts index 4ef905fd35fc4..7ceb7b4945529 100644 --- a/x-pack/plugins/monitoring/public/angular/app_modules.ts +++ b/x-pack/plugins/monitoring/public/angular/app_modules.ts @@ -99,28 +99,31 @@ function createLocalStateModule( ) { angular .module('monitoring/State', ['monitoring/Private']) - .service('globalState', function ( - Private: IPrivate, - $rootScope: ng.IRootScopeService, - $location: ng.ILocationService - ) { - function GlobalStateProvider(this: any) { - const state = new GlobalState(query, toasts, $rootScope, $location, this); - const initialState: any = state.getState(); - for (const key in initialState) { - if (!initialState.hasOwnProperty(key)) { - continue; + .service( + 'globalState', + function ( + Private: IPrivate, + $rootScope: ng.IRootScopeService, + $location: ng.ILocationService + ) { + function GlobalStateProvider(this: any) { + const state = new GlobalState(query, toasts, $rootScope, $location, this); + const initialState: any = state.getState(); + for (const key in initialState) { + if (!initialState.hasOwnProperty(key)) { + continue; + } + this[key] = initialState[key]; } - this[key] = initialState[key]; + this.save = () => { + const newState = { ...this }; + delete newState.save; + state.setState(newState); + }; } - this.save = () => { - const newState = { ...this }; - delete newState.save; - state.setState(newState); - }; + return Private(GlobalStateProvider); } - return Private(GlobalStateProvider); - }); + ); } function createMonitoringAppServices() { diff --git a/x-pack/plugins/reporting/server/export_types/csv/create_job.ts b/x-pack/plugins/reporting/server/export_types/csv/create_job.ts index 43243d265e926..f0f72a0bc9965 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/create_job.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/create_job.ts @@ -9,10 +9,9 @@ import { cryptoFactory } from '../../lib'; import { CreateJobFn, CreateJobFnFactory } from '../../types'; import { IndexPatternSavedObject, JobParamsCSV, TaskPayloadCSV } from './types'; -export const createJobFnFactory: CreateJobFnFactory> = function createJobFactoryFn(reporting, parentLogger) { +export const createJobFnFactory: CreateJobFnFactory< + CreateJobFn +> = function createJobFactoryFn(reporting, parentLogger) { const logger = parentLogger.clone([CSV_JOB_TYPE, 'create-job']); const config = reporting.getConfig(); diff --git a/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts b/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts index 2c9ddea598eb4..6b4dd48583efe 100644 --- a/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts +++ b/x-pack/plugins/reporting/server/export_types/csv/execute_job.ts @@ -10,9 +10,9 @@ import { decryptJobHeaders } from '../common'; import { createGenerateCsv } from './generate_csv'; import { TaskPayloadCSV } from './types'; -export const runTaskFnFactory: RunTaskFnFactory> = function executeJobFactoryFn(reporting, parentLogger) { +export const runTaskFnFactory: RunTaskFnFactory< + RunTaskFn +> = function executeJobFactoryFn(reporting, parentLogger) { const config = reporting.getConfig(); return async function runTask(jobId, job, cancellationToken) { diff --git a/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts b/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts index 010b6f431db7e..56ebcec2adf18 100644 --- a/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts @@ -10,10 +10,9 @@ import { CreateJobFn, CreateJobFnFactory } from '../../../types'; import { validateUrls } from '../../common'; import { JobParamsPNG, TaskPayloadPNG } from '../types'; -export const createJobFnFactory: CreateJobFnFactory> = function createJobFactoryFn(reporting, parentLogger) { +export const createJobFnFactory: CreateJobFnFactory< + CreateJobFn +> = function createJobFactoryFn(reporting, parentLogger) { const logger = parentLogger.clone([PNG_JOB_TYPE, 'execute-job']); const config = reporting.getConfig(); const crypto = cryptoFactory(config.get('encryptionKey')); diff --git a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts index e6b36643900dd..2464b0f068736 100644 --- a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts @@ -19,9 +19,9 @@ import { import { generatePngObservableFactory } from '../lib/generate_png'; import { TaskPayloadPNG } from '../types'; -export const runTaskFnFactory: RunTaskFnFactory> = function executeJobFactoryFn(reporting, parentLogger) { +export const runTaskFnFactory: RunTaskFnFactory< + RunTaskFn +> = function executeJobFactoryFn(reporting, parentLogger) { const config = reporting.getConfig(); const encryptionKey = config.get('encryptionKey'); const logger = parentLogger.clone([PNG_JOB_TYPE, 'execute']); diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts index cc3c8b3b257dd..5dfc3018182c9 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts @@ -13,10 +13,9 @@ import { JobParamsPDF, TaskPayloadPDF } from '../types'; // @ts-ignore no module def (deprecated module) import { compatibilityShimFactory } from './compatibility_shim'; -export const createJobFnFactory: CreateJobFnFactory> = function createJobFactoryFn(reporting, parentLogger) { +export const createJobFnFactory: CreateJobFnFactory< + CreateJobFn +> = function createJobFactoryFn(reporting, parentLogger) { const config = reporting.getConfig(); const crypto = cryptoFactory(config.get('encryptionKey')); const logger = parentLogger.clone([PDF_JOB_TYPE, 'create-job']); diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts index 95716b8eab10f..43aa873292080 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts @@ -20,9 +20,9 @@ import { generatePdfObservableFactory } from '../lib/generate_pdf'; import { getCustomLogo } from '../lib/get_custom_logo'; import { TaskPayloadPDF } from '../types'; -export const runTaskFnFactory: RunTaskFnFactory> = function executeJobFactoryFn(reporting, parentLogger) { +export const runTaskFnFactory: RunTaskFnFactory< + RunTaskFn +> = function executeJobFactoryFn(reporting, parentLogger) { const config = reporting.getConfig(); const encryptionKey = config.get('encryptionKey'); diff --git a/x-pack/plugins/runtime_fields/public/load_editor.tsx b/x-pack/plugins/runtime_fields/public/load_editor.tsx index f1b9c495f0336..da2819411732b 100644 --- a/x-pack/plugins/runtime_fields/public/load_editor.tsx +++ b/x-pack/plugins/runtime_fields/public/load_editor.tsx @@ -14,9 +14,9 @@ export interface OpenRuntimeFieldEditorProps { defaultValue?: RuntimeField; } -export const getRuntimeFieldEditorLoader = (coreSetup: CoreSetup) => async (): Promise< - LoadEditorResponse -> => { +export const getRuntimeFieldEditorLoader = ( + coreSetup: CoreSetup +) => async (): Promise => { const { RuntimeFieldEditorFlyoutContent } = await import('./components'); const [core] = await coreSetup.getStartServices(); const { uiSettings, overlays, docLinks } = core; diff --git a/x-pack/plugins/saved_objects_tagging/public/plugin.test.ts b/x-pack/plugins/saved_objects_tagging/public/plugin.test.ts index 16dac75455710..cd14d70facf9b 100644 --- a/x-pack/plugins/saved_objects_tagging/public/plugin.test.ts +++ b/x-pack/plugins/saved_objects_tagging/public/plugin.test.ts @@ -20,7 +20,9 @@ const MockedTagsCache = (TagsCache as unknown) as jest.Mock { let plugin: SavedObjectTaggingPlugin; let managementPluginSetup: ReturnType; - let savedObjectsTaggingOssPluginSetup: ReturnType; + let savedObjectsTaggingOssPluginSetup: ReturnType< + typeof savedObjectTaggingOssPluginMock.createSetup + >; beforeEach(() => { const rawConfig: SavedObjectsTaggingClientConfigRawType = { diff --git a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts index 09e1c0403a403..0bac5b145003e 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts +++ b/x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/__fixtures__/index.ts @@ -37,16 +37,16 @@ export function getDisplayedFeaturePrivileges(wrapper: ReactWrapper) { const subFeatureForm = featureControls.find(SubFeatureForm); if (subFeatureForm.length > 0) { - const independentPrivileges = (subFeatureForm.find(EuiCheckbox) as ReactWrapper< - EuiCheckboxProps - >).reduce((acc2, checkbox) => { + const independentPrivileges = (subFeatureForm.find( + EuiCheckbox + ) as ReactWrapper).reduce((acc2, checkbox) => { const { id: privilegeId, checked } = checkbox.props(); return checked ? [...acc2, privilegeId] : acc2; }, [] as string[]); - const mutuallyExclusivePrivileges = (subFeatureForm.find(EuiButtonGroup) as ReactWrapper< - EuiButtonGroupProps - >).reduce((acc2, subPrivButtonGroup) => { + const mutuallyExclusivePrivileges = (subFeatureForm.find( + EuiButtonGroup + ) as ReactWrapper).reduce((acc2, subPrivButtonGroup) => { const { idSelected: selectedSubPrivilege } = subPrivButtonGroup.props(); return selectedSubPrivilege && selectedSubPrivilege !== 'none' ? [...acc2, selectedSubPrivilege] diff --git a/x-pack/plugins/security/public/plugin.test.tsx b/x-pack/plugins/security/public/plugin.test.tsx index d16662922f696..12491e934beae 100644 --- a/x-pack/plugins/security/public/plugin.test.tsx +++ b/x-pack/plugins/security/public/plugin.test.tsx @@ -31,9 +31,9 @@ describe('Security Plugin', () => { const plugin = new SecurityPlugin(coreMock.createPluginInitializerContext()); expect( plugin.setup( - coreMock.createSetup({ basePath: '/some-base-path' }) as CoreSetup< - PluginStartDependencies - >, + coreMock.createSetup({ + basePath: '/some-base-path', + }) as CoreSetup, { licensing: licensingMock.createSetup(), securityOss: mockSecurityOssPlugin.createSetup(), diff --git a/x-pack/plugins/security_solution/common/endpoint/types/index.ts b/x-pack/plugins/security_solution/common/endpoint/types/index.ts index f873a701eb9bd..e7d060b463aba 100644 --- a/x-pack/plugins/security_solution/common/endpoint/types/index.ts +++ b/x-pack/plugins/security_solution/common/endpoint/types/index.ts @@ -841,9 +841,7 @@ export type ResolverEntityIndex = Array<{ entity_id: string }>; * `Type` types, we process the result of `TypeOf` instead, as this will be consistent. */ export type KbnConfigSchemaInputTypeOf = T extends Record - ? KbnConfigSchemaInputObjectTypeOf< - T - > /** `schema.number()` accepts strings, so this type should accept them as well. */ + ? KbnConfigSchemaInputObjectTypeOf /** `schema.number()` accepts strings, so this type should accept them as well. */ : number extends T ? T | string : T; diff --git a/x-pack/plugins/security_solution/cypress/support/commands.js b/x-pack/plugins/security_solution/cypress/support/commands.js index bb32461a6bca2..c249e0a77690c 100644 --- a/x-pack/plugins/security_solution/cypress/support/commands.js +++ b/x-pack/plugins/security_solution/cypress/support/commands.js @@ -39,17 +39,17 @@ Cypress.Commands.add('stubSecurityApi', function (dataFileName) { cy.route('POST', 'api/solutions/security/graphql', `@${dataFileName}JSON`); }); -Cypress.Commands.add('stubSearchStrategyApi', function ( - dataFileName, - searchStrategyName = 'securitySolutionSearchStrategy' -) { - cy.on('window:before:load', (win) => { - win.fetch = null; - }); - cy.server(); - cy.fixture(dataFileName).as(`${dataFileName}JSON`); - cy.route('POST', `internal/search/${searchStrategyName}`, `@${dataFileName}JSON`); -}); +Cypress.Commands.add( + 'stubSearchStrategyApi', + function (dataFileName, searchStrategyName = 'securitySolutionSearchStrategy') { + cy.on('window:before:load', (win) => { + win.fetch = null; + }); + cy.server(); + cy.fixture(dataFileName).as(`${dataFileName}JSON`); + cy.route('POST', `internal/search/${searchStrategyName}`, `@${dataFileName}JSON`); + } +); Cypress.Commands.add( 'attachFile', diff --git a/x-pack/plugins/security_solution/public/cases/components/settings/resilient/fields.tsx b/x-pack/plugins/security_solution/public/cases/components/settings/resilient/fields.tsx index f3aa48c765d3c..0791219ef95f9 100644 --- a/x-pack/plugins/security_solution/public/cases/components/settings/resilient/fields.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/settings/resilient/fields.tsx @@ -24,9 +24,9 @@ import * as i18n from './translations'; import { ConnectorTypes, ResilientFieldsType } from '../../../../../../case/common/api/connectors'; import { ConnectorCard } from '../card'; -const ResilientSettingFieldsComponent: React.FunctionComponent> = ({ isEdit = true, fields, connector, onChange }) => { +const ResilientSettingFieldsComponent: React.FunctionComponent< + SettingFieldsProps +> = ({ isEdit = true, fields, connector, onChange }) => { const { incidentTypes = null, severityCode = null } = fields ?? {}; const { http, notifications } = useKibana().services; diff --git a/x-pack/plugins/security_solution/public/cases/components/settings/servicenow/fields.tsx b/x-pack/plugins/security_solution/public/cases/components/settings/servicenow/fields.tsx index 8b2e24628a760..e5f9170f1fe39 100644 --- a/x-pack/plugins/security_solution/public/cases/components/settings/servicenow/fields.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/settings/servicenow/fields.tsx @@ -27,9 +27,9 @@ const selectOptions = [ }, ]; -const ServiceNowSettingFieldsComponent: React.FunctionComponent> = ({ isEdit = true, fields, connector, onChange }) => { +const ServiceNowSettingFieldsComponent: React.FunctionComponent< + SettingFieldsProps +> = ({ isEdit = true, fields, connector, onChange }) => { const { severity = null, urgency = null, impact = null } = fields ?? {}; const listItems = useMemo( diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx index 2a778cd6585a1..087155ee5227e 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.test.tsx @@ -43,12 +43,12 @@ jest.mock('../../../../detections/containers/detection_engine/rules/use_rule_asy describe('When the add exception modal is opened', () => { const ruleName = 'test rule'; - let defaultEndpointItems: jest.SpyInstance>; - let ExceptionBuilderComponent: jest.SpyInstance>; + let defaultEndpointItems: jest.SpyInstance< + ReturnType + >; + let ExceptionBuilderComponent: jest.SpyInstance< + ReturnType + >; beforeEach(() => { defaultEndpointItems = jest.spyOn(helpers, 'defaultEndpointExceptionItems'); ExceptionBuilderComponent = jest diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx index 9d017b7f1891e..6beb941535b90 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/index.test.tsx @@ -40,9 +40,9 @@ jest.mock('../../../../detections/containers/detection_engine/rules/use_rule_asy describe('When the edit exception modal is opened', () => { const ruleName = 'test rule'; - let ExceptionBuilderComponent: jest.SpyInstance>; + let ExceptionBuilderComponent: jest.SpyInstance< + ReturnType + >; beforeEach(() => { ExceptionBuilderComponent = jest diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/use_add_exception.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/use_add_exception.test.tsx index 3de949a05c881..5fe8e1fb48d1a 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/use_add_exception.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/use_add_exception.test.tsx @@ -37,16 +37,16 @@ mockKibanaServices.mockReturnValue({ http: { fetch: fetchMock } }); describe('useAddOrUpdateException', () => { let updateAlertStatus: jest.SpyInstance>; let addExceptionListItem: jest.SpyInstance>; - let updateExceptionListItem: jest.SpyInstance>; + let updateExceptionListItem: jest.SpyInstance< + ReturnType + >; let getQueryFilter: jest.SpyInstance>; - let buildAlertStatusFilter: jest.SpyInstance>; - let buildAlertsRuleIdFilter: jest.SpyInstance>; + let buildAlertStatusFilter: jest.SpyInstance< + ReturnType + >; + let buildAlertsRuleIdFilter: jest.SpyInstance< + ReturnType + >; let addOrUpdateItemsArgs: Parameters; let render: () => RenderHookResult; const onError = jest.fn(); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.test.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.test.tsx index f20a58b9ffa36..9d2130069644c 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/use_fetch_or_create_rule_exception_list.test.tsx @@ -27,9 +27,9 @@ describe('useFetchOrCreateRuleExceptionList', () => { let fetchRuleById: jest.SpyInstance>; let patchRule: jest.SpyInstance>; let addExceptionList: jest.SpyInstance>; - let addEndpointExceptionList: jest.SpyInstance>; + let addEndpointExceptionList: jest.SpyInstance< + ReturnType + >; let fetchExceptionListById: jest.SpyInstance>; let render: ( listType?: UseFetchOrCreateRuleExceptionListProps['exceptionListType'] diff --git a/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts b/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts index 6f04226fa3a19..272d40a8cea2b 100644 --- a/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts +++ b/x-pack/plugins/security_solution/public/common/components/url_state/test_dependencies.ts @@ -278,15 +278,9 @@ export const getMockPropsObj = ({ // silly that this needs to be an array and not an object // https://jestjs.io/docs/en/api#testeachtable-name-fn-timeout -export const testCases: Array<[ - LocationTypes, - string, - string, - string, - string | null, - string, - undefined | string -]> = [ +export const testCases: Array< + [LocationTypes, string, string, string, string | null, string, undefined | string] +> = [ [ /* page */ CONSTANTS.networkPage, /* namespaceLower */ 'network', diff --git a/x-pack/plugins/security_solution/public/common/containers/events/last_event_time/index.ts b/x-pack/plugins/security_solution/public/common/containers/events/last_event_time/index.ts index b6938bc18a88d..5eec8cbbeb81f 100644 --- a/x-pack/plugins/security_solution/public/common/containers/events/last_event_time/index.ts +++ b/x-pack/plugins/security_solution/public/common/containers/events/last_event_time/index.ts @@ -48,9 +48,10 @@ export const useTimelineLastEventTime = ({ const refetch = useRef(noop); const abortCtrl = useRef(new AbortController()); const [loading, setLoading] = useState(false); - const [TimelineLastEventTimeRequest, setTimelineLastEventTimeRequest] = useState< - TimelineEventsLastEventTimeRequestOptions - >({ + const [ + TimelineLastEventTimeRequest, + setTimelineLastEventTimeRequest, + ] = useState({ defaultIndex: indexNames, docValueFields, factoryQueryType: TimelineEventsQueries.lastEventTime, @@ -58,9 +59,10 @@ export const useTimelineLastEventTime = ({ details, }); - const [timelineLastEventTimeResponse, setTimelineLastEventTimeResponse] = useState< - UseTimelineLastEventTimeArgs - >({ + const [ + timelineLastEventTimeResponse, + setTimelineLastEventTimeResponse, + ] = useState({ lastSeen: null, refetch: refetch.current, errorMessage: undefined, diff --git a/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.ts b/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.ts index a2cf59314d149..3ef6d78d651aa 100644 --- a/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.ts +++ b/x-pack/plugins/security_solution/public/common/containers/matrix_histogram/index.ts @@ -61,9 +61,10 @@ export const useMatrixHistogram = ({ const refetch = useRef(noop); const abortCtrl = useRef(new AbortController()); const [loading, setLoading] = useState(false); - const [matrixHistogramRequest, setMatrixHistogramRequest] = useState< - MatrixHistogramRequestOptions - >({ + const [ + matrixHistogramRequest, + setMatrixHistogramRequest, + ] = useState({ defaultIndex: indexNames, factoryQueryType: MatrixHistogramQuery, filterQuery: createFilter(filterQuery), diff --git a/x-pack/plugins/security_solution/public/hosts/containers/hosts/first_last_seen/index.tsx b/x-pack/plugins/security_solution/public/hosts/containers/hosts/first_last_seen/index.tsx index 1cb13da2048ad..7045ebb4c1838 100644 --- a/x-pack/plugins/security_solution/public/hosts/containers/hosts/first_last_seen/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/containers/hosts/first_last_seen/index.tsx @@ -44,9 +44,10 @@ export const useFirstLastSeenHost = ({ const { data, notifications } = useKibana().services; const abortCtrl = useRef(new AbortController()); const [loading, setLoading] = useState(false); - const [firstLastSeenHostRequest, setFirstLastSeenHostRequest] = useState< - HostFirstLastSeenRequestOptions - >({ + const [ + firstLastSeenHostRequest, + setFirstLastSeenHostRequest, + ] = useState({ defaultIndex: indexNames, docValueFields: docValueFields ?? [], factoryQueryType: HostsQueries.firstLastSeen, diff --git a/x-pack/plugins/security_solution/public/hosts/containers/kpi_hosts/authentications/index.tsx b/x-pack/plugins/security_solution/public/hosts/containers/kpi_hosts/authentications/index.tsx index 281f8489fce0f..3564b9f4516d9 100644 --- a/x-pack/plugins/security_solution/public/hosts/containers/kpi_hosts/authentications/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/containers/kpi_hosts/authentications/index.tsx @@ -70,9 +70,10 @@ export const useHostsKpiAuthentications = ({ : null ); - const [hostsKpiAuthenticationsResponse, setHostsKpiAuthenticationsResponse] = useState< - HostsKpiAuthenticationsArgs - >({ + const [ + hostsKpiAuthenticationsResponse, + setHostsKpiAuthenticationsResponse, + ] = useState({ authenticationsSuccess: 0, authenticationsSuccessHistogram: [], authenticationsFailure: 0, diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx index dbb242845626e..02d41e7dea1a7 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/endpoint_details.tsx @@ -105,22 +105,23 @@ export const EndpointDetails = memo( const agentDetailsWithFlyoutPath = `${agentDetailsAppPath}${openReassignFlyoutSearch}`; const agentDetailsWithFlyoutUrl = `${agentDetailsUrl}${openReassignFlyoutSearch}`; - const handleReassignEndpointsClick = useNavigateToAppEventHandler< - AgentDetailsReassignPolicyAction - >(ingestAppId, { - path: agentDetailsWithFlyoutPath, - state: { - onDoneNavigateTo: [ - 'securitySolution:administration', - { - path: getEndpointDetailsPath({ - name: 'endpointDetails', - selected_endpoint: details.agent.id, - }), - }, - ], - }, - }); + const handleReassignEndpointsClick = useNavigateToAppEventHandler( + ingestAppId, + { + path: agentDetailsWithFlyoutPath, + state: { + onDoneNavigateTo: [ + 'securitySolution:administration', + { + path: getEndpointDetailsPath({ + name: 'endpointDetails', + selected_endpoint: details.agent.id, + }), + }, + ], + }, + } + ); const policyStatusClickHandler = useNavigateByRouterEventHandler(policyResponseRoutePath); diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx index 492b50af3dbd7..a759c9de41415 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/index.tsx @@ -219,17 +219,18 @@ export const EndpointList = () => { const NOOP = useCallback(() => {}, []); - const handleDeployEndpointsClick = useNavigateToAppEventHandler< - AgentPolicyDetailsDeployAgentAction - >('fleet', { - path: `#/policies/${selectedPolicyId}?openEnrollmentFlyout=true`, - state: { - onDoneNavigateTo: [ - 'securitySolution:administration', - { path: getEndpointListPath({ name: 'endpointList' }) }, - ], - }, - }); + const handleDeployEndpointsClick = useNavigateToAppEventHandler( + 'fleet', + { + path: `#/policies/${selectedPolicyId}?openEnrollmentFlyout=true`, + state: { + onDoneNavigateTo: [ + 'securitySolution:administration', + { path: getEndpointListPath({ name: 'endpointList' }) }, + ], + }, + } + ); const selectionOptions = useMemo(() => { return policyItems.map((item) => { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/events/windows.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/events/windows.tsx index f7b1a8e901ed2..cd2ef62c1cb84 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/events/windows.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/events/windows.tsx @@ -25,11 +25,13 @@ export const WindowsEvents = React.memo(() => { const total = usePolicyDetailsSelector(totalWindowsEvents); const checkboxes = useMemo(() => { - const items: Immutable> = [ + const items: Immutable< + Array<{ + name: string; + os: 'windows'; + protectionField: keyof UIPolicyConfig['windows']['events']; + }> + > = [ { name: i18n.translate( 'xpack.securitySolution.endpoint.policyDetailsConfig.windows.events.dllDriverLoad', diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx index c72093552f551..c5724956bc21f 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx @@ -119,11 +119,13 @@ export const MalwareProtections = React.memo(() => { policyDetailsConfig && policyDetailsConfig.windows.popup.malware.message; const isPlatinumPlus = useLicense().isPlatinumPlus(); - const radios: Immutable> = useMemo(() => { + const radios: Immutable< + Array<{ + id: ProtectionModes; + label: string; + protection: 'malware'; + }> + > = useMemo(() => { return [ { id: ProtectionModes.detect, diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/action.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/action.ts index 5315087c09655..75b06fb9b8432 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/action.ts +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/store/action.ts @@ -26,9 +26,7 @@ export type TrustedAppsListResourceStateChanged = ResourceStateChanged< TrustedAppsListData >; -export type TrustedAppDeletionSubmissionResourceStateChanged = ResourceStateChanged< - 'trustedAppDeletionSubmissionResourceStateChanged' ->; +export type TrustedAppDeletionSubmissionResourceStateChanged = ResourceStateChanged<'trustedAppDeletionSubmissionResourceStateChanged'>; export type TrustedAppDeletionDialogStarted = Action<'trustedAppDeletionDialogStarted'> & { payload: { diff --git a/x-pack/plugins/security_solution/public/network/components/details/mock.ts b/x-pack/plugins/security_solution/public/network/components/details/mock.ts index b1187a9b22d94..7d5e8538939ea 100644 --- a/x-pack/plugins/security_solution/public/network/components/details/mock.ts +++ b/x-pack/plugins/security_solution/public/network/components/details/mock.ts @@ -6,10 +6,9 @@ import { NetworkDetailsStrategyResponse } from '../../../../common/search_strategy'; -export const mockData: Readonly> = { +export const mockData: Readonly< + Record +> = { complete: { source: { firstSeen: '2019-02-07T17:19:41.636Z', diff --git a/x-pack/plugins/security_solution/public/network/containers/kpi_network/network_events/index.tsx b/x-pack/plugins/security_solution/public/network/containers/kpi_network/network_events/index.tsx index 3a4ce40fb8b80..0cce484280906 100644 --- a/x-pack/plugins/security_solution/public/network/containers/kpi_network/network_events/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/kpi_network/network_events/index.tsx @@ -74,9 +74,10 @@ export const useNetworkKpiNetworkEvents = ({ : null ); - const [networkKpiNetworkEventsResponse, setNetworkKpiNetworkEventsResponse] = useState< - NetworkKpiNetworkEventsArgs - >({ + const [ + networkKpiNetworkEventsResponse, + setNetworkKpiNetworkEventsResponse, + ] = useState({ networkEvents: 0, id: ID, inspect: { diff --git a/x-pack/plugins/security_solution/public/network/containers/kpi_network/tls_handshakes/index.tsx b/x-pack/plugins/security_solution/public/network/containers/kpi_network/tls_handshakes/index.tsx index 40cd04207b2d9..565504ca3ef09 100644 --- a/x-pack/plugins/security_solution/public/network/containers/kpi_network/tls_handshakes/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/kpi_network/tls_handshakes/index.tsx @@ -74,9 +74,10 @@ export const useNetworkKpiTlsHandshakes = ({ : null ); - const [networkKpiTlsHandshakesResponse, setNetworkKpiTlsHandshakesResponse] = useState< - NetworkKpiTlsHandshakesArgs - >({ + const [ + networkKpiTlsHandshakesResponse, + setNetworkKpiTlsHandshakesResponse, + ] = useState({ tlsHandshakes: 0, id: ID, inspect: { diff --git a/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_flows/index.tsx b/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_flows/index.tsx index a2a64d0770558..6924f3202076b 100644 --- a/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_flows/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_flows/index.tsx @@ -74,9 +74,10 @@ export const useNetworkKpiUniqueFlows = ({ : null ); - const [networkKpiUniqueFlowsResponse, setNetworkKpiUniqueFlowsResponse] = useState< - NetworkKpiUniqueFlowsArgs - >({ + const [ + networkKpiUniqueFlowsResponse, + setNetworkKpiUniqueFlowsResponse, + ] = useState({ uniqueFlowId: 0, id: ID, inspect: { diff --git a/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_private_ips/index.tsx b/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_private_ips/index.tsx index d183eb243e158..0b14945bba9ff 100644 --- a/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_private_ips/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/kpi_network/unique_private_ips/index.tsx @@ -78,9 +78,10 @@ export const useNetworkKpiUniquePrivateIps = ({ : null ); - const [networkKpiUniquePrivateIpsResponse, setNetworkKpiUniquePrivateIpsResponse] = useState< - NetworkKpiUniquePrivateIpsArgs - >({ + const [ + networkKpiUniquePrivateIpsResponse, + setNetworkKpiUniquePrivateIpsResponse, + ] = useState({ uniqueDestinationPrivateIps: 0, uniqueDestinationPrivateIpsHistogram: null, uniqueSourcePrivateIps: 0, diff --git a/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx b/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx index 0676d5976e211..fa9a6ac08e812 100644 --- a/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx +++ b/x-pack/plugins/security_solution/public/network/containers/network_top_countries/index.tsx @@ -111,9 +111,10 @@ export const useNetworkTopCountries = ({ [limit] ); - const [networkTopCountriesResponse, setNetworkTopCountriesResponse] = useState< - NetworkTopCountriesArgs - >({ + const [ + networkTopCountriesResponse, + setNetworkTopCountriesResponse, + ] = useState({ networkTopCountries: [], id: queryId, inspect: { diff --git a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts index a79ffda0bcce9..9334e14af5ecd 100644 --- a/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts +++ b/x-pack/plugins/security_solution/public/resolver/store/data/selectors.ts @@ -83,21 +83,22 @@ export const originID: (state: DataState) => string | undefined = createSelector /** * Process events that will be displayed as terminated. */ -export const terminatedProcesses = createSelector(resolverTreeResponse, function ( - tree?: ResolverTree -) { - if (!tree) { - return new Set(); +export const terminatedProcesses = createSelector( + resolverTreeResponse, + function (tree?: ResolverTree) { + if (!tree) { + return new Set(); + } + return new Set( + resolverTreeModel + .lifecycleEvents(tree) + .filter(isTerminatedProcess) + .map((terminatedEvent) => { + return eventModel.entityIDSafeVersion(terminatedEvent); + }) + ); } - return new Set( - resolverTreeModel - .lifecycleEvents(tree) - .filter(isTerminatedProcess) - .map((terminatedEvent) => { - return eventModel.entityIDSafeVersion(terminatedEvent); - }) - ); -}); +); /** * A function that given an entity id returns a boolean indicating if the id is in the set of terminated processes. diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/deep_object_entries.test.ts b/x-pack/plugins/security_solution/public/resolver/view/panels/deep_object_entries.test.ts index 1c4e1f4199bc4..714b103e5714d 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/deep_object_entries.test.ts +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/deep_object_entries.test.ts @@ -7,11 +7,13 @@ import { deepObjectEntries } from './deep_object_entries'; describe('deepObjectEntries', () => { - const valuesAndExpected: Array<[ - objectValue: object, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - expected: Array<[path: Array, fieldValue: unknown]> - ]> = [ + const valuesAndExpected: Array< + [ + objectValue: object, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + expected: Array<[path: Array, fieldValue: unknown]> + ] + > = [ [{}, []], // No 'field' values found [{ a: {} }, []], // No 'field' values found [{ a: { b: undefined } }, []], // No 'field' values found diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx index 5675e29fc2bc1..27a7723d7d656 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx @@ -220,9 +220,9 @@ const NodeDetailView = memo(function ({ } as HTMLAttributes } descriptionProps={ - { 'data-test-subj': 'resolver:node-detail:entry-description' } as HTMLAttributes< - HTMLElement - > + { + 'data-test-subj': 'resolver:node-detail:entry-description', + } as HTMLAttributes } compressed listItems={processInfoEntry} diff --git a/x-pack/plugins/security_solution/server/endpoint/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/mocks.ts index 1268c8a4bc576..61264a8848f61 100644 --- a/x-pack/plugins/security_solution/server/endpoint/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/mocks.ts @@ -58,9 +58,7 @@ export const createMockEndpointAppContextService = ( /** * Creates a mocked input contract for the `EndpointAppContextService#start()` method */ -export const createMockEndpointAppContextServiceStartContract = (): jest.Mocked< - EndpointAppContextServiceStartContract -> => { +export const createMockEndpointAppContextServiceStartContract = (): jest.Mocked => { const factory = new AppClientFactory(); const config = createMockConfig(); factory.setup({ getSpaceId: () => 'mockSpace', config }); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts index 1f90c689a688f..25de64aac5258 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata.test.ts @@ -69,9 +69,7 @@ describe('test endpoint route', () => { beforeEach(() => { mockScopedClient = elasticsearchServiceMock.createLegacyScopedClusterClient(); - mockClusterClient = elasticsearchServiceMock.createLegacyClusterClient() as jest.Mocked< - ILegacyClusterClient - >; + mockClusterClient = elasticsearchServiceMock.createLegacyClusterClient() as jest.Mocked; mockSavedObjectClient = savedObjectsClientMock.create(); mockClusterClient.asScoped.mockReturnValue(mockScopedClient); routerMock = httpServiceMock.createRouter(); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts index 2c7d1e9e48404..44776bfddd61a 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/metadata/metadata_v1.test.ts @@ -63,9 +63,7 @@ describe('test endpoint route v1', () => { }; beforeEach(() => { - mockClusterClient = elasticsearchServiceMock.createLegacyClusterClient() as jest.Mocked< - ILegacyClusterClient - >; + mockClusterClient = elasticsearchServiceMock.createLegacyClusterClient() as jest.Mocked; mockScopedClient = elasticsearchServiceMock.createLegacyScopedClusterClient(); mockSavedObjectClient = savedObjectsClientMock.create(); mockClusterClient.asScoped.mockReturnValue(mockScopedClient); diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/policy/service.ts b/x-pack/plugins/security_solution/server/endpoint/routes/policy/service.ts index e670ca6e20cb2..dd4ade1906bc6 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/policy/service.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/policy/service.ts @@ -48,9 +48,10 @@ export async function getPolicyResponseByAgentId( dataClient: ILegacyScopedClusterClient ): Promise { const query = getESQueryPolicyResponseByAgentID(agentID, index); - const response = (await dataClient.callAsCurrentUser('search', query)) as SearchResponse< - HostPolicyResponse - >; + const response = (await dataClient.callAsCurrentUser( + 'search', + query + )) as SearchResponse; if (response.hits.hits.length === 0) { return undefined; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/events.ts b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/events.ts index 3be0cc5daff79..ab3f90644b51a 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/events.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/queries/events.ts @@ -54,9 +54,9 @@ export class EventsQuery { if (kql) { kqlQuery.push(esKuery.toElasticsearchQuery(esKuery.fromKueryExpression(kql))); } - const response: ApiResponse> = await client.asCurrentUser.search(this.buildSearch(kqlQuery)); + const response: ApiResponse< + SearchResponse + > = await client.asCurrentUser.search(this.buildSearch(kqlQuery)); return response.body.hits.hits.map((hit) => hit._source); } } diff --git a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts index f5a27b7602e8b..9cb3f3d20543c 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/artifacts/manifest_manager/manifest_manager.test.ts @@ -271,7 +271,9 @@ describe('manifest_manager', () => { }); test('ManifestManager can commit manifest', async () => { - const savedObjectsClient: ReturnType = savedObjectsClientMock.create(); + const savedObjectsClient: ReturnType< + typeof savedObjectsClientMock.create + > = savedObjectsClientMock.create(); const manifestManager = getManifestManagerMock({ savedObjectsClient, }); diff --git a/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts index 10faa362363ad..f4bbc9ab9189e 100644 --- a/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts +++ b/x-pack/plugins/security_solution/server/graphql/note/resolvers.ts @@ -15,9 +15,7 @@ export type QueryAllNoteResolver = AppResolverWithFields< 'totalCount' | 'Note' >; -export type QueryNotesByTimelineIdResolver = AppResolverOf< - QueryResolvers.GetNotesByTimelineIdResolver ->; +export type QueryNotesByTimelineIdResolver = AppResolverOf; export type QueryNotesByEventIdResolver = AppResolverOf; @@ -27,9 +25,7 @@ export type MutationNoteResolver = AppResolverOf< export type MutationDeleteNoteResolver = AppResolverOf; -export type MutationDeleteNoteByTimelineIdResolver = AppResolverOf< - MutationResolvers.DeleteNoteByTimelineIdResolver ->; +export type MutationDeleteNoteByTimelineIdResolver = AppResolverOf; interface NoteResolversDeps { note: Note; diff --git a/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts index 49072f0279de8..a16db47aaa40b 100644 --- a/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts +++ b/x-pack/plugins/security_solution/server/graphql/pinned_event/resolvers.ts @@ -8,21 +8,13 @@ import { AppResolverOf } from '../../lib/framework'; import { MutationResolvers, QueryResolvers } from '../types'; import { PinnedEvent } from '../../lib/pinned_event/saved_object'; -export type QueryAllPinnedEventsByTimelineIdResolver = AppResolverOf< - QueryResolvers.GetAllPinnedEventsByTimelineIdResolver ->; +export type QueryAllPinnedEventsByTimelineIdResolver = AppResolverOf; -export type MutationPinnedEventResolver = AppResolverOf< - MutationResolvers.PersistPinnedEventOnTimelineResolver ->; +export type MutationPinnedEventResolver = AppResolverOf; -export type MutationDeletePinnedEventOnTimelineResolver = AppResolverOf< - MutationResolvers.DeletePinnedEventOnTimelineResolver ->; +export type MutationDeletePinnedEventOnTimelineResolver = AppResolverOf; -export type MutationDeleteAllPinnedEventsOnTimelineResolver = AppResolverOf< - MutationResolvers.DeleteAllPinnedEventsOnTimelineResolver ->; +export type MutationDeleteAllPinnedEventsOnTimelineResolver = AppResolverOf; interface TimelineResolversDeps { pinnedEvent: PinnedEvent; diff --git a/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts b/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts index 9e6e9bf6ea22e..fc14663b138b2 100644 --- a/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts +++ b/x-pack/plugins/security_solution/server/graphql/timeline/resolvers.ts @@ -19,9 +19,7 @@ export type MutationTimelineResolver = AppResolverOf< MutationResolvers.PersistTimelineResolver >; -export type MutationDeleteTimelineResolver = AppResolverOf< - MutationResolvers.DeleteTimelineResolver ->; +export type MutationDeleteTimelineResolver = AppResolverOf; export type MutationFavoriteResolver = AppResolverOf; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts index fd29be0e81f3c..e1859a57a8f81 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_responses.ts @@ -508,18 +508,14 @@ export const getMockPrivilegesResult = () => ({ application: {}, }); -export const getFindResultStatusEmpty = (): SavedObjectsFindResponse< - IRuleSavedAttributesSavedObjectAttributes -> => ({ +export const getFindResultStatusEmpty = (): SavedObjectsFindResponse => ({ page: 1, per_page: 1, total: 0, saved_objects: [], }); -export const getFindResultStatus = (): SavedObjectsFindResponse< - IRuleSavedAttributesSavedObjectAttributes -> => ({ +export const getFindResultStatus = (): SavedObjectsFindResponse => ({ page: 1, per_page: 6, total: 2, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/create_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/create_rule_actions_saved_object.ts index 2ff6d6ac646ae..5fa0bf525a5d9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/create_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/create_rule_actions_saved_object.ts @@ -24,13 +24,14 @@ export const createRuleActionsSavedObject = async ({ actions = [], throttle, }: CreateRuleActionsSavedObject): Promise => { - const ruleActionsSavedObject = await savedObjectsClient.create< - IRuleActionsAttributesSavedObjectAttributes - >(ruleActionsSavedObjectType, { - ruleAlertId, - actions, - ...getThrottleOptions(throttle), - }); + const ruleActionsSavedObject = await savedObjectsClient.create( + ruleActionsSavedObjectType, + { + ruleAlertId, + actions, + ...getThrottleOptions(throttle), + } + ); return getRuleActionsFromSavedObject(ruleActionsSavedObject); }; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/get_rule_actions_saved_object.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/get_rule_actions_saved_object.ts index f469aa8634c5a..f8b5626b09cd3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/get_rule_actions_saved_object.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions/get_rule_actions_saved_object.ts @@ -26,10 +26,10 @@ export const getRuleActionsSavedObject = async ({ ruleAlertId, savedObjectsClient, }: GetRuleActionsSavedObject): Promise => { - // eslint-disable-next-line @typescript-eslint/naming-convention - const { saved_objects } = await savedObjectsClient.find< - IRuleActionsAttributesSavedObjectAttributes - >({ + const { + // eslint-disable-next-line @typescript-eslint/naming-convention + saved_objects, + } = await savedObjectsClient.find({ type: ruleActionsSavedObjectType, perPage: 1, search: `${ruleAlertId}`, diff --git a/x-pack/plugins/security_solution/server/lib/sources/configuration.ts b/x-pack/plugins/security_solution/server/lib/sources/configuration.ts index aa620f6cf2590..2526199f9e07f 100644 --- a/x-pack/plugins/security_solution/server/lib/sources/configuration.ts +++ b/x-pack/plugins/security_solution/server/lib/sources/configuration.ts @@ -17,9 +17,9 @@ export class ConfigurationSourcesAdapter implements SourcesAdapter { private readonly configuration: ConfigurationAdapter; constructor( - configuration: ConfigurationAdapter< - ConfigurationWithSources - > = new InmemoryConfigurationAdapter({ sources: {} }) + configuration: ConfigurationAdapter = new InmemoryConfigurationAdapter( + { sources: {} } + ) ) { this.configuration = configuration; } diff --git a/x-pack/plugins/security_solution/server/usage/endpoints/endpoint.test.ts b/x-pack/plugins/security_solution/server/usage/endpoints/endpoint.test.ts index 6d4b97564c90e..5de14fd574be0 100644 --- a/x-pack/plugins/security_solution/server/usage/endpoints/endpoint.test.ts +++ b/x-pack/plugins/security_solution/server/usage/endpoints/endpoint.test.ts @@ -20,9 +20,9 @@ import * as fleetSavedObjects from './fleet_saved_objects'; describe('test security solution endpoint telemetry', () => { let mockSavedObjectsRepository: jest.Mocked; let getFleetSavedObjectsMetadataSpy: jest.SpyInstance>>; - let getLatestFleetEndpointEventSpy: jest.SpyInstance - >>; + let getLatestFleetEndpointEventSpy: jest.SpyInstance< + Promise> + >; beforeAll(() => { getLatestFleetEndpointEventSpy = jest.spyOn(fleetSavedObjects, 'getLatestFleetEndpointEvent'); diff --git a/x-pack/plugins/spaces/public/management/management_service.test.ts b/x-pack/plugins/spaces/public/management/management_service.test.ts index 444ccf43d3d1f..a2d045449dc56 100644 --- a/x-pack/plugins/spaces/public/management/management_service.test.ts +++ b/x-pack/plugins/spaces/public/management/management_service.test.ts @@ -22,9 +22,8 @@ describe('ManagementService', () => { managementMockSetup.sections.section.kibana = mockKibanaSection; const deps = { management: managementMockSetup, - getStartServices: coreMock.createSetup().getStartServices as CoreSetup< - PluginsStart - >['getStartServices'], + getStartServices: coreMock.createSetup() + .getStartServices as CoreSetup['getStartServices'], spacesManager: spacesManagerMock.create(), }; @@ -43,9 +42,8 @@ describe('ManagementService', () => { it('will not crash if the kibana section is missing', () => { const deps = { management: managementPluginMock.createSetupContract(), - getStartServices: coreMock.createSetup().getStartServices as CoreSetup< - PluginsStart - >['getStartServices'], + getStartServices: coreMock.createSetup() + .getStartServices as CoreSetup['getStartServices'], spacesManager: spacesManagerMock.create(), }; @@ -65,9 +63,8 @@ describe('ManagementService', () => { const deps = { management: managementMockSetup, - getStartServices: coreMock.createSetup().getStartServices as CoreSetup< - PluginsStart - >['getStartServices'], + getStartServices: coreMock.createSetup() + .getStartServices as CoreSetup['getStartServices'], spacesManager: spacesManagerMock.create(), }; diff --git a/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.test.ts b/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.test.ts index 88adf98248d2c..4fd9529507335 100644 --- a/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.test.ts +++ b/x-pack/plugins/spaces/server/saved_objects/spaces_saved_objects_client.test.ts @@ -209,9 +209,9 @@ const ERROR_NAMESPACE_SPECIFIED = 'Spaces currently determines the namespaces'; }; baseClient.find.mockReturnValue(Promise.resolve(expectedReturnValue)); - const spacesClient = spacesService.createSpacesClient(null as any) as jest.Mocked< - SpacesClient - >; + const spacesClient = spacesService.createSpacesClient( + null as any + ) as jest.Mocked; spacesClient.getAll.mockImplementation(() => Promise.resolve([ { id: 'ns-1', name: '', disabledFeatures: [] }, @@ -240,9 +240,9 @@ const ERROR_NAMESPACE_SPECIFIED = 'Spaces currently determines the namespaces'; }; baseClient.find.mockReturnValue(Promise.resolve(expectedReturnValue)); - const spacesClient = spacesService.createSpacesClient(null as any) as jest.Mocked< - SpacesClient - >; + const spacesClient = spacesService.createSpacesClient( + null as any + ) as jest.Mocked; spacesClient.getAll.mockImplementation(() => Promise.resolve([ { id: 'ns-1', name: '', disabledFeatures: [] }, @@ -271,9 +271,9 @@ const ERROR_NAMESPACE_SPECIFIED = 'Spaces currently determines the namespaces'; }; baseClient.find.mockReturnValue(Promise.resolve(expectedReturnValue)); - const spacesClient = spacesService.createSpacesClient(null as any) as jest.Mocked< - SpacesClient - >; + const spacesClient = spacesService.createSpacesClient( + null as any + ) as jest.Mocked; spacesClient.getAll.mockImplementation(() => Promise.resolve([ { id: 'ns-1', name: '', disabledFeatures: [] }, diff --git a/x-pack/plugins/stack_alerts/public/alert_types/geo_threshold/query_builder/index.tsx b/x-pack/plugins/stack_alerts/public/alert_types/geo_threshold/query_builder/index.tsx index c573d3b738373..a34b367668ec7 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/geo_threshold/query_builder/index.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/geo_threshold/query_builder/index.tsx @@ -85,10 +85,9 @@ function validateQuery(query: Query) { return true; } -export const GeoThresholdAlertTypeExpression: React.FunctionComponent> = ({ alertParams, alertInterval, setAlertParams, setAlertProperty, errors, alertsContext }) => { +export const GeoThresholdAlertTypeExpression: React.FunctionComponent< + AlertTypeParamsExpressionProps +> = ({ alertParams, alertInterval, setAlertParams, setAlertProperty, errors, alertsContext }) => { const { index, indexId, diff --git a/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.tsx b/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.tsx index 92cb8c9055bde..274cd5a9d20dc 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/threshold/expression.tsx @@ -66,10 +66,9 @@ const expressionFieldsWithValidation = [ 'timeWindowSize', ]; -export const IndexThresholdAlertTypeExpression: React.FunctionComponent> = ({ alertParams, alertInterval, setAlertParams, setAlertProperty, errors, alertsContext }) => { +export const IndexThresholdAlertTypeExpression: React.FunctionComponent< + AlertTypeParamsExpressionProps +> = ({ alertParams, alertInterval, setAlertParams, setAlertProperty, errors, alertsContext }) => { const { index, timeField, diff --git a/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts b/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts index 5addad7086f69..3e0d517172d01 100644 --- a/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts +++ b/x-pack/plugins/task_manager/server/monitoring/task_run_statistics.ts @@ -92,10 +92,9 @@ export function createTaskRunAggregator( ); const resultFrequencyQueue = createRunningAveragedStat(runningAverageWindowSize); - const taskPollingEvents$: Observable> = taskPollingLifecycle.events.pipe( + const taskPollingEvents$: Observable< + Pick + > = taskPollingLifecycle.events.pipe( filter( (taskEvent: TaskLifecycleEvent) => isTaskPollingCycleEvent(taskEvent) && isOk(taskEvent.event) diff --git a/x-pack/plugins/task_manager/server/polling_lifecycle.ts b/x-pack/plugins/task_manager/server/polling_lifecycle.ts index d5a06c76aaacd..1a8108e34078d 100644 --- a/x-pack/plugins/task_manager/server/polling_lifecycle.ts +++ b/x-pack/plugins/task_manager/server/polling_lifecycle.ts @@ -118,10 +118,9 @@ export class TaskPollingLifecycle { } = config; // the task poller that polls for work on fixed intervals and on demand - const poller$: Observable - >> = createObservableMonitor>, Error>( + const poller$: Observable< + Result> + > = createObservableMonitor>, Error>( () => createTaskPoller({ logger, diff --git a/x-pack/plugins/task_manager/server/saved_objects/migrations.ts b/x-pack/plugins/task_manager/server/saved_objects/migrations.ts index 96b9526a5174e..430b1070ea618 100644 --- a/x-pack/plugins/task_manager/server/saved_objects/migrations.ts +++ b/x-pack/plugins/task_manager/server/saved_objects/migrations.ts @@ -17,9 +17,7 @@ export const migrations: SavedObjectMigrationMap = { function moveIntervalIntoSchedule({ attributes: { interval, ...attributes }, ...doc -}: SavedObjectUnsanitizedDoc): SavedObjectUnsanitizedDoc< - TaskInstance -> { +}: SavedObjectUnsanitizedDoc): SavedObjectUnsanitizedDoc { return { ...doc, attributes: { diff --git a/x-pack/plugins/task_manager/server/task_store.ts b/x-pack/plugins/task_manager/server/task_store.ts index cb44144d2fefe..04ee3529bcc0b 100644 --- a/x-pack/plugins/task_manager/server/task_store.ts +++ b/x-pack/plugins/task_manager/server/task_store.ts @@ -186,9 +186,10 @@ export class TaskStore { * * @param opts - The query options used to filter tasks */ - public async fetch({ sort = [{ 'task.runAt': 'asc' }], ...opts }: SearchOpts = {}): Promise< - FetchResult - > { + public async fetch({ + sort = [{ 'task.runAt': 'asc' }], + ...opts + }: SearchOpts = {}): Promise { return this.search({ ...opts, sort, @@ -380,9 +381,9 @@ export class TaskStore { let updatedSavedObjects: Array; try { - ({ saved_objects: updatedSavedObjects } = await this.savedObjectsRepository.bulkUpdate< - SerializedConcreteTaskInstance - >( + ({ + saved_objects: updatedSavedObjects, + } = await this.savedObjectsRepository.bulkUpdate( docs.map((doc) => ({ type: 'task', id: doc.id, diff --git a/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts b/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts index 536c1d886e758..73e8211b6fb81 100644 --- a/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts +++ b/x-pack/plugins/transform/public/app/hooks/use_pivot_data.ts @@ -69,9 +69,10 @@ export const usePivotData = ( aggs: PivotAggsConfigDict, groupBy: PivotGroupByConfigDict ): UseIndexDataReturnType => { - const [previewMappingsProperties, setPreviewMappingsProperties] = useState< - PreviewMappingsProperties - >({}); + const [ + previewMappingsProperties, + setPreviewMappingsProperties, + ] = useState({}); const api = useApi(); const { ml: { formatHumanReadableDateTimeSeconds, multiColumnSortFactory, useDataGrid, INDEX_STATUS }, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.tsx index 111f6c9a47da9..a5f1f25712065 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/email/email_connector.tsx @@ -23,9 +23,9 @@ import { EuiLink } from '@elastic/eui'; import { ActionConnectorFieldsProps } from '../../../../types'; import { EmailActionConnector } from '../types'; -export const EmailActionConnectorFields: React.FunctionComponent> = ({ action, editActionConfig, editActionSecrets, errors, readOnly, docLinks }) => { +export const EmailActionConnectorFields: React.FunctionComponent< + ActionConnectorFieldsProps +> = ({ action, editActionConfig, editActionSecrets, errors, readOnly, docLinks }) => { const { from, host, port, secure, hasAuth } = action.config; const { user, password } = action.secrets; useEffect(() => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.tsx index 9cfb9f1dc25b2..ba2f65659cd04 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index/es_index_connector.tsx @@ -27,9 +27,9 @@ import { getIndexPatterns, } from '../../../../common/index_controls'; -const IndexActionConnectorFields: React.FunctionComponent> = ({ action, editActionConfig, errors, http, readOnly, docLinks }) => { +const IndexActionConnectorFields: React.FunctionComponent< + ActionConnectorFieldsProps +> = ({ action, editActionConfig, errors, http, readOnly, docLinks }) => { const { index, refresh, executionTimeField } = action.config; const [hasTimeFieldCheckbox, setTimeFieldCheckboxState] = useState( executionTimeField != null diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.tsx index ad2d5b3be5268..cc2e004d5a1d4 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/pagerduty/pagerduty_connectors.tsx @@ -10,9 +10,9 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { ActionConnectorFieldsProps } from '../../../../types'; import { PagerDutyActionConnector } from '.././types'; -const PagerDutyActionConnectorFields: React.FunctionComponent> = ({ errors, action, editActionConfig, editActionSecrets, docLinks, readOnly }) => { +const PagerDutyActionConnectorFields: React.FunctionComponent< + ActionConnectorFieldsProps +> = ({ errors, action, editActionConfig, editActionSecrets, docLinks, readOnly }) => { const { apiUrl } = action.config; const { routingKey } = action.secrets; return ( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.tsx index c4f434f138747..e8c427371c4a5 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/server_log/server_log_params.tsx @@ -11,9 +11,9 @@ import { ServerLogActionParams } from '.././types'; import { TextAreaWithMessageVariables } from '../../text_area_with_message_variables'; import { resolvedActionGroupMessage } from '../../../constants'; -export const ServerLogParamsFields: React.FunctionComponent> = ({ actionParams, editAction, index, errors, messageVariables, defaultMessage }) => { +export const ServerLogParamsFields: React.FunctionComponent< + ActionParamsProps +> = ({ actionParams, editAction, index, errors, messageVariables, defaultMessage }) => { const { message, level } = actionParams; const levelOptions = [ { value: 'trace', text: 'Trace' }, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx index 66de29c68de2b..06edb22f1c4c9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_connectors.tsx @@ -27,9 +27,9 @@ import * as i18n from './translations'; import { ServiceNowActionConnector } from './types'; import { connectorConfiguration } from './config'; -const ServiceNowConnectorFields: React.FC> = ({ action, editActionSecrets, editActionConfig, errors, consumer, readOnly, docLinks }) => { +const ServiceNowConnectorFields: React.FC< + ActionConnectorFieldsProps +> = ({ action, editActionSecrets, editActionConfig, errors, consumer, readOnly, docLinks }) => { // TODO: remove incidentConfiguration later, when Case ServiceNow will move their fields to the level of action execution const { apiUrl, incidentConfiguration, isCaseOwned } = action.config; const mapping = incidentConfiguration ? incidentConfiguration.mapping : []; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.tsx index 0ee1bbc05a8ed..240df24735414 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/servicenow_params.tsx @@ -24,9 +24,9 @@ import { TextFieldWithMessageVariables } from '../../text_field_with_message_var import { extractActionVariable } from '../extract_action_variable'; import { AlertProvidedActionVariables } from '../../../lib/action_variables'; -const ServiceNowParamsFields: React.FunctionComponent> = ({ actionParams, editAction, index, errors, messageVariables }) => { +const ServiceNowParamsFields: React.FunctionComponent< + ActionParamsProps +> = ({ actionParams, editAction, index, errors, messageVariables }) => { const { title, description, comment, severity, urgency, impact, savedObjectId } = actionParams.subActionParams || {}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.tsx index 0b37f340f01e2..d146e0c7a009d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/slack/slack_connectors.tsx @@ -10,9 +10,9 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { ActionConnectorFieldsProps } from '../../../../types'; import { SlackActionConnector } from '../types'; -const SlackActionFields: React.FunctionComponent> = ({ action, editActionSecrets, errors, readOnly, docLinks }) => { +const SlackActionFields: React.FunctionComponent< + ActionConnectorFieldsProps +> = ({ action, editActionSecrets, errors, readOnly, docLinks }) => { const { webhookUrl } = action.secrets; return ( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.tsx index 41dfc1325e8ed..7de0df3329796 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/teams/teams_connectors.tsx @@ -10,9 +10,9 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { ActionConnectorFieldsProps } from '../../../../types'; import { TeamsActionConnector } from '../types'; -const TeamsActionFields: React.FunctionComponent> = ({ action, editActionSecrets, errors, readOnly, docLinks }) => { +const TeamsActionFields: React.FunctionComponent< + ActionConnectorFieldsProps +> = ({ action, editActionSecrets, errors, readOnly, docLinks }) => { const { webhookUrl } = action.secrets; return ( diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.tsx index 1a9de48ccce3a..8c54253c48c89 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/webhook/webhook_connectors.tsx @@ -30,9 +30,9 @@ import { WebhookActionConnector } from '../types'; const HTTP_VERBS = ['post', 'put']; -const WebhookActionConnectorFields: React.FunctionComponent> = ({ action, editActionConfig, editActionSecrets, errors, readOnly }) => { +const WebhookActionConnectorFields: React.FunctionComponent< + ActionConnectorFieldsProps +> = ({ action, editActionConfig, editActionSecrets, errors, readOnly }) => { const { user, password } = action.secrets; const { method, url, headers, hasAuth } = action.config; diff --git a/x-pack/plugins/upgrade_assistant/public/application/components/error_banner.tsx b/x-pack/plugins/upgrade_assistant/public/application/components/error_banner.tsx index 06cd5809c951a..2fbfccad74c97 100644 --- a/x-pack/plugins/upgrade_assistant/public/application/components/error_banner.tsx +++ b/x-pack/plugins/upgrade_assistant/public/application/components/error_banner.tsx @@ -12,10 +12,9 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { UpgradeAssistantTabProps } from './types'; -export const LoadingErrorBanner: React.FunctionComponent> = ({ loadingError }) => { +export const LoadingErrorBanner: React.FunctionComponent< + Pick +> = ({ loadingError }) => { if (get(loadingError, 'response.status') === 403) { return ( ({ - type: 'upgrade-assistant-telemetry', - isReady: () => true, - schema: { - features: { - deprecation_logging: { - enabled: { type: 'boolean' }, + const upgradeAssistantUsageCollector = usageCollection.makeUsageCollector( + { + type: 'upgrade-assistant-telemetry', + isReady: () => true, + schema: { + features: { + deprecation_logging: { + enabled: { type: 'boolean' }, + }, + }, + ui_open: { + cluster: { type: 'long' }, + indices: { type: 'long' }, + overview: { type: 'long' }, + }, + ui_reindex: { + close: { type: 'long' }, + open: { type: 'long' }, + start: { type: 'long' }, + stop: { type: 'long' }, }, }, - ui_open: { - cluster: { type: 'long' }, - indices: { type: 'long' }, - overview: { type: 'long' }, - }, - ui_reindex: { - close: { type: 'long' }, - open: { type: 'long' }, - start: { type: 'long' }, - stop: { type: 'long' }, - }, - }, - fetch: async () => fetchUpgradeAssistantMetrics(elasticsearch, savedObjects), - }); + fetch: async () => fetchUpgradeAssistantMetrics(elasticsearch, savedObjects), + } + ); + usageCollection.registerCollector(upgradeAssistantUsageCollector); } diff --git a/x-pack/typings/elasticsearch/aggregations.d.ts b/x-pack/typings/elasticsearch/aggregations.d.ts index f471b83fbbc6b..6b64ad6276f57 100644 --- a/x-pack/typings/elasticsearch/aggregations.d.ts +++ b/x-pack/typings/elasticsearch/aggregations.d.ts @@ -379,11 +379,9 @@ interface AggregationResponsePart> = keyof (UnionToIntersection< - T -> extends never - ? T - : UnionToIntersection); +export type ValidAggregationKeysOf< + T extends Record +> = keyof (UnionToIntersection extends never ? T : UnionToIntersection); export type AggregationResultOf< TAggregationOptionsMap extends AggregationOptionsMap, diff --git a/yarn.lock b/yarn.lock index cbc66dc8cdb3e..8efcf7f6d85ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5441,11 +5441,16 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.16.1.tgz#328d1c9b54402e44119398bcb6a31b7bbd606d59" integrity sha512-db6pZL5QY3JrlCHBhYQzYDci0xnoDuxfseUuguLRr3JNk+bnCfpkK6p8quiUDyO8A0vbpBKkk59Fw125etrNeA== -"@types/prettier@^2.0.0", "@types/prettier@^2.0.2": +"@types/prettier@^2.0.0": version "2.0.2" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.0.2.tgz#5bb52ee68d0f8efa9cc0099920e56be6cc4e37f3" integrity sha512-IkVfat549ggtkZUthUzEX49562eGikhSYeVGX97SkMFn+sTZrgRewXjQ4tPKFPCykZHkX1Zfd9OoELGqKU2jJA== +"@types/prettier@^2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.5.tgz#b6ab3bba29e16b821d84e09ecfaded462b816b00" + integrity sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ== + "@types/pretty-ms@^5.0.0": version "5.0.1" resolved "https://registry.yarnpkg.com/@types/pretty-ms/-/pretty-ms-5.0.1.tgz#f2f0d7be58caf8613d149053d446e0282ae11ff3" @@ -12753,10 +12758,10 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-prettier@^6.11.0: - version "6.11.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" - integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA== +eslint-config-prettier@^6.15.0: + version "6.15.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" + integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== dependencies: get-stdin "^6.0.0" @@ -22567,10 +22572,10 @@ prettier@1.16.4: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== -prettier@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.1.tgz#d9485dd5e499daa6cb547023b87a6cf51bee37d6" - integrity sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw== +prettier@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b" + integrity sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw== prettier@~2.0.5: version "2.0.5"