From f684e18124c63c186fde16f5c73c9c9a6ca39177 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 20 Jul 2020 09:30:41 +0200 Subject: [PATCH 1/4] use KibanaClient interface instead of Client --- ...-plugin-core-server.httpservicesetup.registeronpostauth.md | 2 +- ...a-plugin-core-server.httpservicesetup.registeronpreauth.md | 2 +- docs/development/core/server/kibana-plugin-core-server.md | 2 +- .../server/kibana-plugin-core-server.onpreresponsetoolkit.md | 2 +- src/core/server/elasticsearch/client/types.ts | 4 ++-- src/core/server/server.api.md | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpostauth.md b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpostauth.md index eff53b7b75fa5..41b82f428948a 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpostauth.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpostauth.md @@ -14,5 +14,5 @@ registerOnPostAuth: (handler: OnPostAuthHandler) => void; ## Remarks -The auth state is available at stage via http.auth.get(..) Can register any number of registerOnPreRouting, which are called in sequence (from the first registered to the last). See [OnPostAuthHandler](./kibana-plugin-core-server.onpostauthhandler.md). +The auth state is available at stage via http.auth.get(..) Can register any number of registerOnPostAuth, which are called in sequence (from the first registered to the last). See [OnPostAuthHandler](./kibana-plugin-core-server.onpostauthhandler.md). diff --git a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpreauth.md b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpreauth.md index ce4cacb1c8749..57b1833df5e03 100644 --- a/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpreauth.md +++ b/docs/development/core/server/kibana-plugin-core-server.httpservicesetup.registeronpreauth.md @@ -14,5 +14,5 @@ registerOnPreAuth: (handler: OnPreAuthHandler) => void; ## Remarks -Can register any number of registerOnPostAuth, which are called in sequence (from the first registered to the last). See [OnPreRoutingHandler](./kibana-plugin-core-server.onpreroutinghandler.md). +Can register any number of registerOnPreAuth, which are called in sequence (from the first registered to the last). See [OnPreAuthHandler](./kibana-plugin-core-server.onpreauthhandler.md). diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md index a665327454c1a..61ffc532f0de5 100644 --- a/docs/development/core/server/kibana-plugin-core-server.md +++ b/docs/development/core/server/kibana-plugin-core-server.md @@ -122,7 +122,7 @@ The plugin integrates with the core system via lifecycle events: `setup` | [OnPreAuthToolkit](./kibana-plugin-core-server.onpreauthtoolkit.md) | A tool set defining an outcome of OnPreAuth interceptor for incoming request. | | [OnPreResponseExtensions](./kibana-plugin-core-server.onpreresponseextensions.md) | Additional data to extend a response. | | [OnPreResponseInfo](./kibana-plugin-core-server.onpreresponseinfo.md) | Response status code. | -| [OnPreResponseToolkit](./kibana-plugin-core-server.onpreresponsetoolkit.md) | A tool set defining an outcome of OnPreRouting interceptor for incoming request. | +| [OnPreResponseToolkit](./kibana-plugin-core-server.onpreresponsetoolkit.md) | A tool set defining an outcome of OnPreResponse interceptor for incoming request. | | [OnPreRoutingToolkit](./kibana-plugin-core-server.onpreroutingtoolkit.md) | A tool set defining an outcome of OnPreRouting interceptor for incoming request. | | [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) | Regroups metrics gathered by all the collectors. This contains metrics about the os/runtime, the kibana process and the http server. | | [OpsOsMetrics](./kibana-plugin-core-server.opsosmetrics.md) | OS related metrics | diff --git a/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md b/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md index 306c375ba4a3c..44da09d0cc68e 100644 --- a/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md +++ b/docs/development/core/server/kibana-plugin-core-server.onpreresponsetoolkit.md @@ -4,7 +4,7 @@ ## OnPreResponseToolkit interface -A tool set defining an outcome of OnPreRouting interceptor for incoming request. +A tool set defining an outcome of OnPreResponse interceptor for incoming request. Signature: diff --git a/src/core/server/elasticsearch/client/types.ts b/src/core/server/elasticsearch/client/types.ts index 934120c330e92..e0bf419b12ccd 100644 --- a/src/core/server/elasticsearch/client/types.ts +++ b/src/core/server/elasticsearch/client/types.ts @@ -17,7 +17,7 @@ * under the License. */ -import type { Client } from '@elastic/elasticsearch'; +import type { KibanaClient } from '@elastic/elasticsearch/api/kibana'; import type { ApiResponse, TransportRequestOptions, @@ -30,7 +30,7 @@ import type { * @public */ export type ElasticsearchClient = Omit< - Client, + KibanaClient, 'connectionPool' | 'transport' | 'serializer' | 'extend' | 'helpers' | 'child' | 'close' > & { transport: { diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index a0e16602ba4bf..8cd8e475f12cf 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -22,7 +22,6 @@ import { CatTasksParams } from 'elasticsearch'; import { CatThreadPoolParams } from 'elasticsearch'; import { ClearScrollParams } from 'elasticsearch'; import { Client } from 'elasticsearch'; -import { Client as Client_2 } from '@elastic/elasticsearch'; import { ClientOptions } from '@elastic/elasticsearch'; import { ClusterAllocationExplainParams } from 'elasticsearch'; import { ClusterGetSettingsParams } from 'elasticsearch'; @@ -93,6 +92,7 @@ import { IngestDeletePipelineParams } from 'elasticsearch'; import { IngestGetPipelineParams } from 'elasticsearch'; import { IngestPutPipelineParams } from 'elasticsearch'; import { IngestSimulateParams } from 'elasticsearch'; +import { KibanaClient } from '@elastic/elasticsearch/api/kibana'; import { KibanaConfigType } from 'src/core/server/kibana_config'; import { MGetParams } from 'elasticsearch'; import { MGetResponse } from 'elasticsearch'; From 7f12fb915805f90404413aa63cb3f0b231cff3c3 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 20 Jul 2020 15:21:59 +0200 Subject: [PATCH 2/4] add back helpers to ElasticsearchClient interface --- src/core/server/elasticsearch/client/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/server/elasticsearch/client/types.ts b/src/core/server/elasticsearch/client/types.ts index e0bf419b12ccd..442320b74f384 100644 --- a/src/core/server/elasticsearch/client/types.ts +++ b/src/core/server/elasticsearch/client/types.ts @@ -31,7 +31,7 @@ import type { */ export type ElasticsearchClient = Omit< KibanaClient, - 'connectionPool' | 'transport' | 'serializer' | 'extend' | 'helpers' | 'child' | 'close' + 'connectionPool' | 'transport' | 'serializer' | 'extend' | 'child' | 'close' > & { transport: { request( From 0e13b4e6b40094943b885d3050306593f7ae7f27 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 20 Jul 2020 21:50:54 +0200 Subject: [PATCH 3/4] use TransportRequestPromise for transport.request --- src/core/server/elasticsearch/client/types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/server/elasticsearch/client/types.ts b/src/core/server/elasticsearch/client/types.ts index 442320b74f384..7ce998aab7669 100644 --- a/src/core/server/elasticsearch/client/types.ts +++ b/src/core/server/elasticsearch/client/types.ts @@ -22,6 +22,7 @@ import type { ApiResponse, TransportRequestOptions, TransportRequestParams, + TransportRequestPromise, } from '@elastic/elasticsearch/lib/Transport'; /** @@ -37,6 +38,6 @@ export type ElasticsearchClient = Omit< request( params: TransportRequestParams, options?: TransportRequestOptions - ): Promise; + ): TransportRequestPromise; }; }; From 9bc7116f8d46c57ecfe1c12aaa72e1540474795b Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Tue, 21 Jul 2020 07:49:29 +0200 Subject: [PATCH 4/4] update generated doc --- src/core/server/server.api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md index 8cd8e475f12cf..4b6bcbc8ad7a0 100644 --- a/src/core/server/server.api.md +++ b/src/core/server/server.api.md @@ -143,6 +143,7 @@ import { TasksListParams } from 'elasticsearch'; import { TermvectorsParams } from 'elasticsearch'; import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport'; import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport'; +import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport'; import { Type } from '@kbn/config-schema'; import { TypeOf } from '@kbn/config-schema'; import { UpdateDocumentByQueryParams } from 'elasticsearch';