diff --git a/docs/development/core/public/kibana-plugin-core-public.publicappinfo.md b/docs/development/core/public/kibana-plugin-core-public.publicappinfo.md index c70f3a97a888..4b3b103c9273 100644 --- a/docs/development/core/public/kibana-plugin-core-public.publicappinfo.md +++ b/docs/development/core/public/kibana-plugin-core-public.publicappinfo.md @@ -11,5 +11,8 @@ Public information about a registered [application](./kibana-plugin-core-public. ```typescript export declare type PublicAppInfo = Omit & { legacy: false; + status: AppStatus; + navLinkStatus: AppNavLinkStatus; + appRoute: string; }; ``` diff --git a/docs/development/core/public/kibana-plugin-core-public.publiclegacyappinfo.md b/docs/development/core/public/kibana-plugin-core-public.publiclegacyappinfo.md index cc3e9de3193c..051638daabd1 100644 --- a/docs/development/core/public/kibana-plugin-core-public.publiclegacyappinfo.md +++ b/docs/development/core/public/kibana-plugin-core-public.publiclegacyappinfo.md @@ -11,5 +11,7 @@ Information about a registered [legacy application](./kibana-plugin-core-public. ```typescript export declare type PublicLegacyAppInfo = Omit & { legacy: true; + status: AppStatus; + navLinkStatus: AppNavLinkStatus; }; ``` diff --git a/package.json b/package.json index b1202631a0c0..6b4c8ee78581 100644 --- a/package.json +++ b/package.json @@ -202,6 +202,7 @@ "inline-style": "^2.0.0", "joi": "^13.5.2", "jquery": "^3.5.0", + "js-levenshtein": "^1.1.6", "js-yaml": "3.13.1", "json-stable-stringify": "^1.0.1", "json-stringify-pretty-compact": "1.2.0", diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 6926b6acf241..cd2dd99c30c1 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -269,6 +269,10 @@ export interface LegacyApp extends AppBase { */ export type PublicAppInfo = Omit & { legacy: false; + // remove optional on fields populated with default values + status: AppStatus; + navLinkStatus: AppNavLinkStatus; + appRoute: string; }; /** @@ -278,6 +282,9 @@ export type PublicAppInfo = Omit & { */ export type PublicLegacyAppInfo = Omit & { legacy: true; + // remove optional on fields populated with default values + status: AppStatus; + navLinkStatus: AppNavLinkStatus; }; /** diff --git a/src/core/public/application/utils.ts b/src/core/public/application/utils.ts index 1dc9ec705900..92d25fa468c4 100644 --- a/src/core/public/application/utils.ts +++ b/src/core/public/application/utils.ts @@ -120,12 +120,17 @@ export function getAppInfo(app: App | LegacyApp): PublicAppInfo | Publi const { updater$, ...infos } = app; return { ...infos, + status: app.status!, + navLinkStatus: app.navLinkStatus!, legacy: true, }; } else { const { updater$, mount, ...infos } = app; return { ...infos, + status: app.status!, + navLinkStatus: app.navLinkStatus!, + appRoute: app.appRoute!, legacy: false, }; } diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index d10e351f4d13..a65b9dd9d242 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -1143,11 +1143,16 @@ export type PluginOpaqueId = symbol; // @public export type PublicAppInfo = Omit & { legacy: false; + status: AppStatus; + navLinkStatus: AppNavLinkStatus; + appRoute: string; }; // @public export type PublicLegacyAppInfo = Omit & { legacy: true; + status: AppStatus; + navLinkStatus: AppNavLinkStatus; }; // @public diff --git a/vars/kibanaPipeline.groovy b/vars/kibanaPipeline.groovy index 46a76bbb8d52..f3fc5f84583c 100644 --- a/vars/kibanaPipeline.groovy +++ b/vars/kibanaPipeline.groovy @@ -21,6 +21,7 @@ def functionalTestProcess(String name, Closure closure) { def kibanaPort = "61${processNumber}1" def esPort = "61${processNumber}2" def esTransportPort = "61${processNumber}3" + def ingestManagementPackageRegistryPort = "61${processNumber}4" withEnv([ "CI_PARALLEL_PROCESS_NUMBER=${processNumber}", @@ -29,6 +30,7 @@ def functionalTestProcess(String name, Closure closure) { "TEST_KIBANA_URL=http://elastic:changeme@localhost:${kibanaPort}", "TEST_ES_URL=http://elastic:changeme@localhost:${esPort}", "TEST_ES_TRANSPORT_PORT=${esTransportPort}", + "INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=${ingestManagementPackageRegistryPort}", "IS_PIPELINE_JOB=1", "JOB=${name}", "KBN_NP_PLUGINS_BUILT=true", diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index eb781ee07830..deafda67b806 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -4,46 +4,42 @@ * you may not use this file except in compliance with the Elastic License. */ import { i18n } from '@kbn/i18n'; +import { combineLatest, Observable } from 'rxjs'; +import { map, take } from 'rxjs/operators'; import { - PluginInitializerContext, - Plugin, CoreSetup, CoreStart, Logger, + Plugin, + PluginInitializerContext, } from 'src/core/server'; -import { Observable, combineLatest } from 'rxjs'; -import { map, take } from 'rxjs/operators'; -import { ObservabilityPluginSetup } from '../../observability/server'; -import { SecurityPluginSetup } from '../../security/server'; -import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server'; -import { TaskManagerSetupContract } from '../../task_manager/server'; -import { AlertingPlugin } from '../../alerts/server'; -import { ActionsPlugin } from '../../actions/server'; +import { APMConfig, APMXPackConfig, mergeConfigs } from '.'; import { APMOSSPluginSetup } from '../../../../src/plugins/apm_oss/server'; -import { createApmAgentConfigurationIndex } from './lib/settings/agent_configuration/create_agent_config_index'; -import { createApmCustomLinkIndex } from './lib/settings/custom_link/create_custom_link_index'; -import { createApmApi } from './routes/create_apm_api'; -import { getApmIndices } from './lib/settings/apm_indices/get_apm_indices'; -import { APMConfig, mergeConfigs, APMXPackConfig } from '.'; import { HomeServerPluginSetup } from '../../../../src/plugins/home/server'; +import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server'; +import { ActionsPlugin } from '../../actions/server'; +import { AlertingPlugin } from '../../alerts/server'; import { CloudSetup } from '../../cloud/server'; -import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_objects_client'; -import { - LicensingPluginSetup, - LicensingPluginStart, -} from '../../licensing/server'; -import { registerApmAlerts } from './lib/alerts/register_apm_alerts'; -import { createApmTelemetry } from './lib/apm_telemetry'; - import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; +import { LicensingPluginSetup } from '../../licensing/server'; +import { MlPluginSetup } from '../../ml/server'; +import { ObservabilityPluginSetup } from '../../observability/server'; +import { SecurityPluginSetup } from '../../security/server'; +import { TaskManagerSetupContract } from '../../task_manager/server'; import { APM_FEATURE, APM_SERVICE_MAPS_FEATURE_NAME, APM_SERVICE_MAPS_LICENSE_TYPE, } from './feature'; +import { registerApmAlerts } from './lib/alerts/register_apm_alerts'; +import { createApmTelemetry } from './lib/apm_telemetry'; +import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_objects_client'; +import { createApmAgentConfigurationIndex } from './lib/settings/agent_configuration/create_agent_config_index'; +import { getApmIndices } from './lib/settings/apm_indices/get_apm_indices'; +import { createApmCustomLinkIndex } from './lib/settings/custom_link/create_custom_link_index'; +import { createApmApi } from './routes/create_apm_api'; import { apmIndices, apmTelemetry } from './saved_objects'; import { createElasticCloudInstructions } from './tutorial/elastic_cloud'; -import { MlPluginSetup } from '../../ml/server'; export interface APMPluginSetup { config$: Observable; @@ -135,18 +131,14 @@ export class APMPlugin implements Plugin { APM_SERVICE_MAPS_LICENSE_TYPE ); - core.getStartServices().then(([_coreStart, pluginsStart]) => { - createApmApi().init(core, { - config$: mergedConfig$, - logger: this.logger!, - plugins: { - licensing: (pluginsStart as { licensing: LicensingPluginStart }) - .licensing, - observability: plugins.observability, - security: plugins.security, - ml: plugins.ml, - }, - }); + createApmApi().init(core, { + config$: mergedConfig$, + logger: this.logger!, + plugins: { + observability: plugins.observability, + security: plugins.security, + ml: plugins.ml, + }, }); return { diff --git a/x-pack/plugins/apm/server/routes/create_api/index.test.ts b/x-pack/plugins/apm/server/routes/create_api/index.test.ts index f5db936c00d3..3d3e26f680e0 100644 --- a/x-pack/plugins/apm/server/routes/create_api/index.test.ts +++ b/x-pack/plugins/apm/server/routes/create_api/index.test.ts @@ -9,7 +9,6 @@ import { CoreSetup, Logger } from 'src/core/server'; import { Params } from '../typings'; import { BehaviorSubject } from 'rxjs'; import { APMConfig } from '../..'; -import { LicensingPluginStart } from '../../../../licensing/server'; const getCoreMock = () => { const get = jest.fn(); @@ -41,7 +40,7 @@ const getCoreMock = () => { logger: ({ error: jest.fn(), } as unknown) as Logger, - plugins: { licensing: {} as LicensingPluginStart }, + plugins: {}, }, }; }; diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts index 3937c18b3fe5..a3e2f708b0b2 100644 --- a/x-pack/plugins/apm/server/routes/service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map.ts @@ -35,10 +35,7 @@ export const serviceMapRoute = createRoute(() => ({ if (!isValidPlatinumLicense(context.licensing.license)) { throw Boom.forbidden(invalidLicenseMessage); } - - context.plugins.licensing.featureUsage.notifyUsage( - APM_SERVICE_MAPS_FEATURE_NAME - ); + context.licensing.featureUsage.notifyUsage(APM_SERVICE_MAPS_FEATURE_NAME); const setup = await setupRequest(context, request); const { diff --git a/x-pack/plugins/apm/server/routes/typings.ts b/x-pack/plugins/apm/server/routes/typings.ts index f30a9d18d7ae..b1815e88d291 100644 --- a/x-pack/plugins/apm/server/routes/typings.ts +++ b/x-pack/plugins/apm/server/routes/typings.ts @@ -14,7 +14,6 @@ import { import { PickByValue, Optional } from 'utility-types'; import { Observable } from 'rxjs'; import { Server } from 'hapi'; -import { LicensingPluginStart } from '../../../licensing/server'; import { ObservabilityPluginSetup } from '../../../observability/server'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { FetchOptions } from '../../public/services/rest/callApi'; @@ -67,7 +66,6 @@ export type APMRequestHandlerContext< config: APMConfig; logger: Logger; plugins: { - licensing: LicensingPluginStart; observability?: ObservabilityPluginSetup; security?: SecurityPluginSetup; ml?: MlPluginSetup; @@ -116,7 +114,6 @@ export interface ServerAPI { config$: Observable; logger: Logger; plugins: { - licensing: LicensingPluginStart; observability?: ObservabilityPluginSetup; security?: SecurityPluginSetup; ml?: MlPluginSetup; diff --git a/x-pack/plugins/cross_cluster_replication/server/routes/api/cross_cluster_replication/register_permissions_route.ts b/x-pack/plugins/cross_cluster_replication/server/routes/api/cross_cluster_replication/register_permissions_route.ts index b8eb5ae14750..008828d264a2 100644 --- a/x-pack/plugins/cross_cluster_replication/server/routes/api/cross_cluster_replication/register_permissions_route.ts +++ b/x-pack/plugins/cross_cluster_replication/server/routes/api/cross_cluster_replication/register_permissions_route.ts @@ -43,13 +43,13 @@ export const registerPermissionsRoute = ({ }); const missingClusterPrivileges = Object.keys(cluster).reduce( - (permissions: any, permissionName: any) => { + (permissions: string[], permissionName: string) => { if (!cluster[permissionName]) { permissions.push(permissionName); - return permissions; } + return permissions; }, - [] as any[] + [] ); return response.ok({ diff --git a/x-pack/plugins/global_search_providers/kibana.json b/x-pack/plugins/global_search_providers/kibana.json new file mode 100644 index 000000000000..025ea2bceed2 --- /dev/null +++ b/x-pack/plugins/global_search_providers/kibana.json @@ -0,0 +1,10 @@ +{ + "id": "globalSearchProviders", + "version": "8.0.0", + "kibanaVersion": "kibana", + "server": false, + "ui": true, + "requiredPlugins": ["globalSearch"], + "optionalPlugins": [], + "configPath": ["xpack", "global_search_providers"] +} diff --git a/x-pack/plugins/global_search_providers/public/index.ts b/x-pack/plugins/global_search_providers/public/index.ts new file mode 100644 index 000000000000..bc66994aa393 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PluginInitializer } from 'src/core/public'; +import { GlobalSearchProvidersPlugin, GlobalSearchProvidersPluginSetupDeps } from './plugin'; + +export const plugin: PluginInitializer<{}, {}, GlobalSearchProvidersPluginSetupDeps, {}> = () => + new GlobalSearchProvidersPlugin(); diff --git a/x-pack/plugins/global_search_providers/public/plugin.test.ts b/x-pack/plugins/global_search_providers/public/plugin.test.ts new file mode 100644 index 000000000000..a2880acae440 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/plugin.test.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { coreMock } from '../../../../src/core/public/mocks'; +import { globalSearchPluginMock } from '../../global_search/public/mocks'; +import { GlobalSearchProvidersPlugin } from './plugin'; + +describe('GlobalSearchProvidersPlugin', () => { + let plugin: GlobalSearchProvidersPlugin; + let globalSearchSetup: ReturnType; + + beforeEach(() => { + globalSearchSetup = globalSearchPluginMock.createSetupContract(); + plugin = new GlobalSearchProvidersPlugin(); + }); + + describe('#setup', () => { + it('registers the `application` result provider', () => { + const coreSetup = coreMock.createSetup(); + plugin.setup(coreSetup, { globalSearch: globalSearchSetup }); + + expect(globalSearchSetup.registerResultProvider).toHaveBeenCalledTimes(1); + expect(globalSearchSetup.registerResultProvider).toHaveBeenCalledWith( + expect.objectContaining({ + id: 'application', + }) + ); + }); + }); +}); diff --git a/x-pack/plugins/global_search_providers/public/plugin.ts b/x-pack/plugins/global_search_providers/public/plugin.ts new file mode 100644 index 000000000000..9f18c06608b0 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/plugin.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup, Plugin } from 'src/core/public'; +import { GlobalSearchPluginSetup } from '../../global_search/public'; +import { createApplicationResultProvider } from './providers'; + +export interface GlobalSearchProvidersPluginSetupDeps { + globalSearch: GlobalSearchPluginSetup; +} + +export class GlobalSearchProvidersPlugin + implements Plugin<{}, {}, GlobalSearchProvidersPluginSetupDeps, {}> { + setup( + { getStartServices }: CoreSetup<{}, {}>, + { globalSearch }: GlobalSearchProvidersPluginSetupDeps + ) { + const applicationPromise = getStartServices().then(([core]) => core.application); + globalSearch.registerResultProvider(createApplicationResultProvider(applicationPromise)); + return {}; + } + + start() { + return {}; + } +} diff --git a/x-pack/plugins/global_search_providers/public/providers/application.test.mocks.ts b/x-pack/plugins/global_search_providers/public/providers/application.test.mocks.ts new file mode 100644 index 000000000000..4fdf8a75a4bc --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/providers/application.test.mocks.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const getAppResultsMock = jest.fn(); +jest.doMock('./get_app_results', () => ({ + getAppResults: getAppResultsMock, +})); 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 new file mode 100644 index 000000000000..ca19bddb6029 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/providers/application.test.ts @@ -0,0 +1,204 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { getAppResultsMock } from './application.test.mocks'; + +import { of, EMPTY } from 'rxjs'; +import { TestScheduler } from 'rxjs/testing'; +import { ApplicationStart, AppNavLinkStatus, AppStatus, PublicAppInfo } from 'src/core/public'; +import { + GlobalSearchProviderFindOptions, + GlobalSearchProviderResult, +} from '../../../global_search/public'; +import { applicationServiceMock } from 'src/core/public/mocks'; +import { createApplicationResultProvider } from './application'; + +const getTestScheduler = () => + new TestScheduler((actual, expected) => { + expect(actual).toEqual(expected); + }); + +const createApp = (props: Partial = {}): PublicAppInfo => ({ + id: 'app1', + title: 'App 1', + appRoute: '/app/app1', + legacy: false, + status: AppStatus.accessible, + navLinkStatus: AppNavLinkStatus.visible, + chromeless: false, + ...props, +}); + +const createResult = (props: Partial): GlobalSearchProviderResult => ({ + id: 'id', + title: 'title', + type: 'application', + url: '/app/id', + score: 100, + ...props, +}); + +const createAppMap = (apps: PublicAppInfo[]): Map => { + return new Map(apps.map((app) => [app.id, app])); +}; + +const expectApp = (id: string) => expect.objectContaining({ id }); +const expectResult = expectApp; + +describe('applicationResultProvider', () => { + let application: ReturnType; + + const defaultOption: GlobalSearchProviderFindOptions = { + preference: 'pref', + maxResults: 20, + aborted$: EMPTY, + }; + + beforeEach(() => { + application = applicationServiceMock.createStartContract(); + getAppResultsMock.mockReturnValue([]); + }); + + it('has the correct id', () => { + const provider = createApplicationResultProvider(Promise.resolve(application)); + expect(provider.id).toBe('application'); + }); + + it('calls `getAppResults` with the term and the list of apps', async () => { + application.applications$ = of( + createAppMap([ + createApp({ id: 'app1', title: 'App 1' }), + createApp({ id: 'app2', title: 'App 2' }), + createApp({ id: 'app3', title: 'App 3' }), + ]) + ); + const provider = createApplicationResultProvider(Promise.resolve(application)); + + await provider.find('term', defaultOption).toPromise(); + + expect(getAppResultsMock).toHaveBeenCalledTimes(1); + expect(getAppResultsMock).toHaveBeenCalledWith('term', [ + expectApp('app1'), + expectApp('app2'), + expectApp('app3'), + ]); + }); + + it('ignores inaccessible apps', async () => { + application.applications$ = of( + createAppMap([ + createApp({ id: 'app1', title: 'App 1' }), + createApp({ id: 'disabled', title: 'disabled', status: AppStatus.inaccessible }), + ]) + ); + const provider = createApplicationResultProvider(Promise.resolve(application)); + await provider.find('term', defaultOption).toPromise(); + + expect(getAppResultsMock).toHaveBeenCalledWith('term', [expectApp('app1')]); + }); + + it('ignores chromeless apps', async () => { + application.applications$ = of( + createAppMap([ + createApp({ id: 'app1', title: 'App 1' }), + createApp({ id: 'chromeless', title: 'chromeless', chromeless: true }), + ]) + ); + + const provider = createApplicationResultProvider(Promise.resolve(application)); + await provider.find('term', defaultOption).toPromise(); + + expect(getAppResultsMock).toHaveBeenCalledWith('term', [expectApp('app1')]); + }); + + it('sorts the results returned by `getAppResults`', async () => { + getAppResultsMock.mockReturnValue([ + createResult({ id: 'r60', score: 60 }), + createResult({ id: 'r100', score: 100 }), + createResult({ id: 'r50', score: 50 }), + createResult({ id: 'r75', score: 75 }), + ]); + + const provider = createApplicationResultProvider(Promise.resolve(application)); + const results = await provider.find('term', defaultOption).toPromise(); + + expect(results).toEqual([ + expectResult('r100'), + expectResult('r75'), + expectResult('r60'), + expectResult('r50'), + ]); + }); + + it('only returns the highest `maxResults` results', async () => { + getAppResultsMock.mockReturnValue([ + createResult({ id: 'r60', score: 60 }), + createResult({ id: 'r100', score: 100 }), + createResult({ id: 'r50', score: 50 }), + createResult({ id: 'r75', score: 75 }), + ]); + + const provider = createApplicationResultProvider(Promise.resolve(application)); + + const options = { + ...defaultOption, + maxResults: 2, + }; + const results = await provider.find('term', options).toPromise(); + + expect(results).toEqual([expectResult('r100'), expectResult('r75')]); + }); + + it('only emits once, even if `application$` emits multiple times', () => { + getTestScheduler().run(({ hot, expectObservable }) => { + const appMap = createAppMap([createApp({ id: 'app1', title: 'App 1' })]); + + application.applications$ = hot('--a---b', { a: appMap, b: appMap }); + + // 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 provider = createApplicationResultProvider(applicationPromise); + + const options = { + ...defaultOption, + aborted$: hot('|'), + }; + + const resultObs = provider.find('term', options); + + expectObservable(resultObs).toBe('--(a|)', { a: [] }); + }); + }); + + it('only emits results until `aborted$` emits', () => { + getTestScheduler().run(({ hot, expectObservable }) => { + const appMap = createAppMap([createApp({ id: 'app1', title: 'App 1' })]); + + application.applications$ = hot('---a', { a: appMap, b: appMap }); + + // 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 provider = createApplicationResultProvider(applicationPromise); + + const options = { + ...defaultOption, + aborted$: hot('-(a|)', { a: undefined }), + }; + + const resultObs = provider.find('term', options); + + expectObservable(resultObs).toBe('-|'); + }); + }); +}); diff --git a/x-pack/plugins/global_search_providers/public/providers/application.ts b/x-pack/plugins/global_search_providers/public/providers/application.ts new file mode 100644 index 000000000000..e40fcef17f73 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/providers/application.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { from } from 'rxjs'; +import { take, map, takeUntil, mergeMap, shareReplay } from 'rxjs/operators'; +import { ApplicationStart } from 'src/core/public'; +import { GlobalSearchResultProvider } from '../../../global_search/public'; +import { getAppResults } from './get_app_results'; + +export const createApplicationResultProvider = ( + applicationPromise: Promise +): GlobalSearchResultProvider => { + const searchableApps$ = from(applicationPromise).pipe( + mergeMap((application) => application.applications$), + map((apps) => + [...apps.values()].filter( + (app) => app.status === 0 && (app.legacy === true || app.chromeless !== true) + ) + ), + shareReplay(1) + ); + + return { + id: 'application', + find: (term, { aborted$, maxResults }) => { + return searchableApps$.pipe( + takeUntil(aborted$), + take(1), + map((apps) => { + const results = getAppResults(term, [...apps.values()]); + return results.sort((a, b) => b.score - a.score).slice(0, maxResults); + }) + ); + }, + }; +}; diff --git a/x-pack/plugins/global_search_providers/public/providers/get_app_results.test.ts b/x-pack/plugins/global_search_providers/public/providers/get_app_results.test.ts new file mode 100644 index 000000000000..1c5a446b8e56 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/providers/get_app_results.test.ts @@ -0,0 +1,119 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AppNavLinkStatus, AppStatus, PublicAppInfo, PublicLegacyAppInfo } from 'src/core/public'; +import { appToResult, getAppResults, scoreApp } from './get_app_results'; + +const createApp = (props: Partial = {}): PublicAppInfo => ({ + id: 'app1', + title: 'App 1', + appRoute: '/app/app1', + legacy: false, + status: AppStatus.accessible, + navLinkStatus: AppNavLinkStatus.visible, + chromeless: false, + ...props, +}); + +const createLegacyApp = (props: Partial = {}): PublicLegacyAppInfo => ({ + id: 'app1', + title: 'App 1', + appUrl: '/app/app1', + legacy: true, + status: AppStatus.accessible, + navLinkStatus: AppNavLinkStatus.visible, + ...props, +}); + +describe('getAppResults', () => { + it('retrieves the matching results', () => { + const apps = [ + createApp({ id: 'dashboard', title: 'dashboard' }), + createApp({ id: 'visualize', title: 'visualize' }), + ]; + + const results = getAppResults('dashboard', apps); + + expect(results.length).toBe(1); + expect(results[0]).toEqual(expect.objectContaining({ id: 'dashboard', score: 100 })); + }); +}); + +describe('scoreApp', () => { + describe('when the term is included in the title', () => { + it('returns 100 if the app title is an exact match', () => { + expect(scoreApp('dashboard', createApp({ title: 'dashboard' }))).toBe(100); + expect(scoreApp('dashboard', createApp({ title: 'DASHBOARD' }))).toBe(100); + expect(scoreApp('DASHBOARD', createApp({ title: 'DASHBOARD' }))).toBe(100); + expect(scoreApp('dashBOARD', createApp({ title: 'DASHboard' }))).toBe(100); + }); + + it('returns 90 if the app title starts with the term', () => { + expect(scoreApp('dash', createApp({ title: 'dashboard' }))).toBe(90); + expect(scoreApp('DASH', createApp({ title: 'dashboard' }))).toBe(90); + }); + + it('returns 75 if the term in included in the app title', () => { + expect(scoreApp('board', createApp({ title: 'dashboard' }))).toBe(75); + expect(scoreApp('shboa', createApp({ title: 'dashboard' }))).toBe(75); + }); + }); + + describe('when the term is not included in the title', () => { + it('returns the levenshtein ratio if superior or equal to 60', () => { + expect(scoreApp('0123456789', createApp({ title: '012345' }))).toBe(60); + expect(scoreApp('--1234567-', createApp({ title: '123456789' }))).toBe(60); + }); + it('returns 0 if the levenshtein ratio is inferior to 60', () => { + expect(scoreApp('0123456789', createApp({ title: '12345' }))).toBe(0); + expect(scoreApp('1-2-3-4-5', createApp({ title: '123456789' }))).toBe(0); + }); + }); + + it('works with legacy apps', () => { + expect(scoreApp('dashboard', createLegacyApp({ title: 'dashboard' }))).toBe(100); + expect(scoreApp('dash', createLegacyApp({ title: 'dashboard' }))).toBe(90); + expect(scoreApp('board', createLegacyApp({ title: 'dashboard' }))).toBe(75); + expect(scoreApp('0123456789', createLegacyApp({ title: '012345' }))).toBe(60); + expect(scoreApp('0123456789', createLegacyApp({ title: '12345' }))).toBe(0); + }); +}); + +describe('appToResult', () => { + it('converts an app to a result', () => { + const app = createApp({ + id: 'foo', + title: 'Foo', + euiIconType: 'fooIcon', + appRoute: '/app/foo', + }); + expect(appToResult(app, 42)).toEqual({ + id: 'foo', + title: 'Foo', + type: 'application', + icon: 'fooIcon', + url: '/app/foo', + score: 42, + }); + }); + + it('converts a legacy app to a result', () => { + const app = createLegacyApp({ + id: 'legacy', + title: 'Legacy', + euiIconType: 'legacyIcon', + appUrl: '/app/legacy', + }); + expect(appToResult(app, 69)).toEqual({ + id: 'legacy', + title: 'Legacy', + type: 'application', + icon: 'legacyIcon', + url: '/app/legacy', + score: 69, + }); + }); +}); diff --git a/x-pack/plugins/global_search_providers/public/providers/get_app_results.ts b/x-pack/plugins/global_search_providers/public/providers/get_app_results.ts new file mode 100644 index 000000000000..1a1939230105 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/providers/get_app_results.ts @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import levenshtein from 'js-levenshtein'; +import { PublicAppInfo, PublicLegacyAppInfo } from 'src/core/public'; +import { GlobalSearchProviderResult } from '../../../global_search/public'; + +export const getAppResults = ( + term: string, + apps: Array +): GlobalSearchProviderResult[] => { + return apps + .map((app) => ({ app, score: scoreApp(term, app) })) + .filter(({ score }) => score > 0) + .map(({ app, score }) => appToResult(app, score)); +}; + +export const scoreApp = (term: string, { title }: PublicAppInfo | PublicLegacyAppInfo): number => { + term = term.toLowerCase(); + title = title.toLowerCase(); + + // shortcuts to avoid calculating the distance when there is an exact match somewhere. + if (title === term) { + return 100; + } + if (title.startsWith(term)) { + return 90; + } + if (title.includes(term)) { + return 75; + } + const length = Math.max(term.length, title.length); + const distance = levenshtein(term, title); + + // maximum lev distance is length, we compute the match ratio (lower distance is better) + const ratio = Math.floor((1 - distance / length) * 100); + if (ratio >= 60) { + return ratio; + } + return 0; +}; + +export const appToResult = ( + app: PublicAppInfo | PublicLegacyAppInfo, + score: number +): GlobalSearchProviderResult => { + return { + id: app.id, + title: app.title, + type: 'application', + icon: app.euiIconType, + url: app.legacy ? app.appUrl : app.appRoute, + score, + }; +}; diff --git a/x-pack/plugins/global_search_providers/public/providers/index.ts b/x-pack/plugins/global_search_providers/public/providers/index.ts new file mode 100644 index 000000000000..d71c30d41d46 --- /dev/null +++ b/x-pack/plugins/global_search_providers/public/providers/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { createApplicationResultProvider } from './application'; diff --git a/x-pack/plugins/ingest_manager/dev_docs/api_integration_tests.md b/x-pack/plugins/ingest_manager/dev_docs/api_integration_tests.md new file mode 100644 index 000000000000..612d94d01a2d --- /dev/null +++ b/x-pack/plugins/ingest_manager/dev_docs/api_integration_tests.md @@ -0,0 +1,113 @@ +# API integration tests + +Many API integration tests for Ingest Manager trigger at some point a connection to the package registry, and retrieval of some packages. If these connections are made to a package registry deployment outside of Kibana CI, these tests can fail at any time for two reasons: +* the deployed registry is temporarily unavailable +* the packages served by the registry do not match the expectation of the code under test + +For that reason, we run a dockerized version of the package registry in Kibana CI. For this to work, our tests must run against a custom test configuration and be kept in a custom directory, `x-pack/test/ingest_manager_api_integration`. + +## How to run the tests locally + +Usually, having the test server and the test runner in two different shells is most efficient, as it is possible to keep the server running and only rerun the test runner as often as needed. To do so, in one shell in the main `kibana` directory, run: +``` +$ export INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 +$ yarn test:ftr:server --config x-pack/test/ingest_manager_api_integration/config.ts +``` + +In another shell in the same directory, run +``` +$ export INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 +$ yarn test:ftr:runner --config x-pack/test/ingest_manager_api_integration/config.ts +``` + +However, it is also possible to **alternatively** run everything in one go, again from the main `kibana` directory: +``` +$ export INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT=12345 +$ yarn test:ftr --config x-pack/test/ingest_manager_api_integration/config.ts +``` +Port `12345` is used as an example here, it can be anything, but the environment variable has to be present for the tests to run at all. + + +## DockerServers service setup + +We use the `DockerServers` service provided by `kbn-test`. The documentation for this functionality can be found here: +https://github.com/elastic/kibana/blob/master/packages/kbn-test/src/functional_test_runner/lib/docker_servers/README.md + +The main configuration for the `DockerServers` service for our tests can be found in `x-pack/test/ingest_manager_api_integration/config.ts`: + +### Specify the arguments to pass to `docker run`: + +``` + const dockerArgs: string[] = [ + '-v', + `${path.join( + path.dirname(__filename), + './apis/fixtures/package_registry_config.yml' + )}:/registry/config.yml`, + '-v', + `${path.join( + path.dirname(__filename), + './apis/fixtures/test_packages' + )}:/registry/packages/test-packages`, + ]; + ``` + + `-v` mounts local paths into the docker image. The first one puts a custom configuration file into the correct place in the docker container, the second one mounts a directory containing additional packages. + +### Specify the docker image to use + +``` +image: 'docker.elastic.co/package-registry/package-registry:kibana-testing-1' +``` + +This image contains the content of `docker.elastic.co/package-registry/package-registry:master` on June 26 2020. The image used here should be stable, i.e. using `master` would defeat the purpose of having a stable set of packages to be used in Kibana CI. + +### Packages available for testing + +The containerized package registry contains a set of packages which should be sufficient to run tests against all parts of Ingest Manager. The list of the packages are logged to the console when the docker container is initialized during testing, or when the container is started manually with + +``` +docker run -p 8080:8080 docker.elastic.co/package-registry/package-registry:kibana-testing-1 +``` + +Additional packages for testing certain corner cases or error conditions can be put into `x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages`. A package `filetest` has been added there as an example. + +## Some DockerServers background + +For the `DockerServers` servers to run correctly in CI, the `INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT` environment variable needs to be under control of the CI environment. The reason behind this: it is possible that several versions of our tests are run in parallel on the same worker in Jenkins, and if we used a hard-coded port number here, those tests would run into port conflicts. (This is also the case for a few other ports, and the setup happens in `vars/kibanaPipeline.groovy`). + +Also, not every developer has `docker` installed on their workstation, so it must be possible to run the testsuite as a whole without `docker`, and preferably this should be the default behaviour. Therefore, our `DockerServers` service is only enabled when `INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT` is set. This needs to be checked in every test like this: + +``` + it('fetches a .json search file', async function () { + if (server.enabled) { + await supertest + .get('/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/search/sample_search.json') + .set('kbn-xsrf', 'xxx') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(200); + } else { + warnAndSkipTest(this, log); + } + }); +``` + +If the tests are skipped in this way, they are marked in the test summary as `pending` and a warning is logged: + +``` +└-: EPM Endpoints + └-> "before all" hook + └-: list + └-> "before all" hook + └-> lists all packages from the registry + └-> "before each" hook: global before each + │ warn disabling tests because DockerServers service is not enabled, set INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT to run them + └-> lists all packages from the registry + └-> "after all" hook +[...] + │ + │1 passing (233ms) + │6 pending + │ + +``` diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index 6cafa3eeef08..29be6d826c1b 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -52,6 +52,7 @@ const onlyNotInCoverageTests = [ require.resolve('../test/endpoint_api_integration_no_ingest/config.ts'), require.resolve('../test/reporting_api_integration/config.js'), require.resolve('../test/functional_embedded/config.ts'), + require.resolve('../test/ingest_manager_api_integration/config.ts'), ]; require('@kbn/plugin-helpers').babelRegister(); diff --git a/x-pack/test/epm_api_integration/apis/file.ts b/x-pack/test/epm_api_integration/apis/file.ts deleted file mode 100644 index 7cf07e2cd99a..000000000000 --- a/x-pack/test/epm_api_integration/apis/file.ts +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import ServerMock from 'mock-http-server'; -import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; - -export default function ({ getService }: FtrProviderContext) { - describe('package file', () => { - const server = new ServerMock({ host: 'localhost', port: 6666 }); - beforeEach(() => { - server.start(() => {}); - }); - afterEach(() => { - server.stop(() => {}); - }); - it('fetches a .png screenshot image', async () => { - server.on({ - method: 'GET', - path: '/package/auditd/2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png', - reply: { - headers: { 'content-type': 'image/png' }, - }, - }); - - const supertest = getService('supertest'); - await supertest - .get( - '/api/ingest_manager/epm/packages/auditd/2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png' - ) - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'image/png') - .expect(200); - }); - - it('fetches an .svg icon image', async () => { - server.on({ - method: 'GET', - path: '/package/auditd/2.0.4/img/icon.svg', - reply: { - headers: { 'content-type': 'image/svg' }, - }, - }); - - const supertest = getService('supertest'); - await supertest - .get('/api/ingest_manager/epm/packages/auditd/2.0.4/img/icon.svg') - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'image/svg'); - }); - - it('fetches an auditbeat .conf rule file', async () => { - server.on({ - method: 'GET', - path: '/package/auditd/2.0.4/auditbeat/rules/sample-rules-linux-32bit.conf', - }); - - const supertest = getService('supertest'); - await supertest - .get( - '/api/ingest_manager/epm/packages/auditd/2.0.4/auditbeat/rules/sample-rules-linux-32bit.conf' - ) - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'application/json; charset=utf-8') - .expect(200); - }); - - it('fetches an auditbeat .yml config file', async () => { - server.on({ - method: 'GET', - path: '/package/auditd/2.0.4/auditbeat/config/config.yml', - reply: { - headers: { 'content-type': 'text/yaml; charset=UTF-8' }, - }, - }); - - const supertest = getService('supertest'); - await supertest - .get('/api/ingest_manager/epm/packages/auditd/2.0.4/auditbeat/config/config.yml') - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'text/yaml; charset=UTF-8') - .expect(200); - }); - - it('fetches a .json kibana visualization file', async () => { - server.on({ - method: 'GET', - path: - '/package/auditd/2.0.4/kibana/visualization/b21e0c70-c252-11e7-8692-232bd1143e8a-ecs.json', - }); - - const supertest = getService('supertest'); - await supertest - .get( - '/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/visualization/b21e0c70-c252-11e7-8692-232bd1143e8a-ecs.json' - ) - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'application/json; charset=utf-8') - .expect(200); - }); - - it('fetches a .json kibana dashboard file', async () => { - server.on({ - method: 'GET', - path: - '/package/auditd/2.0.4/kibana/dashboard/7de391b0-c1ca-11e7-8995-936807a28b16-ecs.json', - }); - - const supertest = getService('supertest'); - await supertest - .get( - '/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/dashboard/7de391b0-c1ca-11e7-8995-936807a28b16-ecs.json' - ) - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'application/json; charset=utf-8') - .expect(200); - }); - - it('fetches an .json index pattern file', async () => { - server.on({ - method: 'GET', - path: '/package/auditd/2.0.4/kibana/index-pattern/auditbeat-*.json', - }); - - const supertest = getService('supertest'); - await supertest - .get('/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/index-pattern/auditbeat-*.json') - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'application/json; charset=utf-8') - .expect(200); - }); - - it('fetches a .json search file', async () => { - server.on({ - method: 'GET', - path: '/package/auditd/2.0.4/kibana/search/0f10c430-c1c3-11e7-8995-936807a28b16-ecs.json', - }); - - const supertest = getService('supertest'); - await supertest - .get( - '/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/search/0f10c430-c1c3-11e7-8995-936807a28b16-ecs.json' - ) - .set('kbn-xsrf', 'xxx') - .expect('Content-Type', 'application/json; charset=utf-8') - .expect(200); - }); - }); -} diff --git a/x-pack/test/epm_api_integration/apis/fixtures/packages/epr/yamlpipeline_1.0.0.tar.gz b/x-pack/test/epm_api_integration/apis/fixtures/packages/epr/yamlpipeline_1.0.0.tar.gz deleted file mode 100644 index ca8695f111d0..000000000000 Binary files a/x-pack/test/epm_api_integration/apis/fixtures/packages/epr/yamlpipeline_1.0.0.tar.gz and /dev/null differ diff --git a/x-pack/test/epm_api_integration/apis/fixtures/packages/package/yamlpipeline_1.0.0 b/x-pack/test/epm_api_integration/apis/fixtures/packages/package/yamlpipeline_1.0.0 deleted file mode 100644 index bf167c583aab..000000000000 --- a/x-pack/test/epm_api_integration/apis/fixtures/packages/package/yamlpipeline_1.0.0 +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "yamlpipeline", - "title": "Yaml Pipeline package", - "version": "1.0.0", - "description": "This package contains a yaml pipeline.\n", - "type": "integration", - "categories": [ - "logs" - ], - "requirement": { - "kibana": {} - }, - "assets": [ - "/package/yamlpipeline-1.0.0/manifest.yml", - "/package/yamlpipeline-1.0.0/dataset/log/manifest.yml", - "/package/yamlpipeline-1.0.0/dataset/log/elasticsearch/ingest-pipeline/pipeline-entry.yml", - "/package/yamlpipeline-1.0.0/dataset/log/elasticsearch/ingest-pipeline/pipeline-json.yml", - "/package/yamlpipeline-1.0.0/dataset/log/elasticsearch/ingest-pipeline/pipeline-plaintext.yml" - ], - "format_version": "1.0.0", - "datasets": [ - { - "title": "Log Yaml pipeline", - "name": "log", - "release": "", - "type": "logs", - "ingest_pipeline": "" - } - ], - "download": "/epr/yamlpipeline/yamlpipeline-1.0.0.tar.gz", - "path": "/package/yamlpipeline-1.0.0" -} \ No newline at end of file diff --git a/x-pack/test/epm_api_integration/apis/list.ts b/x-pack/test/epm_api_integration/apis/list.ts deleted file mode 100644 index cc486fe1c5a4..000000000000 --- a/x-pack/test/epm_api_integration/apis/list.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import expect from '@kbn/expect'; -import ServerMock from 'mock-http-server'; -import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; - -export default function ({ getService }: FtrProviderContext) { - describe('list', () => { - const server = new ServerMock({ host: 'localhost', port: 6666 }); - beforeEach(() => { - server.start(() => {}); - }); - afterEach(() => { - server.stop(() => {}); - }); - it('lists all packages from the registry', async () => { - const searchResponse = [ - { - description: 'First integration package', - download: '/package/first-1.0.1.tar.gz', - name: 'first', - title: 'First', - type: 'integration', - version: '1.0.1', - }, - { - description: 'Second integration package', - download: '/package/second-2.0.4.tar.gz', - icons: [ - { - src: '/package/second-2.0.4/img/icon.svg', - type: 'image/svg+xml', - }, - ], - name: 'second', - title: 'Second', - type: 'integration', - version: '2.0.4', - }, - ]; - server.on({ - method: 'GET', - path: '/search', - reply: { - status: 200, - headers: { 'content-type': 'application/json' }, - body: JSON.stringify(searchResponse), - }, - }); - - const supertest = getService('supertest'); - const fetchPackageList = async () => { - const response = await supertest - .get('/api/ingest_manager/epm/packages') - .set('kbn-xsrf', 'xxx') - .expect(200); - return response.body; - }; - - const listResponse = await fetchPackageList(); - expect(listResponse.response.length).to.be(2); - expect(listResponse.response[0]).to.eql({ ...searchResponse[0], status: 'not_installed' }); - expect(listResponse.response[1]).to.eql({ ...searchResponse[1], status: 'not_installed' }); - }); - - it('sorts the packages even if the registry sends them unsorted', async () => { - const searchResponse = [ - { - description: 'BBB integration package', - download: '/package/bbb-1.0.1.tar.gz', - name: 'bbb', - title: 'BBB', - type: 'integration', - version: '1.0.1', - }, - { - description: 'CCC integration package', - download: '/package/ccc-2.0.4.tar.gz', - name: 'ccc', - title: 'CCC', - type: 'integration', - version: '2.0.4', - }, - { - description: 'AAA integration package', - download: '/package/aaa-0.0.1.tar.gz', - name: 'aaa', - title: 'AAA', - type: 'integration', - version: '0.0.1', - }, - ]; - server.on({ - method: 'GET', - path: '/search', - reply: { - status: 200, - headers: { 'content-type': 'application/json' }, - body: JSON.stringify(searchResponse), - }, - }); - - const supertest = getService('supertest'); - const fetchPackageList = async () => { - const response = await supertest - .get('/api/ingest_manager/epm/packages') - .set('kbn-xsrf', 'xxx') - .expect(200); - return response.body; - }; - - const listResponse = await fetchPackageList(); - - expect(listResponse.response.length).to.be(3); - expect(listResponse.response[0].name).to.eql('aaa'); - expect(listResponse.response[1].name).to.eql('bbb'); - expect(listResponse.response[2].name).to.eql('ccc'); - }); - }); -} diff --git a/x-pack/test/epm_api_integration/config.ts b/x-pack/test/epm_api_integration/config.ts deleted file mode 100644 index 6b08c7ec5795..000000000000 --- a/x-pack/test/epm_api_integration/config.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; - -export default async function ({ readConfigFile }: FtrConfigProviderContext) { - const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts')); - - return { - testFiles: [require.resolve('./apis')], - servers: xPackAPITestsConfig.get('servers'), - services: { - supertest: xPackAPITestsConfig.get('services.supertest'), - es: xPackAPITestsConfig.get('services.es'), - }, - junit: { - reportName: 'X-Pack EPM API Integration Tests', - }, - - esTestCluster: { - ...xPackAPITestsConfig.get('esTestCluster'), - }, - - kbnTestServer: { - ...xPackAPITestsConfig.get('kbnTestServer'), - serverArgs: [ - ...xPackAPITestsConfig.get('kbnTestServer.serverArgs'), - '--xpack.ingestManager.epm.registryUrl=http://localhost:6666', - ], - }, - }; -} diff --git a/x-pack/test/ingest_manager_api_integration/apis/file.ts b/x-pack/test/ingest_manager_api_integration/apis/file.ts new file mode 100644 index 000000000000..33eeda1ee274 --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/file.ts @@ -0,0 +1,96 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; +import { warnAndSkipTest } from '../helpers'; + +export default function ({ getService }: FtrProviderContext) { + const log = getService('log'); + const supertest = getService('supertest'); + const dockerServers = getService('dockerServers'); + + const server = dockerServers.get('registry'); + describe('package file', () => { + it('fetches a .png screenshot image', async function () { + if (server.enabled) { + await supertest + .get( + '/api/ingest_manager/epm/packages/filetest/0.1.0/img/screenshots/metricbeat_dashboard.png' + ) + .set('kbn-xsrf', 'xxx') + .expect('Content-Type', 'image/png') + .expect(200); + } else { + warnAndSkipTest(this, log); + } + }); + + it('fetches an .svg icon image', async function () { + if (server.enabled) { + await supertest + .get('/api/ingest_manager/epm/packages/filetest/0.1.0/img/logo.svg') + .set('kbn-xsrf', 'xxx') + .expect('Content-Type', 'image/svg+xml') + .expect(200); + } else { + warnAndSkipTest(this, log); + } + }); + + it('fetches a .json kibana visualization file', async function () { + if (server.enabled) { + await supertest + .get( + '/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/visualization/sample_visualization.json' + ) + .set('kbn-xsrf', 'xxx') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(200); + } else { + warnAndSkipTest(this, log); + } + }); + + it('fetches a .json kibana dashboard file', async function () { + if (server.enabled) { + await supertest + .get( + '/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/dashboard/sample_dashboard.json' + ) + .set('kbn-xsrf', 'xxx') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(200); + } else { + warnAndSkipTest(this, log); + } + }); + + it('fetches a .json search file', async function () { + if (server.enabled) { + await supertest + .get('/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/search/sample_search.json') + .set('kbn-xsrf', 'xxx') + .expect('Content-Type', 'application/json; charset=utf-8') + .expect(200); + } else { + warnAndSkipTest(this, log); + } + }); + }); + + // Disabled for now as we don't serve prebuilt index patterns in current packages. + // it('fetches an .json index pattern file', async function () { + // if (server.enabled) { + // await supertest + // .get('/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/index-pattern/sample-*.json') + // .set('kbn-xsrf', 'xxx') + // .expect('Content-Type', 'application/json; charset=utf-8') + // .expect(200); + // } else { + // warnAndSkipTest(this, log); + // } + // }); +} diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/package_registry_config.yml b/x-pack/test/ingest_manager_api_integration/apis/fixtures/package_registry_config.yml new file mode 100644 index 000000000000..0060e247827d --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/package_registry_config.yml @@ -0,0 +1,3 @@ + package_paths: + - /registry/packages/package-storage + - /registry/packages/test-packages \ No newline at end of file diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/docs/README.md b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/docs/README.md new file mode 100644 index 000000000000..0d19532bae2d --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/docs/README.md @@ -0,0 +1,5 @@ +# filetest + +This package contains randomly collected files from other packages to be used in API integration tests. + +It also serves as an example how to serve a package from the fixtures directory with the package registry docker container. For this, also see the `x-pack/test/ingest_manager_api_integration/config.ts` how the `test_packages` directory is mounted into the docker container, and `x-pack/test/ingest_manager_api_integration/apis/fixtures/package_registry_config.yml` how to pass the directory to the registry. \ No newline at end of file diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/img/logo.svg b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/img/logo.svg new file mode 100644 index 000000000000..15b49bcf28ae --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/img/logo.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/img/screenshots/metricbeat_dashboard.png b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/img/screenshots/metricbeat_dashboard.png new file mode 100644 index 000000000000..76d414b86c4a Binary files /dev/null and b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/img/screenshots/metricbeat_dashboard.png differ diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/dashboard/sample_dashboard.json b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/dashboard/sample_dashboard.json new file mode 100644 index 000000000000..0370f58706a6 --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/dashboard/sample_dashboard.json @@ -0,0 +1,38 @@ +{ + "attributes": { + "description": "Logs Kafka integration dashboard", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[],\"highlightAll\":true,\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"version\":true}" + }, + "optionsJSON": "{\"darkTheme\":false}", + "panelsJSON": "[{\"embeddableConfig\":{},\"gridData\":{\"h\":12,\"i\":\"1\",\"w\":24,\"x\":0,\"y\":0},\"panelIndex\":\"1\",\"panelRefName\":\"panel_0\",\"version\":\"7.3.0\"},{\"embeddableConfig\":{\"columns\":[\"kafka.log.class\",\"kafka.log.trace.class\",\"kafka.log.trace.full\"],\"sort\":[\"@timestamp\",\"desc\"]},\"gridData\":{\"h\":12,\"i\":\"2\",\"w\":24,\"x\":24,\"y\":0},\"panelIndex\":\"2\",\"panelRefName\":\"panel_1\",\"version\":\"7.3.0\"},{\"embeddableConfig\":{\"columns\":[\"log.level\",\"kafka.log.component\",\"message\"],\"sort\":[\"@timestamp\",\"desc\"]},\"gridData\":{\"h\":20,\"i\":\"3\",\"w\":48,\"x\":0,\"y\":20},\"panelIndex\":\"3\",\"panelRefName\":\"panel_2\",\"version\":\"7.3.0\"},{\"embeddableConfig\":{},\"gridData\":{\"h\":8,\"i\":\"4\",\"w\":48,\"x\":0,\"y\":12},\"panelIndex\":\"4\",\"panelRefName\":\"panel_3\",\"version\":\"7.3.0\"}]", + "timeRestore": false, + "title": "[Logs Kafka] Overview ECS", + "version": 1 + }, + "id": "sample_dashboard", + "references": [ + { + "id": "number-of-kafka-stracktraces-by-class-ecs", + "name": "panel_0", + "type": "visualization" + }, + { + "id": "Kafka stacktraces-ecs", + "name": "panel_1", + "type": "search" + }, + { + "id": "sample_search", + "name": "panel_2", + "type": "search" + }, + { + "id": "sample_visualization", + "name": "panel_3", + "type": "visualization" + } + ], + "type": "dashboard" +} \ No newline at end of file diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/search/sample_search.json b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/search/sample_search.json new file mode 100644 index 000000000000..1b34746cec89 --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/search/sample_search.json @@ -0,0 +1,36 @@ +{ + "attributes": { + "columns": [ + "log.level", + "kafka.log.component", + "message" + ], + "description": "", + "hits": 0, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[{\"$state\":{\"store\":\"appState\"},\"meta\":{\"alias\":null,\"disabled\":false,\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index\",\"key\":\"dataset.name\",\"negate\":false,\"params\":{\"query\":\"kafka.log\",\"type\":\"phrase\"},\"type\":\"phrase\",\"value\":\"log\"},\"query\":{\"match\":{\"dataset.name\":{\"query\":\"kafka.log\",\"type\":\"phrase\"}}}}],\"highlightAll\":true,\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\",\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"version\":true}" + }, + "sort": [ + [ + "@timestamp", + "desc" + ] + ], + "title": "All logs [Logs Kafka] ECS", + "version": 1 + }, + "id": "All Kafka logs-ecs", + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "type": "index-pattern" + } + ], + "type": "search" +} \ No newline at end of file diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/visualization/sample_visualization.json b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/visualization/sample_visualization.json new file mode 100644 index 000000000000..5d5162436e6d --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/kibana/visualization/sample_visualization.json @@ -0,0 +1,22 @@ +{ + "attributes": { + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[]}" + }, + "savedSearchRefName": "search_0", + "title": "Log levels over time [Logs Kafka] ECS", + "uiStateJSON": "{}", + "version": 1, + "visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"extended_bounds\":{},\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1},\"schema\":\"segment\",\"type\":\"date_histogram\"},{\"enabled\":true,\"id\":\"3\",\"params\":{\"customLabel\":\"Log Level\",\"field\":\"log.level\",\"order\":\"desc\",\"orderBy\":\"1\",\"size\":5},\"schema\":\"group\",\"type\":\"terms\"}],\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"labels\":{\"show\":true,\"truncate\":100},\"position\":\"bottom\",\"scale\":{\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"@timestamp per day\"},\"type\":\"category\"}],\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"legendPosition\":\"right\",\"seriesParams\":[{\"data\":{\"id\":\"1\",\"label\":\"Count\"},\"drawLinesBetweenPoints\":true,\"mode\":\"stacked\",\"show\":\"true\",\"showCircles\":true,\"type\":\"histogram\",\"valueAxis\":\"ValueAxis-1\"}],\"times\":[],\"type\":\"histogram\",\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"labels\":{\"filter\":false,\"rotate\":0,\"show\":true,\"truncate\":100},\"name\":\"LeftAxis-1\",\"position\":\"left\",\"scale\":{\"mode\":\"normal\",\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"Count\"},\"type\":\"value\"}]},\"title\":\"Log levels over time [Logs Kafka] ECS\",\"type\":\"histogram\"}" + }, + "id": "sample_visualization", + "references": [ + { + "id": "All Kafka logs-ecs", + "name": "search_0", + "type": "search" + } + ], + "type": "visualization" +} \ No newline at end of file diff --git a/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/manifest.yml b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/manifest.yml new file mode 100644 index 000000000000..ec3586689bec --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/filetest/0.1.0/manifest.yml @@ -0,0 +1,30 @@ +format_version: 1.0.0 +name: filetest +title: For File Tests +description: This is a package. +version: 0.1.0 +categories: [] +# Options are experimental, beta, ga +release: beta +# The package type. The options for now are [integration, solution], more type might be added in the future. +# The default type is integration and will be set if empty. +type: integration +license: basic +# This package can be removed +removable: true + +requirement: + elasticsearch: + versions: ">7.7.0" + kibana: + versions: ">7.7.0" + +screenshots: +- src: "/img/screenshots/metricbeat_dashboard.png" + title: "metricbeat dashboard" + size: "1855x949" + type: "image/png" +icons: + - src: "/img/logo.svg" + size: "16x16" + type: "image/svg+xml" \ No newline at end of file diff --git a/x-pack/test/epm_api_integration/apis/ilm.ts b/x-pack/test/ingest_manager_api_integration/apis/ilm.ts similarity index 100% rename from x-pack/test/epm_api_integration/apis/ilm.ts rename to x-pack/test/ingest_manager_api_integration/apis/ilm.ts diff --git a/x-pack/test/epm_api_integration/apis/index.js b/x-pack/test/ingest_manager_api_integration/apis/index.js similarity index 90% rename from x-pack/test/epm_api_integration/apis/index.js rename to x-pack/test/ingest_manager_api_integration/apis/index.js index 3dc4624d15cf..ef8880f86078 100644 --- a/x-pack/test/epm_api_integration/apis/index.js +++ b/x-pack/test/ingest_manager_api_integration/apis/index.js @@ -9,7 +9,7 @@ export default function ({ loadTestFile }) { this.tags('ciGroup7'); loadTestFile(require.resolve('./list')); loadTestFile(require.resolve('./file')); - loadTestFile(require.resolve('./template')); + //loadTestFile(require.resolve('./template')); loadTestFile(require.resolve('./ilm')); }); } diff --git a/x-pack/test/ingest_manager_api_integration/apis/list.ts b/x-pack/test/ingest_manager_api_integration/apis/list.ts new file mode 100644 index 000000000000..200358cb6f8f --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/apis/list.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; +import { warnAndSkipTest } from '../helpers'; + +export default function ({ getService }: FtrProviderContext) { + const log = getService('log'); + const supertest = getService('supertest'); + const dockerServers = getService('dockerServers'); + + const server = dockerServers.get('registry'); + // use function () {} and not () => {} here + // because `this` has to point to the Mocha context + // see https://mochajs.org/#arrow-functions + + describe('list', async function () { + it('lists all packages from the registry', async function () { + if (server.enabled) { + const fetchPackageList = async () => { + const response = await supertest + .get('/api/ingest_manager/epm/packages') + .set('kbn-xsrf', 'xxx') + .expect(200); + return response.body; + }; + const listResponse = await fetchPackageList(); + expect(listResponse.response.length).to.be(11); + } else { + warnAndSkipTest(this, log); + } + }); + }); +} diff --git a/x-pack/test/epm_api_integration/apis/mock_http_server.d.ts b/x-pack/test/ingest_manager_api_integration/apis/mock_http_server.d.ts similarity index 100% rename from x-pack/test/epm_api_integration/apis/mock_http_server.d.ts rename to x-pack/test/ingest_manager_api_integration/apis/mock_http_server.d.ts diff --git a/x-pack/test/epm_api_integration/apis/template.ts b/x-pack/test/ingest_manager_api_integration/apis/template.ts similarity index 100% rename from x-pack/test/epm_api_integration/apis/template.ts rename to x-pack/test/ingest_manager_api_integration/apis/template.ts diff --git a/x-pack/test/ingest_manager_api_integration/config.ts b/x-pack/test/ingest_manager_api_integration/config.ts new file mode 100644 index 000000000000..bbef12463ed0 --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/config.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import path from 'path'; + +import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; +import { defineDockerServersConfig } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts')); + + const registryPort: string | undefined = process.env.INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT; + + // mount the config file for the package registry as well as + // the directory containing additional packages into the container + const dockerArgs: string[] = [ + '-v', + `${path.join( + path.dirname(__filename), + './apis/fixtures/package_registry_config.yml' + )}:/registry/config.yml`, + '-v', + `${path.join( + path.dirname(__filename), + './apis/fixtures/test_packages' + )}:/registry/packages/test-packages`, + ]; + + return { + testFiles: [require.resolve('./apis')], + servers: xPackAPITestsConfig.get('servers'), + dockerServers: defineDockerServersConfig({ + registry: { + enabled: !!registryPort, + image: 'docker.elastic.co/package-registry/package-registry:kibana-testing-1', + portInContainer: 8080, + port: registryPort, + args: dockerArgs, + waitForLogLine: 'package manifests loaded', + }, + }), + services: { + supertest: xPackAPITestsConfig.get('services.supertest'), + es: xPackAPITestsConfig.get('services.es'), + }, + junit: { + reportName: 'X-Pack EPM API Integration Tests', + }, + + esTestCluster: { + ...xPackAPITestsConfig.get('esTestCluster'), + }, + + kbnTestServer: { + ...xPackAPITestsConfig.get('kbnTestServer'), + serverArgs: [ + ...xPackAPITestsConfig.get('kbnTestServer.serverArgs'), + ...(registryPort + ? [`--xpack.ingestManager.epm.registryUrl=http://localhost:${registryPort}`] + : []), + ], + }, + }; +} diff --git a/x-pack/test/ingest_manager_api_integration/helpers.ts b/x-pack/test/ingest_manager_api_integration/helpers.ts new file mode 100644 index 000000000000..121630249621 --- /dev/null +++ b/x-pack/test/ingest_manager_api_integration/helpers.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Context } from 'mocha'; +import { ToolingLog } from '@kbn/dev-utils'; + +export function warnAndSkipTest(mochaContext: Context, log: ToolingLog) { + log.warning( + 'disabling tests because DockerServers service is not enabled, set INGEST_MANAGEMENT_PACKAGE_REGISTRY_PORT to run them' + ); + mochaContext.skip(); +} diff --git a/x-pack/typings/js_levenshtein.d.ts b/x-pack/typings/js_levenshtein.d.ts new file mode 100644 index 000000000000..812bf24bf3dd --- /dev/null +++ b/x-pack/typings/js_levenshtein.d.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +declare module 'js-levenshtein' { + const levenshtein: (a: string, b: string) => number; + export = levenshtein; +} diff --git a/yarn.lock b/yarn.lock index 0a7899e4ac10..8b13f3bdacb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19523,6 +19523,11 @@ js-levenshtein@^1.1.3: resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.3.tgz#3ef627df48ec8cf24bacf05c0f184ff30ef413c5" integrity sha512-/812MXr9RBtMObviZ8gQBhHO8MOrGj8HlEE+4ccMTElNA/6I3u39u+bhny55Lk921yn44nSZFy9naNLElL5wgQ== +js-levenshtein@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== + js-search@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/js-search/-/js-search-1.4.3.tgz#23a86d7e064ca53a473930edc48615b6b1c1954a"