diff --git a/docs/development/core/public/kibana-plugin-public.chromedoctitle.md b/docs/development/core/public/kibana-plugin-public.chromedoctitle.md
index 3c6cfab486288..feb3b3ab966ef 100644
--- a/docs/development/core/public/kibana-plugin-public.chromedoctitle.md
+++ b/docs/development/core/public/kibana-plugin-public.chromedoctitle.md
@@ -12,13 +12,6 @@ APIs for accessing and updating the document title.
export interface ChromeDocTitle
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [change(newTitle)](./kibana-plugin-public.chromedoctitle.change.md) | Changes the current document title. |
-| [reset()](./kibana-plugin-public.chromedoctitle.reset.md) | Resets the document title to it's initial value. (meaning the one present in the title meta at application load.) |
-
## Example 1
How to change the title of the document
@@ -37,3 +30,10 @@ chrome.docTitle.reset()
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [change(newTitle)](./kibana-plugin-public.chromedoctitle.change.md) | Changes the current document title. |
+| [reset()](./kibana-plugin-public.chromedoctitle.reset.md) | Resets the document title to it's initial value. (meaning the one present in the title meta at application load.) |
+
diff --git a/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md b/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md
index a34db9bb33d9d..30b9a6869d1ff 100644
--- a/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md
+++ b/docs/development/core/public/kibana-plugin-public.chromenavcontrols.md
@@ -12,13 +12,6 @@
export interface ChromeNavControls
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [registerLeft(navControl)](./kibana-plugin-public.chromenavcontrols.registerleft.md) | Register a nav control to be presented on the left side of the chrome header. |
-| [registerRight(navControl)](./kibana-plugin-public.chromenavcontrols.registerright.md) | Register a nav control to be presented on the right side of the chrome header. |
-
## Example
Register a left-side nav control rendered with React.
@@ -33,3 +26,10 @@ chrome.navControls.registerLeft({
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [registerLeft(navControl)](./kibana-plugin-public.chromenavcontrols.registerleft.md) | Register a nav control to be presented on the left side of the chrome header. |
+| [registerRight(navControl)](./kibana-plugin-public.chromenavcontrols.registerright.md) | Register a nav control to be presented on the right side of the chrome header. |
+
diff --git a/docs/development/core/public/kibana-plugin-public.chromestart.md b/docs/development/core/public/kibana-plugin-public.chromestart.md
index d5d99f3d5be65..4e44e5bf05074 100644
--- a/docs/development/core/public/kibana-plugin-public.chromestart.md
+++ b/docs/development/core/public/kibana-plugin-public.chromestart.md
@@ -12,6 +12,31 @@ ChromeStart allows plugins to customize the global chrome header UI and enrich t
export interface ChromeStart
```
+## Remarks
+
+While ChromeStart exposes many APIs, they should be used sparingly and the developer should understand how they affect other plugins and applications.
+
+## Example 1
+
+How to add a recently accessed item to the sidebar:
+
+```ts
+core.chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234');
+
+```
+
+## Example 2
+
+How to set the help dropdown extension:
+
+```tsx
+core.chrome.setHelpExtension(elem => {
+ ReactDOM.render(, elem);
+ return () => ReactDOM.unmountComponentAtNode(elem);
+});
+
+```
+
## Properties
| Property | Type | Description |
@@ -43,28 +68,3 @@ export interface ChromeStart
| [setIsCollapsed(isCollapsed)](./kibana-plugin-public.chromestart.setiscollapsed.md) | Set the collapsed state of the chrome navigation. |
| [setIsVisible(isVisible)](./kibana-plugin-public.chromestart.setisvisible.md) | Set the temporary visibility for the chrome. This does nothing if the chrome is hidden by default and should be used to hide the chrome for things like full-screen modes with an exit button. |
-## Remarks
-
-While ChromeStart exposes many APIs, they should be used sparingly and the developer should understand how they affect other plugins and applications.
-
-## Example 1
-
-How to add a recently accessed item to the sidebar:
-
-```ts
-core.chrome.recentlyAccessed.add('/app/map/1234', 'Map 1234', '1234');
-
-```
-
-## Example 2
-
-How to set the help dropdown extension:
-
-```tsx
-core.chrome.setHelpExtension(elem => {
- ReactDOM.render(, elem);
- return () => ReactDOM.unmountComponentAtNode(elem);
-});
-
-```
-
diff --git a/docs/development/core/public/kibana-plugin-public.contextsetup.md b/docs/development/core/public/kibana-plugin-public.contextsetup.md
index a006fa7205ca6..d4399b6ba70c4 100644
--- a/docs/development/core/public/kibana-plugin-public.contextsetup.md
+++ b/docs/development/core/public/kibana-plugin-public.contextsetup.md
@@ -12,12 +12,6 @@ An object that handles registration of context providers and configuring handler
export interface ContextSetup
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [createContextContainer()](./kibana-plugin-public.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-public.icontextcontainer.md) for a service owner. |
-
## Remarks
A [IContextContainer](./kibana-plugin-public.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares.
@@ -136,3 +130,9 @@ class VizRenderingPlugin {
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [createContextContainer()](./kibana-plugin-public.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-public.icontextcontainer.md) for a service owner. |
+
diff --git a/docs/development/core/public/kibana-plugin-public.icontextcontainer.md b/docs/development/core/public/kibana-plugin-public.icontextcontainer.md
index f16c07b3d7906..7a21df6b93bb5 100644
--- a/docs/development/core/public/kibana-plugin-public.icontextcontainer.md
+++ b/docs/development/core/public/kibana-plugin-public.icontextcontainer.md
@@ -12,13 +12,6 @@ An object that handles registration of context providers and configuring handler
export interface IContextContainer>
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-public.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. |
-| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-public.icontextcontainer.registercontext.md) | Register a new context provider. |
-
## Remarks
A [IContextContainer](./kibana-plugin-public.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares.
@@ -78,3 +71,10 @@ class MyPlugin {
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-public.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. |
+| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-public.icontextcontainer.registercontext.md) | Register a new context provider. |
+
diff --git a/docs/development/core/public/kibana-plugin-public.legacycoresetup.md b/docs/development/core/public/kibana-plugin-public.legacycoresetup.md
index a753300437c1c..803c96cd0b22c 100644
--- a/docs/development/core/public/kibana-plugin-public.legacycoresetup.md
+++ b/docs/development/core/public/kibana-plugin-public.legacycoresetup.md
@@ -16,13 +16,13 @@ Setup interface exposed to the legacy platform via the `ui/new_platform` module.
export interface LegacyCoreSetup extends CoreSetup
```
+## Remarks
+
+Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreSetup](./kibana-plugin-public.coresetup.md), unsupported methods will throw exceptions when called.
+
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [injectedMetadata](./kibana-plugin-public.legacycoresetup.injectedmetadata.md) | InjectedMetadataSetup
| |
-## Remarks
-
-Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreSetup](./kibana-plugin-public.coresetup.md), unsupported methods will throw exceptions when called.
-
diff --git a/docs/development/core/public/kibana-plugin-public.legacycorestart.md b/docs/development/core/public/kibana-plugin-public.legacycorestart.md
index 775c3fb1ffe3d..438a3d6110776 100644
--- a/docs/development/core/public/kibana-plugin-public.legacycorestart.md
+++ b/docs/development/core/public/kibana-plugin-public.legacycorestart.md
@@ -16,13 +16,13 @@ Start interface exposed to the legacy platform via the `ui/new_platform` module.
export interface LegacyCoreStart extends CoreStart
```
+## Remarks
+
+Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreStart](./kibana-plugin-public.corestart.md), unsupported methods will throw exceptions when called.
+
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [injectedMetadata](./kibana-plugin-public.legacycorestart.injectedmetadata.md) | InjectedMetadataStart
| |
-## Remarks
-
-Some methods are not supported in the legacy platform and while present to make this type compatibile with [CoreStart](./kibana-plugin-public.corestart.md), unsupported methods will throw exceptions when called.
-
diff --git a/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md b/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md
index 6033c667c1866..3b916db972673 100644
--- a/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md
+++ b/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md
@@ -12,6 +12,10 @@ Saved Objects is Kibana's data persisentence mechanism allowing plugins to use E
export declare class SavedObjectsClient
```
+## Remarks
+
+The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class.
+
## Properties
| Property | Modifiers | Type | Description |
@@ -30,7 +34,3 @@ export declare class SavedObjectsClient
| [bulkUpdate(objects)](./kibana-plugin-public.savedobjectsclient.bulkupdate.md) | | Update multiple documents at once |
| [update(type, id, attributes, { version, migrationVersion, references })](./kibana-plugin-public.savedobjectsclient.update.md) | | Updates an object |
-## Remarks
-
-The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class.
-
diff --git a/docs/development/core/server/kibana-plugin-server.basepath.md b/docs/development/core/server/kibana-plugin-server.basepath.md
index 77f50abc60369..50a30f7c43fe6 100644
--- a/docs/development/core/server/kibana-plugin-server.basepath.md
+++ b/docs/development/core/server/kibana-plugin-server.basepath.md
@@ -12,6 +12,10 @@ Access or manipulate the Kibana base path
export declare class BasePath
```
+## Remarks
+
+The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BasePath` class.
+
## Properties
| Property | Modifiers | Type | Description |
@@ -22,7 +26,3 @@ export declare class BasePath
| [serverBasePath](./kibana-plugin-server.basepath.serverbasepath.md) | | string
| returns the server's basePathSee [BasePath.get](./kibana-plugin-server.basepath.get.md) for getting the basePath value for a specific request |
| [set](./kibana-plugin-server.basepath.set.md) | | (request: KibanaRequest<unknown, unknown, unknown, any> | LegacyRequest, requestSpecificBasePath: string) => void
| sets basePath
value, specific for an incoming request. |
-## Remarks
-
-The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BasePath` class.
-
diff --git a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md
index f022d6c1d064a..0302797147cff 100644
--- a/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md
+++ b/docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md
@@ -14,15 +14,6 @@ See methods documentation for more detailed examples.
export interface ConfigDeprecationFactory
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [rename(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.rename.md) | Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. |
-| [renameFromRoot(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.renamefromroot.md) | Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied.This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. |
-| [unused(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unused.md) | Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. |
-| [unusedFromRoot(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unusedfromroot.md) | Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied.This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. |
-
## Example
@@ -34,3 +25,12 @@ const provider: ConfigDeprecationProvider = ({ rename, unused }) => [
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [rename(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.rename.md) | Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. |
+| [renameFromRoot(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.renamefromroot.md) | Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied.This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. |
+| [unused(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unused.md) | Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. |
+| [unusedFromRoot(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unusedfromroot.md) | Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied.This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. |
+
diff --git a/docs/development/core/server/kibana-plugin-server.contextsetup.md b/docs/development/core/server/kibana-plugin-server.contextsetup.md
index 1f285efe92b68..1b2a1e2f1b621 100644
--- a/docs/development/core/server/kibana-plugin-server.contextsetup.md
+++ b/docs/development/core/server/kibana-plugin-server.contextsetup.md
@@ -12,12 +12,6 @@ An object that handles registration of context providers and configuring handler
export interface ContextSetup
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [createContextContainer()](./kibana-plugin-server.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-server.icontextcontainer.md) for a service owner. |
-
## Remarks
A [IContextContainer](./kibana-plugin-server.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares.
@@ -136,3 +130,9 @@ class VizRenderingPlugin {
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [createContextContainer()](./kibana-plugin-server.contextsetup.createcontextcontainer.md) | Creates a new [IContextContainer](./kibana-plugin-server.icontextcontainer.md) for a service owner. |
+
diff --git a/docs/development/core/server/kibana-plugin-server.cspconfig.md b/docs/development/core/server/kibana-plugin-server.cspconfig.md
index e5276991be404..7e491cb0df912 100644
--- a/docs/development/core/server/kibana-plugin-server.cspconfig.md
+++ b/docs/development/core/server/kibana-plugin-server.cspconfig.md
@@ -12,6 +12,10 @@ CSP configuration for use in Kibana.
export declare class CspConfig implements ICspConfig
```
+## Remarks
+
+The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `CspConfig` class.
+
## Properties
| Property | Modifiers | Type | Description |
@@ -22,7 +26,3 @@ export declare class CspConfig implements ICspConfig
| [strict](./kibana-plugin-server.cspconfig.strict.md) | | boolean
| |
| [warnLegacyBrowsers](./kibana-plugin-server.cspconfig.warnlegacybrowsers.md) | | boolean
| |
-## Remarks
-
-The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `CspConfig` class.
-
diff --git a/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md b/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md
index c823da392042a..2e615acfeac6b 100644
--- a/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md
+++ b/docs/development/core/server/kibana-plugin-server.elasticsearcherrorhelpers.md
@@ -12,13 +12,6 @@ Helpers for working with errors returned from the Elasticsearch service.Since th
export declare class ElasticsearchErrorHelpers
```
-## Methods
-
-| Method | Modifiers | Description |
-| --- | --- | --- |
-| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-server.elasticsearcherrorhelpers.decoratenotauthorizederror.md) | static
| |
-| [isNotAuthorizedError(error)](./kibana-plugin-server.elasticsearcherrorhelpers.isnotauthorizederror.md) | static
| |
-
## Example
Handle errors
@@ -33,3 +26,10 @@ try {
```
+## Methods
+
+| Method | Modifiers | Description |
+| --- | --- | --- |
+| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-server.elasticsearcherrorhelpers.decoratenotauthorizederror.md) | static
| |
+| [isNotAuthorizedError(error)](./kibana-plugin-server.elasticsearcherrorhelpers.isnotauthorizederror.md) | static
| |
+
diff --git a/docs/development/core/server/kibana-plugin-server.httpservicesetup.md b/docs/development/core/server/kibana-plugin-server.httpservicesetup.md
index 99d4caf40c0d3..3b1993841339d 100644
--- a/docs/development/core/server/kibana-plugin-server.httpservicesetup.md
+++ b/docs/development/core/server/kibana-plugin-server.httpservicesetup.md
@@ -12,21 +12,6 @@ Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins d
export interface HttpServiceSetup
```
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [basePath](./kibana-plugin-server.httpservicesetup.basepath.md) | IBasePath
| Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-server.ibasepath.md). |
-| [createCookieSessionStorageFactory](./kibana-plugin-server.httpservicesetup.createcookiesessionstoragefactory.md) | <T>(cookieOptions: SessionStorageCookieOptions<T>) => Promise<SessionStorageFactory<T>>
| Creates cookie based session storage factory [SessionStorageFactory](./kibana-plugin-server.sessionstoragefactory.md) |
-| [createRouter](./kibana-plugin-server.httpservicesetup.createrouter.md) | () => IRouter
| Provides ability to declare a handler function for a particular path and HTTP request method. |
-| [csp](./kibana-plugin-server.httpservicesetup.csp.md) | ICspConfig
| The CSP config used for Kibana. |
-| [isTlsEnabled](./kibana-plugin-server.httpservicesetup.istlsenabled.md) | boolean
| Flag showing whether a server was configured to use TLS connection. |
-| [registerAuth](./kibana-plugin-server.httpservicesetup.registerauth.md) | (handler: AuthenticationHandler) => void
| To define custom authentication and/or authorization mechanism for incoming requests. |
-| [registerOnPostAuth](./kibana-plugin-server.httpservicesetup.registeronpostauth.md) | (handler: OnPostAuthHandler) => void
| To define custom logic to perform for incoming requests. |
-| [registerOnPreAuth](./kibana-plugin-server.httpservicesetup.registeronpreauth.md) | (handler: OnPreAuthHandler) => void
| To define custom logic to perform for incoming requests. |
-| [registerOnPreResponse](./kibana-plugin-server.httpservicesetup.registeronpreresponse.md) | (handler: OnPreResponseHandler) => void
| To define custom logic to perform for the server response. |
-| [registerRouteHandlerContext](./kibana-plugin-server.httpservicesetup.registerroutehandlercontext.md) | <T extends keyof RequestHandlerContext>(contextName: T, provider: RequestHandlerContextProvider<T>) => RequestHandlerContextContainer
| Register a context provider for a route handler. |
-
## Example
To handle an incoming request in your plugin you should: - Create a `Router` instance.
@@ -92,3 +77,18 @@ async (context, request, response) => {
```
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [basePath](./kibana-plugin-server.httpservicesetup.basepath.md) | IBasePath
| Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-server.ibasepath.md). |
+| [createCookieSessionStorageFactory](./kibana-plugin-server.httpservicesetup.createcookiesessionstoragefactory.md) | <T>(cookieOptions: SessionStorageCookieOptions<T>) => Promise<SessionStorageFactory<T>>
| Creates cookie based session storage factory [SessionStorageFactory](./kibana-plugin-server.sessionstoragefactory.md) |
+| [createRouter](./kibana-plugin-server.httpservicesetup.createrouter.md) | () => IRouter
| Provides ability to declare a handler function for a particular path and HTTP request method. |
+| [csp](./kibana-plugin-server.httpservicesetup.csp.md) | ICspConfig
| The CSP config used for Kibana. |
+| [isTlsEnabled](./kibana-plugin-server.httpservicesetup.istlsenabled.md) | boolean
| Flag showing whether a server was configured to use TLS connection. |
+| [registerAuth](./kibana-plugin-server.httpservicesetup.registerauth.md) | (handler: AuthenticationHandler) => void
| To define custom authentication and/or authorization mechanism for incoming requests. |
+| [registerOnPostAuth](./kibana-plugin-server.httpservicesetup.registeronpostauth.md) | (handler: OnPostAuthHandler) => void
| To define custom logic to perform for incoming requests. |
+| [registerOnPreAuth](./kibana-plugin-server.httpservicesetup.registeronpreauth.md) | (handler: OnPreAuthHandler) => void
| To define custom logic to perform for incoming requests. |
+| [registerOnPreResponse](./kibana-plugin-server.httpservicesetup.registeronpreresponse.md) | (handler: OnPreResponseHandler) => void
| To define custom logic to perform for the server response. |
+| [registerRouteHandlerContext](./kibana-plugin-server.httpservicesetup.registerroutehandlercontext.md) | <T extends keyof RequestHandlerContext>(contextName: T, provider: RequestHandlerContextProvider<T>) => RequestHandlerContextContainer
| Register a context provider for a route handler. |
+
diff --git a/docs/development/core/server/kibana-plugin-server.icontextcontainer.md b/docs/development/core/server/kibana-plugin-server.icontextcontainer.md
index 114da31442ff9..8235c40131536 100644
--- a/docs/development/core/server/kibana-plugin-server.icontextcontainer.md
+++ b/docs/development/core/server/kibana-plugin-server.icontextcontainer.md
@@ -12,13 +12,6 @@ An object that handles registration of context providers and configuring handler
export interface IContextContainer>
```
-## Methods
-
-| Method | Description |
-| --- | --- |
-| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-server.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. |
-| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-server.icontextcontainer.registercontext.md) | Register a new context provider. |
-
## Remarks
A [IContextContainer](./kibana-plugin-server.icontextcontainer.md) can be used by any Core service or plugin (known as the "service owner") which wishes to expose APIs in a handler function. The container object will manage registering context providers and configuring a handler with all of the contexts that should be exposed to the handler's plugin. This is dependent on the dependencies that the handler's plugin declares.
@@ -78,3 +71,10 @@ class MyPlugin {
```
+## Methods
+
+| Method | Description |
+| --- | --- |
+| [createHandler(pluginOpaqueId, handler)](./kibana-plugin-server.icontextcontainer.createhandler.md) | Create a new handler function pre-wired to context for the plugin. |
+| [registerContext(pluginOpaqueId, contextName, provider)](./kibana-plugin-server.icontextcontainer.registercontext.md) | Register a new context provider. |
+
diff --git a/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md b/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md
index 671298a67381a..3d661ac66d2b7 100644
--- a/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md
+++ b/docs/development/core/server/kibana-plugin-server.pluginconfigdescriptor.md
@@ -12,14 +12,6 @@ Describes a plugin configuration properties.
export interface PluginConfigDescriptor
```
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [deprecations](./kibana-plugin-server.pluginconfigdescriptor.deprecations.md) | ConfigDeprecationProvider
| Provider for the [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) to apply to the plugin configuration. |
-| [exposeToBrowser](./kibana-plugin-server.pluginconfigdescriptor.exposetobrowser.md) | {
[P in keyof T]?: boolean;
}
| List of configuration properties that will be available on the client-side plugin. |
-| [schema](./kibana-plugin-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T>
| Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-server.pluginconfigschema.md) |
-
## Example
@@ -48,3 +40,11 @@ export const config: PluginConfigDescriptor = {
```
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [deprecations](./kibana-plugin-server.pluginconfigdescriptor.deprecations.md) | ConfigDeprecationProvider
| Provider for the [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) to apply to the plugin configuration. |
+| [exposeToBrowser](./kibana-plugin-server.pluginconfigdescriptor.exposetobrowser.md) | {
[P in keyof T]?: boolean;
}
| List of configuration properties that will be available on the client-side plugin. |
+| [schema](./kibana-plugin-server.pluginconfigdescriptor.schema.md) | PluginConfigSchema<T>
| Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-server.pluginconfigschema.md) |
+
diff --git a/docs/development/core/server/kibana-plugin-server.pluginmanifest.md b/docs/development/core/server/kibana-plugin-server.pluginmanifest.md
index 4a9498f0e9fab..9bb208a809b22 100644
--- a/docs/development/core/server/kibana-plugin-server.pluginmanifest.md
+++ b/docs/development/core/server/kibana-plugin-server.pluginmanifest.md
@@ -12,6 +12,10 @@ Describes the set of required and optional properties plugin can define in its m
export interface PluginManifest
```
+## Remarks
+
+Should never be used in code outside of Core but is exported for documentation purposes.
+
## Properties
| Property | Type | Description |
@@ -25,7 +29,3 @@ export interface PluginManifest
| [ui](./kibana-plugin-server.pluginmanifest.ui.md) | boolean
| Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via public/ui_plugin.js
file. |
| [version](./kibana-plugin-server.pluginmanifest.version.md) | string
| Version of the plugin. |
-## Remarks
-
-Should never be used in code outside of Core but is exported for documentation purposes.
-
diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md b/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md
index 17d29bb912c83..e68486ecff874 100644
--- a/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md
+++ b/docs/development/core/server/kibana-plugin-server.savedobjectsclient.md
@@ -10,6 +10,10 @@
export declare class SavedObjectsClient
```
+## Remarks
+
+The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class.
+
## Properties
| Property | Modifiers | Type | Description |
@@ -30,7 +34,3 @@ export declare class SavedObjectsClient
| [get(type, id, options)](./kibana-plugin-server.savedobjectsclient.get.md) | | Retrieves a single object |
| [update(type, id, attributes, options)](./kibana-plugin-server.savedobjectsclient.update.md) | | Updates an SavedObject |
-## Remarks
-
-The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `SavedObjectsClient` class.
-
diff --git a/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md b/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md
index dd97b45f590e2..95bd817a43da6 100644
--- a/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md
+++ b/docs/development/core/server/kibana-plugin-server.savedobjectsservicesetup.md
@@ -12,15 +12,6 @@ Saved Objects is Kibana's data persisentence mechanism allowing plugins to use E
export interface SavedObjectsServiceSetup
```
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [addClientWrapper](./kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md) | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory<KibanaRequest>) => void
| Add a client wrapper with the given priority. |
-| [createInternalRepository](./kibana-plugin-server.savedobjectsservicesetup.createinternalrepository.md) | (extraTypes?: string[]) => ISavedObjectsRepository
| Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. |
-| [createScopedRepository](./kibana-plugin-server.savedobjectsservicesetup.createscopedrepository.md) | (req: KibanaRequest, extraTypes?: string[]) => ISavedObjectsRepository
| Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. |
-| [setClientFactory](./kibana-plugin-server.savedobjectsservicesetup.setclientfactory.md) | (customClientFactory: SavedObjectsClientFactory<KibanaRequest>) => void
| Set a default factory for creating Saved Objects clients. Only one client factory can be set, subsequent calls to this method will fail. |
-
## Remarks
Note: The Saved Object setup API's should only be used for creating and registering client wrappers. Constructing a Saved Objects client or repository for use within your own plugin won't have any of the registered wrappers applied and is considered an anti-pattern. Use the Saved Objects client from the [SavedObjectsServiceStart\#getScopedClient](./kibana-plugin-server.savedobjectsservicestart.md) method or the [route handler context](./kibana-plugin-server.requesthandlercontext.md) instead.
@@ -33,3 +24,12 @@ import {SavedObjectsClient, CoreSetup} from 'src/core/server';
export class Plugin() { setup: (core: CoreSetup) => { core.savedObjects.setClientFactory(({request: KibanaRequest}) => { return new SavedObjectsClient(core.savedObjects.scopedRepository(request)); }) } }
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [addClientWrapper](./kibana-plugin-server.savedobjectsservicesetup.addclientwrapper.md) | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory<KibanaRequest>) => void
| Add a client wrapper with the given priority. |
+| [createInternalRepository](./kibana-plugin-server.savedobjectsservicesetup.createinternalrepository.md) | (extraTypes?: string[]) => ISavedObjectsRepository
| Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the internal Kibana user for authenticating with Elasticsearch. |
+| [createScopedRepository](./kibana-plugin-server.savedobjectsservicesetup.createscopedrepository.md) | (req: KibanaRequest, extraTypes?: string[]) => ISavedObjectsRepository
| Creates a [Saved Objects repository](./kibana-plugin-server.isavedobjectsrepository.md) that uses the credentials from the passed in request to authenticate with Elasticsearch. |
+| [setClientFactory](./kibana-plugin-server.savedobjectsservicesetup.setclientfactory.md) | (customClientFactory: SavedObjectsClientFactory<KibanaRequest>) => void
| Set a default factory for creating Saved Objects clients. Only one client factory can be set, subsequent calls to this method will fail. |
+
diff --git a/package.json b/package.json
index a0f5dd3af14c0..99151f33962c4 100644
--- a/package.json
+++ b/package.json
@@ -88,6 +88,7 @@
"**/isomorphic-git/**/base64-js": "^1.2.1",
"**/image-diff/gm/debug": "^2.6.9",
"**/react-dom": "^16.12.0",
+ "**/react": "^16.12.0",
"**/react-test-renderer": "^16.12.0",
"**/deepmerge": "^4.2.2",
"**/serialize-javascript": "^2.1.1"
@@ -113,7 +114,7 @@
"@babel/core": "^7.5.5",
"@babel/register": "^7.7.0",
"@elastic/apm-rum": "^4.6.0",
- "@elastic/charts": "^14.0.0",
+ "@elastic/charts": "^16.0.2",
"@elastic/datemath": "5.0.2",
"@elastic/ems-client": "1.0.5",
"@elastic/eui": "17.3.1",
@@ -173,6 +174,7 @@
"fast-deep-equal": "^3.1.1",
"file-loader": "4.2.0",
"font-awesome": "4.7.0",
+ "fp-ts": "^2.3.1",
"getos": "^3.1.0",
"glob": "^7.1.2",
"glob-all": "^3.1.0",
@@ -187,6 +189,7 @@
"hoek": "^5.0.4",
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.2",
+ "immer": "^1.5.0",
"inert": "^5.1.0",
"inline-style": "^2.0.0",
"joi": "^13.5.2",
@@ -292,8 +295,8 @@
"@kbn/plugin-generator": "1.0.0",
"@kbn/test": "1.0.0",
"@kbn/utility-types": "1.0.0",
- "@microsoft/api-documenter": "7.4.3",
- "@microsoft/api-extractor": "7.4.2",
+ "@microsoft/api-documenter": "7.7.2",
+ "@microsoft/api-extractor": "7.7.0",
"@percy/agent": "^0.11.0",
"@testing-library/react": "^9.3.2",
"@testing-library/react-hooks": "^3.2.1",
diff --git a/packages/kbn-pm/dist/index.js b/packages/kbn-pm/dist/index.js
index 4c5e22d20f779..7c5937af441a2 100644
--- a/packages/kbn-pm/dist/index.js
+++ b/packages/kbn-pm/dist/index.js
@@ -3102,11 +3102,25 @@ function times(n, ok, cb) {
var fs = __webpack_require__(23)
var polyfills = __webpack_require__(24)
-var legacy = __webpack_require__(27)
-var queue = []
+var legacy = __webpack_require__(26)
+var clone = __webpack_require__(28)
var util = __webpack_require__(29)
+/* istanbul ignore next - node 0.x polyfill */
+var gracefulQueue
+var previousSymbol
+
+/* istanbul ignore else - node 0.x polyfill */
+if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
+ gracefulQueue = Symbol.for('graceful-fs.queue')
+ // This is used in testing by future versions
+ previousSymbol = Symbol.for('graceful-fs.previous')
+} else {
+ gracefulQueue = '___graceful-fs.queue'
+ previousSymbol = '___graceful-fs.previous'
+}
+
function noop () {}
var debug = noop
@@ -3119,48 +3133,71 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
console.error(m)
}
-if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
- process.on('exit', function() {
- debug(queue)
- __webpack_require__(30).equal(queue.length, 0)
+// Once time initialization
+if (!global[gracefulQueue]) {
+ // This queue can be shared by multiple loaded instances
+ var queue = []
+ Object.defineProperty(global, gracefulQueue, {
+ get: function() {
+ return queue
+ }
})
-}
-module.exports = patch(__webpack_require__(25))
-if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) {
- module.exports = patch(fs)
-}
+ // Patch fs.close/closeSync to shared queue version, because we need
+ // to retry() whenever a close happens *anywhere* in the program.
+ // This is essential when multiple graceful-fs instances are
+ // in play at the same time.
+ fs.close = (function (fs$close) {
+ function close (fd, cb) {
+ return fs$close.call(fs, fd, function (err) {
+ // This function uses the graceful-fs shared queue
+ if (!err) {
+ retry()
+ }
-// Always patch fs.close/closeSync, because we want to
-// retry() whenever a close happens *anywhere* in the program.
-// This is essential when multiple graceful-fs instances are
-// in play at the same time.
-module.exports.close =
-fs.close = (function (fs$close) { return function (fd, cb) {
- return fs$close.call(fs, fd, function (err) {
- if (!err)
+ if (typeof cb === 'function')
+ cb.apply(this, arguments)
+ })
+ }
+
+ Object.defineProperty(close, previousSymbol, {
+ value: fs$close
+ })
+ return close
+ })(fs.close)
+
+ fs.closeSync = (function (fs$closeSync) {
+ function closeSync (fd) {
+ // This function uses the graceful-fs shared queue
+ fs$closeSync.apply(fs, arguments)
retry()
+ }
- if (typeof cb === 'function')
- cb.apply(this, arguments)
- })
-}})(fs.close)
+ Object.defineProperty(closeSync, previousSymbol, {
+ value: fs$closeSync
+ })
+ return closeSync
+ })(fs.closeSync)
-module.exports.closeSync =
-fs.closeSync = (function (fs$closeSync) { return function (fd) {
- // Note that graceful-fs also retries when fs.closeSync() fails.
- // Looks like a bug to me, although it's probably a harmless one.
- var rval = fs$closeSync.apply(fs, arguments)
- retry()
- return rval
-}})(fs.closeSync)
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
+ process.on('exit', function() {
+ debug(global[gracefulQueue])
+ __webpack_require__(30).equal(global[gracefulQueue].length, 0)
+ })
+ }
+}
+
+module.exports = patch(clone(fs))
+if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
+ module.exports = patch(fs)
+ fs.__patched = true;
+}
function patch (fs) {
// Everything that references the open() function needs to be in here
polyfills(fs)
fs.gracefulify = patch
- fs.FileReadStream = ReadStream; // Legacy name.
- fs.FileWriteStream = WriteStream; // Legacy name.
+
fs.createReadStream = createReadStream
fs.createWriteStream = createWriteStream
var fs$readFile = fs.readFile
@@ -3246,6 +3283,7 @@ function patch (fs) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readdir, [args]])
+
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
@@ -3265,15 +3303,61 @@ function patch (fs) {
}
var fs$ReadStream = fs.ReadStream
- ReadStream.prototype = Object.create(fs$ReadStream.prototype)
- ReadStream.prototype.open = ReadStream$open
+ if (fs$ReadStream) {
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype)
+ ReadStream.prototype.open = ReadStream$open
+ }
var fs$WriteStream = fs.WriteStream
- WriteStream.prototype = Object.create(fs$WriteStream.prototype)
- WriteStream.prototype.open = WriteStream$open
+ if (fs$WriteStream) {
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype)
+ WriteStream.prototype.open = WriteStream$open
+ }
- fs.ReadStream = ReadStream
- fs.WriteStream = WriteStream
+ Object.defineProperty(fs, 'ReadStream', {
+ get: function () {
+ return ReadStream
+ },
+ set: function (val) {
+ ReadStream = val
+ },
+ enumerable: true,
+ configurable: true
+ })
+ Object.defineProperty(fs, 'WriteStream', {
+ get: function () {
+ return WriteStream
+ },
+ set: function (val) {
+ WriteStream = val
+ },
+ enumerable: true,
+ configurable: true
+ })
+
+ // legacy names
+ var FileReadStream = ReadStream
+ Object.defineProperty(fs, 'FileReadStream', {
+ get: function () {
+ return FileReadStream
+ },
+ set: function (val) {
+ FileReadStream = val
+ },
+ enumerable: true,
+ configurable: true
+ })
+ var FileWriteStream = WriteStream
+ Object.defineProperty(fs, 'FileWriteStream', {
+ get: function () {
+ return FileWriteStream
+ },
+ set: function (val) {
+ FileWriteStream = val
+ },
+ enumerable: true,
+ configurable: true
+ })
function ReadStream (path, options) {
if (this instanceof ReadStream)
@@ -3319,11 +3403,11 @@ function patch (fs) {
}
function createReadStream (path, options) {
- return new ReadStream(path, options)
+ return new fs.ReadStream(path, options)
}
function createWriteStream (path, options) {
- return new WriteStream(path, options)
+ return new fs.WriteStream(path, options)
}
var fs$open = fs.open
@@ -3352,11 +3436,11 @@ function patch (fs) {
function enqueue (elem) {
debug('ENQUEUE', elem[0].name, elem[1])
- queue.push(elem)
+ global[gracefulQueue].push(elem)
}
function retry () {
- var elem = queue.shift()
+ var elem = global[gracefulQueue].shift()
if (elem) {
debug('RETRY', elem[0].name, elem[1])
elem[0].apply(null, elem[1])
@@ -3374,8 +3458,7 @@ module.exports = require("fs");
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
-var fs = __webpack_require__(25)
-var constants = __webpack_require__(26)
+var constants = __webpack_require__(25)
var origCwd = process.cwd
var cwd = null
@@ -3492,20 +3575,26 @@ function patch (fs) {
}
// if read() returns EAGAIN, then just try it again.
- fs.read = (function (fs$read) { return function (fd, buffer, offset, length, position, callback_) {
- var callback
- if (callback_ && typeof callback_ === 'function') {
- var eagCounter = 0
- callback = function (er, _, __) {
- if (er && er.code === 'EAGAIN' && eagCounter < 10) {
- eagCounter ++
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
+ fs.read = (function (fs$read) {
+ function read (fd, buffer, offset, length, position, callback_) {
+ var callback
+ if (callback_ && typeof callback_ === 'function') {
+ var eagCounter = 0
+ callback = function (er, _, __) {
+ if (er && er.code === 'EAGAIN' && eagCounter < 10) {
+ eagCounter ++
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback)
+ }
+ callback_.apply(this, arguments)
}
- callback_.apply(this, arguments)
}
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
- return fs$read.call(fs, fd, buffer, offset, length, position, callback)
- }})(fs.read)
+
+ // This ensures `util.promisify` works as it does for native `fs.read`.
+ read.__proto__ = fs$read
+ return read
+ })(fs.read)
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
var eagCounter = 0
@@ -3521,73 +3610,36 @@ function patch (fs) {
}
}
}})(fs.readSync)
-}
-
-function patchLchmod (fs) {
- fs.lchmod = function (path, mode, callback) {
- fs.open( path
- , constants.O_WRONLY | constants.O_SYMLINK
- , mode
- , function (err, fd) {
- if (err) {
- if (callback) callback(err)
- return
- }
- // prefer to return the chmod error, if one occurs,
- // but still try to close, and report closing errors if they occur.
- fs.fchmod(fd, mode, function (err) {
- fs.close(fd, function(err2) {
- if (callback) callback(err || err2)
- })
- })
- })
- }
-
- fs.lchmodSync = function (path, mode) {
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
-
- // prefer to return the chmod error, if one occurs,
- // but still try to close, and report closing errors if they occur.
- var threw = true
- var ret
- try {
- ret = fs.fchmodSync(fd, mode)
- threw = false
- } finally {
- if (threw) {
- try {
- fs.closeSync(fd)
- } catch (er) {}
- } else {
- fs.closeSync(fd)
- }
- }
- return ret
- }
-}
-function patchLutimes (fs) {
- if (constants.hasOwnProperty("O_SYMLINK")) {
- fs.lutimes = function (path, at, mt, cb) {
- fs.open(path, constants.O_SYMLINK, function (er, fd) {
- if (er) {
- if (cb) cb(er)
+ function patchLchmod (fs) {
+ fs.lchmod = function (path, mode, callback) {
+ fs.open( path
+ , constants.O_WRONLY | constants.O_SYMLINK
+ , mode
+ , function (err, fd) {
+ if (err) {
+ if (callback) callback(err)
return
}
- fs.futimes(fd, at, mt, function (er) {
- fs.close(fd, function (er2) {
- if (cb) cb(er || er2)
+ // prefer to return the chmod error, if one occurs,
+ // but still try to close, and report closing errors if they occur.
+ fs.fchmod(fd, mode, function (err) {
+ fs.close(fd, function(err2) {
+ if (callback) callback(err || err2)
})
})
})
}
- fs.lutimesSync = function (path, at, mt) {
- var fd = fs.openSync(path, constants.O_SYMLINK)
- var ret
+ fs.lchmodSync = function (path, mode) {
+ var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
+
+ // prefer to return the chmod error, if one occurs,
+ // but still try to close, and report closing errors if they occur.
var threw = true
+ var ret
try {
- ret = fs.futimesSync(fd, at, mt)
+ ret = fs.fchmodSync(fd, mode)
threw = false
} finally {
if (threw) {
@@ -3600,151 +3652,167 @@ function patchLutimes (fs) {
}
return ret
}
+ }
- } else {
- fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
- fs.lutimesSync = function () {}
+ function patchLutimes (fs) {
+ if (constants.hasOwnProperty("O_SYMLINK")) {
+ fs.lutimes = function (path, at, mt, cb) {
+ fs.open(path, constants.O_SYMLINK, function (er, fd) {
+ if (er) {
+ if (cb) cb(er)
+ return
+ }
+ fs.futimes(fd, at, mt, function (er) {
+ fs.close(fd, function (er2) {
+ if (cb) cb(er || er2)
+ })
+ })
+ })
+ }
+
+ fs.lutimesSync = function (path, at, mt) {
+ var fd = fs.openSync(path, constants.O_SYMLINK)
+ var ret
+ var threw = true
+ try {
+ ret = fs.futimesSync(fd, at, mt)
+ threw = false
+ } finally {
+ if (threw) {
+ try {
+ fs.closeSync(fd)
+ } catch (er) {}
+ } else {
+ fs.closeSync(fd)
+ }
+ }
+ return ret
+ }
+
+ } else {
+ fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
+ fs.lutimesSync = function () {}
+ }
}
-}
-function chmodFix (orig) {
- if (!orig) return orig
- return function (target, mode, cb) {
- return orig.call(fs, target, mode, function (er) {
- if (chownErOk(er)) er = null
- if (cb) cb.apply(this, arguments)
- })
+ function chmodFix (orig) {
+ if (!orig) return orig
+ return function (target, mode, cb) {
+ return orig.call(fs, target, mode, function (er) {
+ if (chownErOk(er)) er = null
+ if (cb) cb.apply(this, arguments)
+ })
+ }
}
-}
-function chmodFixSync (orig) {
- if (!orig) return orig
- return function (target, mode) {
- try {
- return orig.call(fs, target, mode)
- } catch (er) {
- if (!chownErOk(er)) throw er
+ function chmodFixSync (orig) {
+ if (!orig) return orig
+ return function (target, mode) {
+ try {
+ return orig.call(fs, target, mode)
+ } catch (er) {
+ if (!chownErOk(er)) throw er
+ }
}
}
-}
-function chownFix (orig) {
- if (!orig) return orig
- return function (target, uid, gid, cb) {
- return orig.call(fs, target, uid, gid, function (er) {
- if (chownErOk(er)) er = null
- if (cb) cb.apply(this, arguments)
- })
+ function chownFix (orig) {
+ if (!orig) return orig
+ return function (target, uid, gid, cb) {
+ return orig.call(fs, target, uid, gid, function (er) {
+ if (chownErOk(er)) er = null
+ if (cb) cb.apply(this, arguments)
+ })
+ }
}
-}
-function chownFixSync (orig) {
- if (!orig) return orig
- return function (target, uid, gid) {
- try {
- return orig.call(fs, target, uid, gid)
- } catch (er) {
- if (!chownErOk(er)) throw er
+ function chownFixSync (orig) {
+ if (!orig) return orig
+ return function (target, uid, gid) {
+ try {
+ return orig.call(fs, target, uid, gid)
+ } catch (er) {
+ if (!chownErOk(er)) throw er
+ }
}
}
-}
+ function statFix (orig) {
+ if (!orig) return orig
+ // Older versions of Node erroneously returned signed integers for
+ // uid + gid.
+ return function (target, options, cb) {
+ if (typeof options === 'function') {
+ cb = options
+ options = null
+ }
+ function callback (er, stats) {
+ if (stats) {
+ if (stats.uid < 0) stats.uid += 0x100000000
+ if (stats.gid < 0) stats.gid += 0x100000000
+ }
+ if (cb) cb.apply(this, arguments)
+ }
+ return options ? orig.call(fs, target, options, callback)
+ : orig.call(fs, target, callback)
+ }
+ }
-function statFix (orig) {
- if (!orig) return orig
- // Older versions of Node erroneously returned signed integers for
- // uid + gid.
- return function (target, cb) {
- return orig.call(fs, target, function (er, stats) {
- if (!stats) return cb.apply(this, arguments)
+ function statFixSync (orig) {
+ if (!orig) return orig
+ // Older versions of Node erroneously returned signed integers for
+ // uid + gid.
+ return function (target, options) {
+ var stats = options ? orig.call(fs, target, options)
+ : orig.call(fs, target)
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
- if (cb) cb.apply(this, arguments)
- })
+ return stats;
+ }
}
-}
-function statFixSync (orig) {
- if (!orig) return orig
- // Older versions of Node erroneously returned signed integers for
- // uid + gid.
- return function (target) {
- var stats = orig.call(fs, target)
- if (stats.uid < 0) stats.uid += 0x100000000
- if (stats.gid < 0) stats.gid += 0x100000000
- return stats;
- }
-}
+ // ENOSYS means that the fs doesn't support the op. Just ignore
+ // that, because it doesn't matter.
+ //
+ // if there's no getuid, or if getuid() is something other
+ // than 0, and the error is EINVAL or EPERM, then just ignore
+ // it.
+ //
+ // This specific case is a silent failure in cp, install, tar,
+ // and most other unix tools that manage permissions.
+ //
+ // When running as root, or if other types of errors are
+ // encountered, then it's strict.
+ function chownErOk (er) {
+ if (!er)
+ return true
-// ENOSYS means that the fs doesn't support the op. Just ignore
-// that, because it doesn't matter.
-//
-// if there's no getuid, or if getuid() is something other
-// than 0, and the error is EINVAL or EPERM, then just ignore
-// it.
-//
-// This specific case is a silent failure in cp, install, tar,
-// and most other unix tools that manage permissions.
-//
-// When running as root, or if other types of errors are
-// encountered, then it's strict.
-function chownErOk (er) {
- if (!er)
- return true
+ if (er.code === "ENOSYS")
+ return true
- if (er.code === "ENOSYS")
- return true
+ var nonroot = !process.getuid || process.getuid() !== 0
+ if (nonroot) {
+ if (er.code === "EINVAL" || er.code === "EPERM")
+ return true
+ }
- var nonroot = !process.getuid || process.getuid() !== 0
- if (nonroot) {
- if (er.code === "EINVAL" || er.code === "EPERM")
- return true
+ return false
}
-
- return false
}
/***/ }),
/* 25 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var fs = __webpack_require__(23)
-
-module.exports = clone(fs)
-
-function clone (obj) {
- if (obj === null || typeof obj !== 'object')
- return obj
-
- if (obj instanceof Object)
- var copy = { __proto__: obj.__proto__ }
- else
- var copy = Object.create(null)
-
- Object.getOwnPropertyNames(obj).forEach(function (key) {
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
- })
-
- return copy
-}
-
-
-/***/ }),
-/* 26 */
/***/ (function(module, exports) {
module.exports = require("constants");
/***/ }),
-/* 27 */
+/* 26 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28).Stream
+var Stream = __webpack_require__(27).Stream
module.exports = legacy
@@ -3865,11 +3933,37 @@ function legacy (fs) {
/***/ }),
-/* 28 */
+/* 27 */
/***/ (function(module, exports) {
module.exports = require("stream");
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+module.exports = clone
+
+function clone (obj) {
+ if (obj === null || typeof obj !== 'object')
+ return obj
+
+ if (obj instanceof Object)
+ var copy = { __proto__: obj.__proto__ }
+ else
+ var copy = Object.create(null)
+
+ Object.getOwnPropertyNames(obj).forEach(function (key) {
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
+ })
+
+ return copy
+}
+
+
/***/ }),
/* 29 */
/***/ (function(module, exports) {
@@ -34687,7 +34781,7 @@ module.exports = eos;
"use strict";
-const {PassThrough: PassThroughStream} = __webpack_require__(28);
+const {PassThrough: PassThroughStream} = __webpack_require__(27);
module.exports = options => {
options = {...options};
@@ -34747,7 +34841,7 @@ module.exports = options => {
"use strict";
-const { PassThrough } = __webpack_require__(28);
+const { PassThrough } = __webpack_require__(27);
module.exports = function (/*streams...*/) {
var sources = []
@@ -37771,7 +37865,7 @@ function retry () {
/* 431 */
/***/ (function(module, exports, __webpack_require__) {
-var constants = __webpack_require__(26)
+var constants = __webpack_require__(25)
var origCwd = process.cwd
var cwd = null
@@ -38106,7 +38200,7 @@ function patch (fs) {
/* 432 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28).Stream
+var Stream = __webpack_require__(27).Stream
module.exports = legacy
@@ -41741,7 +41835,7 @@ var url = __webpack_require__(454);
var http = __webpack_require__(472);
var https = __webpack_require__(473);
var assert = __webpack_require__(30);
-var Writable = __webpack_require__(28).Writable;
+var Writable = __webpack_require__(27).Writable;
var debug = __webpack_require__(475)("follow-redirects");
// RFC7231§4.2.1: Of the request methods defined by this specification,
@@ -52721,7 +52815,7 @@ function retry () {
/* 547 */
/***/ (function(module, exports, __webpack_require__) {
-var constants = __webpack_require__(26)
+var constants = __webpack_require__(25)
var origCwd = process.cwd
var cwd = null
@@ -53056,7 +53150,7 @@ function patch (fs) {
/* 548 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28).Stream
+var Stream = __webpack_require__(27).Stream
module.exports = legacy
@@ -53720,7 +53814,7 @@ function retry () {
/***/ (function(module, exports, __webpack_require__) {
var fs = __webpack_require__(553)
-var constants = __webpack_require__(26)
+var constants = __webpack_require__(25)
var origCwd = process.cwd
var cwd = null
@@ -54083,7 +54177,7 @@ function clone (obj) {
/* 554 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28).Stream
+var Stream = __webpack_require__(27).Stream
module.exports = legacy
@@ -57230,7 +57324,7 @@ module.exports.cli = __webpack_require__(576);
-var stream = __webpack_require__(28);
+var stream = __webpack_require__(27);
var util = __webpack_require__(29);
var fs = __webpack_require__(23);
@@ -57428,7 +57522,7 @@ function lineMerger(host) {
/* 573 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28)
+var Stream = __webpack_require__(27)
// through
//
@@ -57542,7 +57636,7 @@ function through (write, end, opts) {
/* 574 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28)
+var Stream = __webpack_require__(27)
var writeMethods = ["write", "end", "destroy"]
var readMethods = ["resume", "pause"]
var readEvents = ["data", "close"]
@@ -60403,7 +60497,7 @@ exports.default = Lockfile;
/* 17 */
/***/ (function(module, exports) {
-module.exports = __webpack_require__(28);
+module.exports = __webpack_require__(27);
/***/ }),
/* 18 */,
@@ -69246,7 +69340,7 @@ module.exports = (...arguments_) => {
* Copyright (c) 2014-2016 Teambition
* Licensed under the MIT license.
*/
-const Stream = __webpack_require__(28)
+const Stream = __webpack_require__(27)
const PassThrough = Stream.PassThrough
const slice = Array.prototype.slice
@@ -73646,7 +73740,7 @@ exports.default = ProviderAsync;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const stream_1 = __webpack_require__(28);
+const stream_1 = __webpack_require__(27);
const fsStat = __webpack_require__(623);
const fsWalk = __webpack_require__(628);
const reader_1 = __webpack_require__(648);
@@ -74647,7 +74741,7 @@ exports.default = Reader;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const stream_1 = __webpack_require__(28);
+const stream_1 = __webpack_require__(27);
const async_1 = __webpack_require__(630);
class StreamProvider {
constructor(_root, _settings) {
@@ -75081,7 +75175,7 @@ exports.default = EntryTransformer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-const stream_1 = __webpack_require__(28);
+const stream_1 = __webpack_require__(27);
const stream_2 = __webpack_require__(622);
const provider_1 = __webpack_require__(649);
class ProviderStream extends provider_1.default {
@@ -76121,7 +76215,7 @@ module.exports = path => {
"use strict";
-const {Transform} = __webpack_require__(28);
+const {Transform} = __webpack_require__(27);
class ObjectTransform extends Transform {
constructor() {
@@ -76522,7 +76616,7 @@ function retry () {
/* 665 */
/***/ (function(module, exports, __webpack_require__) {
-var constants = __webpack_require__(26)
+var constants = __webpack_require__(25)
var origCwd = process.cwd
var cwd = null
@@ -76870,7 +76964,7 @@ function patch (fs) {
/* 666 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = __webpack_require__(28).Stream
+var Stream = __webpack_require__(27).Stream
module.exports = legacy
@@ -101698,7 +101792,7 @@ function readdirSync (dir, options, internalOptions) {
"use strict";
-const Readable = __webpack_require__(28).Readable;
+const Readable = __webpack_require__(27).Readable;
const EventEmitter = __webpack_require__(379).EventEmitter;
const path = __webpack_require__(16);
const normalizeOptions = __webpack_require__(868);
@@ -103099,7 +103193,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
-var stream = __webpack_require__(28);
+var stream = __webpack_require__(27);
var fsStat = __webpack_require__(883);
var fs_1 = __webpack_require__(887);
var FileSystemStream = /** @class */ (function (_super) {
@@ -103333,7 +103427,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
-var stream = __webpack_require__(28);
+var stream = __webpack_require__(27);
var readdir = __webpack_require__(865);
var reader_1 = __webpack_require__(878);
var fs_stream_1 = __webpack_require__(882);
diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js
index 976eac7f95da6..6b13d0dc32d3f 100644
--- a/src/cli/serve/serve.js
+++ b/src/cli/serve/serve.js
@@ -140,23 +140,12 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
}
set('plugins.scanDirs', _.compact([].concat(get('plugins.scanDirs'), opts.pluginDir)));
-
set(
'plugins.paths',
_.compact(
[].concat(
get('plugins.paths'),
opts.pluginPath,
- opts.runExamples
- ? [
- // Ideally this would automatically include all plugins in the examples dir
- fromRoot('examples/demo_search'),
- fromRoot('examples/search_explorer'),
- fromRoot('examples/embeddable_examples'),
- fromRoot('examples/embeddable_explorer'),
- ]
- : [],
-
XPACK_INSTALLED && !opts.oss ? [XPACK_DIR] : []
)
)
@@ -253,6 +242,7 @@ export default function(program) {
silent: !!opts.silent,
watch: !!opts.watch,
repl: !!opts.repl,
+ runExamples: !!opts.runExamples,
// We want to run without base path when the `--run-examples` flag is given so that we can use local
// links in other documentation sources, like "View this tutorial [here](http://localhost:5601/app/tutorial/xyz)".
// We can tell users they only have to run with `yarn start --run-examples` to get those
diff --git a/src/core/server/config/__mocks__/env.ts b/src/core/server/config/__mocks__/env.ts
index 644b499ff56d8..80cfab81fb557 100644
--- a/src/core/server/config/__mocks__/env.ts
+++ b/src/core/server/config/__mocks__/env.ts
@@ -38,6 +38,7 @@ export function getEnvOptions(options: DeepPartial = {}): EnvOptions
basePath: false,
optimize: false,
oss: false,
+ runExamples: false,
...(options.cliArgs || {}),
},
isDevClusterMaster:
diff --git a/src/core/server/config/__snapshots__/env.test.ts.snap b/src/core/server/config/__snapshots__/env.test.ts.snap
index 1f4661283de6e..204b8a70aa877 100644
--- a/src/core/server/config/__snapshots__/env.test.ts.snap
+++ b/src/core/server/config/__snapshots__/env.test.ts.snap
@@ -12,6 +12,7 @@ Env {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -40,7 +41,6 @@ Env {
"/test/kibanaRoot/plugins",
"/test/kibanaRoot/../kibana-extra",
],
- "staticFilesDir": "/test/kibanaRoot/ui",
}
`;
@@ -56,6 +56,7 @@ Env {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -84,7 +85,6 @@ Env {
"/test/kibanaRoot/plugins",
"/test/kibanaRoot/../kibana-extra",
],
- "staticFilesDir": "/test/kibanaRoot/ui",
}
`;
@@ -99,6 +99,7 @@ Env {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -127,7 +128,6 @@ Env {
"/test/kibanaRoot/plugins",
"/test/kibanaRoot/../kibana-extra",
],
- "staticFilesDir": "/test/kibanaRoot/ui",
}
`;
@@ -142,6 +142,7 @@ Env {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -170,7 +171,6 @@ Env {
"/test/kibanaRoot/plugins",
"/test/kibanaRoot/../kibana-extra",
],
- "staticFilesDir": "/test/kibanaRoot/ui",
}
`;
@@ -185,6 +185,7 @@ Env {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -213,7 +214,6 @@ Env {
"/test/kibanaRoot/plugins",
"/test/kibanaRoot/../kibana-extra",
],
- "staticFilesDir": "/test/kibanaRoot/ui",
}
`;
@@ -228,6 +228,7 @@ Env {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -256,6 +257,5 @@ Env {
"/some/home/dir/plugins",
"/some/home/dir/../kibana-extra",
],
- "staticFilesDir": "/some/home/dir/ui",
}
`;
diff --git a/src/core/server/config/deprecation/core_deprecations.ts b/src/core/server/config/deprecation/core_deprecations.ts
index 6a401ec6625a2..36fe95e05cb53 100644
--- a/src/core/server/config/deprecation/core_deprecations.ts
+++ b/src/core/server/config/deprecation/core_deprecations.ts
@@ -97,7 +97,6 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
}) => [
unusedFromRoot('savedObjects.indexCheckTimeout'),
unusedFromRoot('server.xsrf.token'),
- unusedFromRoot('uiSettings.enabled'),
renameFromRoot('optimize.lazy', 'optimize.watch'),
renameFromRoot('optimize.lazyPort', 'optimize.watchPort'),
renameFromRoot('optimize.lazyHost', 'optimize.watchHost'),
diff --git a/src/core/server/config/env.test.ts b/src/core/server/config/env.test.ts
index 5812fa93cf18f..c244012e34469 100644
--- a/src/core/server/config/env.test.ts
+++ b/src/core/server/config/env.test.ts
@@ -152,3 +152,25 @@ test('pluginSearchPaths does not contains x-pack plugins path if --oss flag is t
expect(env.pluginSearchPaths).not.toContain('/some/home/dir/x-pack/plugins');
});
+
+test('pluginSearchPaths contains examples plugins path if --run-examples flag is true', () => {
+ const env = new Env(
+ '/some/home/dir',
+ getEnvOptions({
+ cliArgs: { runExamples: true },
+ })
+ );
+
+ expect(env.pluginSearchPaths).toContain('/some/home/dir/examples');
+});
+
+test('pluginSearchPaths does not contains examples plugins path if --run-examples flag is false', () => {
+ const env = new Env(
+ '/some/home/dir',
+ getEnvOptions({
+ cliArgs: { runExamples: false },
+ })
+ );
+
+ expect(env.pluginSearchPaths).not.toContain('/some/home/dir/examples');
+});
diff --git a/src/core/server/config/env.ts b/src/core/server/config/env.ts
index 460773d89db85..db363fcd4d751 100644
--- a/src/core/server/config/env.ts
+++ b/src/core/server/config/env.ts
@@ -43,6 +43,7 @@ export interface CliArgs {
optimize: boolean;
open: boolean;
oss: boolean;
+ runExamples: boolean;
}
export class Env {
@@ -61,8 +62,6 @@ export class Env {
/** @internal */
public readonly logDir: string;
/** @internal */
- public readonly staticFilesDir: string;
- /** @internal */
public readonly pluginSearchPaths: readonly string[];
/**
@@ -100,14 +99,14 @@ export class Env {
this.configDir = resolve(this.homeDir, 'config');
this.binDir = resolve(this.homeDir, 'bin');
this.logDir = resolve(this.homeDir, 'log');
- this.staticFilesDir = resolve(this.homeDir, 'ui');
this.pluginSearchPaths = [
resolve(this.homeDir, 'src', 'plugins'),
- options.cliArgs.oss ? '' : resolve(this.homeDir, 'x-pack', 'plugins'),
+ ...(options.cliArgs.oss ? [] : [resolve(this.homeDir, 'x-pack', 'plugins')]),
resolve(this.homeDir, 'plugins'),
+ ...(options.cliArgs.runExamples ? [resolve(this.homeDir, 'examples')] : []),
resolve(this.homeDir, '..', 'kibana-extra'),
- ].filter(Boolean);
+ ];
this.cliArgs = Object.freeze(options.cliArgs);
this.configs = Object.freeze(options.configs);
diff --git a/src/core/server/http/__snapshots__/http_config.test.ts.snap b/src/core/server/http/__snapshots__/http_config.test.ts.snap
index 6c690f9da70c3..8856eb95ba722 100644
--- a/src/core/server/http/__snapshots__/http_config.test.ts.snap
+++ b/src/core/server/http/__snapshots__/http_config.test.ts.snap
@@ -31,11 +31,13 @@ Object {
"enabled": true,
},
"cors": false,
+ "customResponseHeaders": Object {},
"host": "localhost",
"keepaliveTimeout": 120000,
"maxPayload": ByteSizeValue {
"valueInBytes": 1048576,
},
+ "name": "kibana-hostname",
"port": 5601,
"rewriteBasePath": false,
"socketTimeout": 120000,
@@ -70,6 +72,10 @@ Object {
"TLSv1.2",
],
},
+ "xsrf": Object {
+ "disableProtection": false,
+ "whitelist": Array [],
+ },
}
`;
diff --git a/src/core/server/http/cookie_session_storage.test.ts b/src/core/server/http/cookie_session_storage.test.ts
index 0e4f3972fe9dc..4ce422e1f65c4 100644
--- a/src/core/server/http/cookie_session_storage.test.ts
+++ b/src/core/server/http/cookie_session_storage.test.ts
@@ -58,6 +58,10 @@ configService.atPath.mockReturnValue(
verificationMode: 'none',
},
compression: { enabled: true },
+ xsrf: {
+ disableProtection: true,
+ whitelist: [],
+ },
} as any)
);
diff --git a/src/core/server/http/http_config.test.ts b/src/core/server/http/http_config.test.ts
index 9b6fab8f3daec..3dc5fa48bc366 100644
--- a/src/core/server/http/http_config.test.ts
+++ b/src/core/server/http/http_config.test.ts
@@ -19,12 +19,15 @@
import uuid from 'uuid';
import { config, HttpConfig } from '.';
-import { Env } from '../config';
-import { getEnvOptions } from '../config/__mocks__/env';
const validHostnames = ['www.example.com', '8.8.8.8', '::1', 'localhost'];
const invalidHostname = 'asdf$%^';
+jest.mock('os', () => ({
+ ...jest.requireActual('os'),
+ hostname: () => 'kibana-hostname',
+}));
+
test('has defaults for config', () => {
const httpSchema = config.schema;
const obj = {};
@@ -86,6 +89,24 @@ test('accepts only valid uuids for server.uuid', () => {
);
});
+test('uses os.hostname() as default for server.name', () => {
+ const httpSchema = config.schema;
+ const validated = httpSchema.validate({});
+ expect(validated.name).toEqual('kibana-hostname');
+});
+
+test('throws if xsrf.whitelist element does not start with a slash', () => {
+ const httpSchema = config.schema;
+ const obj = {
+ xsrf: {
+ whitelist: ['/valid-path', 'invalid-path'],
+ },
+ };
+ expect(() => httpSchema.validate(obj)).toThrowErrorMatchingInlineSnapshot(
+ `"[xsrf.whitelist.1]: must start with a slash"`
+ );
+});
+
describe('with TLS', () => {
test('throws if TLS is enabled but `key` is not specified', () => {
const httpSchema = config.schema;
@@ -265,8 +286,7 @@ describe('with TLS', () => {
clientAuthentication: 'none',
},
}),
- {} as any,
- Env.createDefault(getEnvOptions())
+ {} as any
);
expect(httpConfig.ssl.requestCert).toBe(false);
@@ -283,8 +303,7 @@ describe('with TLS', () => {
clientAuthentication: 'optional',
},
}),
- {} as any,
- Env.createDefault(getEnvOptions())
+ {} as any
);
expect(httpConfig.ssl.requestCert).toBe(true);
@@ -301,8 +320,7 @@ describe('with TLS', () => {
clientAuthentication: 'required',
},
}),
- {} as any,
- Env.createDefault(getEnvOptions())
+ {} as any
);
expect(httpConfig.ssl.requestCert).toBe(true);
diff --git a/src/core/server/http/http_config.ts b/src/core/server/http/http_config.ts
index ef6a9c0a5f1a5..73f44f3c5ab5c 100644
--- a/src/core/server/http/http_config.ts
+++ b/src/core/server/http/http_config.ts
@@ -18,7 +18,8 @@
*/
import { ByteSizeValue, schema, TypeOf } from '@kbn/config-schema';
-import { Env } from '../config';
+import { hostname } from 'os';
+
import { CspConfigType, CspConfig, ICspConfig } from '../csp';
import { SslConfig, sslSchema } from './ssl_config';
@@ -34,21 +35,13 @@ export const config = {
path: 'server',
schema: schema.object(
{
+ name: schema.string({ defaultValue: () => hostname() }),
autoListen: schema.boolean({ defaultValue: true }),
basePath: schema.maybe(
schema.string({
validate: match(validBasePathRegex, "must start with a slash, don't end with one"),
})
),
- defaultRoute: schema.maybe(
- schema.string({
- validate(value) {
- if (!value.startsWith('/')) {
- return 'must start with a slash';
- }
- },
- })
- ),
cors: schema.conditional(
schema.contextRef('dev'),
true,
@@ -64,6 +57,9 @@ export const config = {
),
schema.boolean({ defaultValue: false })
),
+ customResponseHeaders: schema.recordOf(schema.string(), schema.string(), {
+ defaultValue: {},
+ }),
host: schema.string({
defaultValue: 'localhost',
hostname: true,
@@ -98,6 +94,13 @@ export const config = {
validate: match(uuidRegexp, 'must be a valid uuid'),
})
),
+ xsrf: schema.object({
+ disableProtection: schema.boolean({ defaultValue: false }),
+ whitelist: schema.arrayOf(
+ schema.string({ validate: match(/^\//, 'must start with a slash') }),
+ { defaultValue: [] }
+ ),
+ }),
},
{
validate: rawConfig => {
@@ -126,38 +129,40 @@ export const config = {
export type HttpConfigType = TypeOf;
export class HttpConfig {
+ public name: string;
public autoListen: boolean;
public host: string;
public keepaliveTimeout: number;
public socketTimeout: number;
public port: number;
public cors: boolean | { origin: string[] };
+ public customResponseHeaders: Record;
public maxPayload: ByteSizeValue;
public basePath?: string;
public rewriteBasePath: boolean;
- public publicDir: string;
- public defaultRoute?: string;
public ssl: SslConfig;
public compression: { enabled: boolean; referrerWhitelist?: string[] };
public csp: ICspConfig;
+ public xsrf: { disableProtection: boolean; whitelist: string[] };
/**
* @internal
*/
- constructor(rawHttpConfig: HttpConfigType, rawCspConfig: CspConfigType, env: Env) {
+ constructor(rawHttpConfig: HttpConfigType, rawCspConfig: CspConfigType) {
this.autoListen = rawHttpConfig.autoListen;
this.host = rawHttpConfig.host;
this.port = rawHttpConfig.port;
this.cors = rawHttpConfig.cors;
+ this.customResponseHeaders = rawHttpConfig.customResponseHeaders;
this.maxPayload = rawHttpConfig.maxPayload;
+ this.name = rawHttpConfig.name;
this.basePath = rawHttpConfig.basePath;
this.keepaliveTimeout = rawHttpConfig.keepaliveTimeout;
this.socketTimeout = rawHttpConfig.socketTimeout;
this.rewriteBasePath = rawHttpConfig.rewriteBasePath;
- this.publicDir = env.staticFilesDir;
this.ssl = new SslConfig(rawHttpConfig.ssl || {});
- this.defaultRoute = rawHttpConfig.defaultRoute;
this.compression = rawHttpConfig.compression;
this.csp = new CspConfig(rawCspConfig);
+ this.xsrf = rawHttpConfig.xsrf;
}
}
diff --git a/src/core/server/http/http_server.mocks.ts b/src/core/server/http/http_server.mocks.ts
index ba742292e9e83..230a229b36888 100644
--- a/src/core/server/http/http_server.mocks.ts
+++ b/src/core/server/http/http_server.mocks.ts
@@ -30,6 +30,9 @@ import {
RouteMethod,
KibanaResponseFactory,
} from './router';
+import { OnPreResponseToolkit } from './lifecycle/on_pre_response';
+import { OnPostAuthToolkit } from './lifecycle/on_post_auth';
+import { OnPreAuthToolkit } from './lifecycle/on_pre_auth';
interface RequestFixtureOptions {
headers?: Record;
@@ -137,9 +140,19 @@ const createLifecycleResponseFactoryMock = (): jest.Mocked;
+
+const createToolkitMock = (): ToolkitMock => {
+ return {
+ next: jest.fn(),
+ rewriteUrl: jest.fn(),
+ };
+};
+
export const httpServerMock = {
createKibanaRequest: createKibanaRequestMock,
createRawRequest: createRawRequestMock,
createResponseFactory: createResponseFactoryMock,
createLifecycleResponseFactory: createLifecycleResponseFactoryMock,
+ createToolkit: createToolkitMock,
};
diff --git a/src/core/server/http/http_server.ts b/src/core/server/http/http_server.ts
index 994a6cced8914..6b978b71c6f2b 100644
--- a/src/core/server/http/http_server.ts
+++ b/src/core/server/http/http_server.ts
@@ -60,6 +60,12 @@ export interface HttpServerSetup {
};
}
+/** @internal */
+export type LifecycleRegistrar = Pick<
+ HttpServerSetup,
+ 'registerAuth' | 'registerOnPreAuth' | 'registerOnPostAuth' | 'registerOnPreResponse'
+>;
+
export class HttpServer {
private server?: Server;
private config?: HttpConfig;
diff --git a/src/core/server/http/http_service.mock.ts b/src/core/server/http/http_service.mock.ts
index 700ae04f00d47..6db1ca80ab437 100644
--- a/src/core/server/http/http_service.mock.ts
+++ b/src/core/server/http/http_service.mock.ts
@@ -68,7 +68,6 @@ const createSetupContractMock = () => {
getAuthHeaders: jest.fn(),
},
isTlsEnabled: false,
- config: {},
};
setupContract.createCookieSessionStorageFactory.mockResolvedValue(
sessionStorageMock.createFactory()
diff --git a/src/core/server/http/http_service.test.mocks.ts b/src/core/server/http/http_service.test.mocks.ts
index c147944f2b7d8..e18008d3b405d 100644
--- a/src/core/server/http/http_service.test.mocks.ts
+++ b/src/core/server/http/http_service.test.mocks.ts
@@ -27,3 +27,7 @@ jest.mock('./http_server', () => {
HttpServer: mockHttpServer,
};
});
+
+jest.mock('./lifecycle_handlers', () => ({
+ registerCoreHandlers: jest.fn(),
+}));
diff --git a/src/core/server/http/http_service.ts b/src/core/server/http/http_service.ts
index faeae0b559b6b..ae9d53f9fd3db 100644
--- a/src/core/server/http/http_service.ts
+++ b/src/core/server/http/http_service.ts
@@ -21,11 +21,10 @@ import { Observable, Subscription, combineLatest } from 'rxjs';
import { first, map } from 'rxjs/operators';
import { Server } from 'hapi';
-import { LoggerFactory } from '../logging';
import { CoreService } from '../../types';
-
-import { Logger } from '../logging';
+import { Logger, LoggerFactory } from '../logging';
import { ContextSetup } from '../context';
+import { Env } from '../config';
import { CoreContext } from '../core_context';
import { PluginOpaqueId } from '../plugins';
import { CspConfigType, config as cspConfig } from '../csp';
@@ -43,6 +42,7 @@ import {
} from './types';
import { RequestHandlerContext } from '../../server';
+import { registerCoreHandlers } from './lifecycle_handlers';
interface SetupDeps {
context: ContextSetup;
@@ -57,6 +57,7 @@ export class HttpService implements CoreService(httpConfig.path),
- configService.atPath(cspConfig.path)
- ).pipe(map(([http, csp]) => new HttpConfig(http, csp, env)));
+ configService.atPath(cspConfig.path),
+ ]).pipe(map(([http, csp]) => new HttpConfig(http, csp)));
this.httpServer = new HttpServer(logger, 'Kibana');
this.httpsRedirectServer = new HttpsRedirectServer(logger.get('http', 'redirect', 'server'));
}
@@ -92,6 +94,9 @@ export class HttpService implements CoreService
) => this.requestHandlerContext!.registerContext(pluginOpaqueId, contextName, provider),
-
- config: {
- defaultRoute: config.defaultRoute,
- },
};
return contract;
diff --git a/src/core/server/http/http_tools.test.ts b/src/core/server/http/http_tools.test.ts
index b889ebd64971f..c1322a5aa94db 100644
--- a/src/core/server/http/http_tools.test.ts
+++ b/src/core/server/http/http_tools.test.ts
@@ -31,8 +31,6 @@ import { HttpConfig, config } from './http_config';
import { Router } from './router';
import { loggingServiceMock } from '../logging/logging_service.mock';
import { ByteSizeValue } from '@kbn/config-schema';
-import { Env } from '../config';
-import { getEnvOptions } from '../config/__mocks__/env';
const emptyOutput = {
statusCode: 400,
@@ -122,8 +120,7 @@ describe('getServerOptions', () => {
certificate: 'some-certificate-path',
},
}),
- {} as any,
- Env.createDefault(getEnvOptions())
+ {} as any
);
expect(getServerOptions(httpConfig).tls).toMatchInlineSnapshot(`
@@ -152,8 +149,7 @@ describe('getServerOptions', () => {
clientAuthentication: 'required',
},
}),
- {} as any,
- Env.createDefault(getEnvOptions())
+ {} as any
);
expect(getServerOptions(httpConfig).tls).toMatchInlineSnapshot(`
diff --git a/src/core/server/http/integration_tests/lifecycle_handlers.test.ts b/src/core/server/http/integration_tests/lifecycle_handlers.test.ts
new file mode 100644
index 0000000000000..f4c5f16870c7e
--- /dev/null
+++ b/src/core/server/http/integration_tests/lifecycle_handlers.test.ts
@@ -0,0 +1,241 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { resolve } from 'path';
+import supertest from 'supertest';
+import { BehaviorSubject } from 'rxjs';
+import { ByteSizeValue } from '@kbn/config-schema';
+
+import { createHttpServer } from '../test_utils';
+import { HttpService } from '../http_service';
+import { HttpServerSetup } from '../http_server';
+import { IRouter, RouteRegistrar } from '../router';
+
+import { configServiceMock } from '../../config/config_service.mock';
+import { contextServiceMock } from '../../context/context_service.mock';
+
+const pkgPath = resolve(__dirname, '../../../../../package.json');
+const actualVersion = require(pkgPath).version;
+const versionHeader = 'kbn-version';
+const xsrfHeader = 'kbn-xsrf';
+const nameHeader = 'kbn-name';
+const whitelistedTestPath = '/xsrf/test/route/whitelisted';
+const kibanaName = 'my-kibana-name';
+const setupDeps = {
+ context: contextServiceMock.createSetupContract(),
+};
+
+describe('core lifecycle handlers', () => {
+ let server: HttpService;
+ let innerServer: HttpServerSetup['server'];
+ let router: IRouter;
+
+ beforeEach(async () => {
+ const configService = configServiceMock.create();
+ configService.atPath.mockReturnValue(
+ new BehaviorSubject({
+ hosts: ['localhost'],
+ maxPayload: new ByteSizeValue(1024),
+ autoListen: true,
+ ssl: {
+ enabled: false,
+ },
+ compression: { enabled: true },
+ name: kibanaName,
+ customResponseHeaders: {
+ 'some-header': 'some-value',
+ },
+ xsrf: { disableProtection: false, whitelist: [whitelistedTestPath] },
+ } as any)
+ );
+ server = createHttpServer({ configService });
+
+ const serverSetup = await server.setup(setupDeps);
+ router = serverSetup.createRouter('/');
+ innerServer = serverSetup.server;
+ }, 30000);
+
+ afterEach(async () => {
+ await server.stop();
+ });
+
+ describe('versionCheck post-auth handler', () => {
+ const testRoute = '/version_check/test/route';
+
+ beforeEach(async () => {
+ router.get({ path: testRoute, validate: false }, (context, req, res) => {
+ return res.ok({ body: 'ok' });
+ });
+ await server.start();
+ });
+
+ it('accepts requests with the correct version passed in the version header', async () => {
+ await supertest(innerServer.listener)
+ .get(testRoute)
+ .set(versionHeader, actualVersion)
+ .expect(200, 'ok');
+ });
+
+ it('accepts requests that do not include a version header', async () => {
+ await supertest(innerServer.listener)
+ .get(testRoute)
+ .expect(200, 'ok');
+ });
+
+ it('rejects requests with an incorrect version passed in the version header', async () => {
+ await supertest(innerServer.listener)
+ .get(testRoute)
+ .set(versionHeader, 'invalid-version')
+ .expect(400, /Browser client is out of date/);
+ });
+ });
+
+ describe('customHeaders pre-response handler', () => {
+ const testRoute = '/custom_headers/test/route';
+ const testErrorRoute = '/custom_headers/test/error_route';
+
+ beforeEach(async () => {
+ router.get({ path: testRoute, validate: false }, (context, req, res) => {
+ return res.ok({ body: 'ok' });
+ });
+ router.get({ path: testErrorRoute, validate: false }, (context, req, res) => {
+ return res.badRequest({ body: 'bad request' });
+ });
+ await server.start();
+ });
+
+ it('adds the kbn-name header', async () => {
+ const result = await supertest(innerServer.listener)
+ .get(testRoute)
+ .expect(200, 'ok');
+ const headers = result.header as Record;
+ expect(headers).toEqual(
+ expect.objectContaining({
+ [nameHeader]: kibanaName,
+ })
+ );
+ });
+
+ it('adds the kbn-name header in case of error', async () => {
+ const result = await supertest(innerServer.listener)
+ .get(testErrorRoute)
+ .expect(400);
+ const headers = result.header as Record;
+ expect(headers).toEqual(
+ expect.objectContaining({
+ [nameHeader]: kibanaName,
+ })
+ );
+ });
+
+ it('adds the custom headers', async () => {
+ const result = await supertest(innerServer.listener)
+ .get(testRoute)
+ .expect(200, 'ok');
+ const headers = result.header as Record;
+ expect(headers).toEqual(expect.objectContaining({ 'some-header': 'some-value' }));
+ });
+
+ it('adds the custom headers in case of error', async () => {
+ const result = await supertest(innerServer.listener)
+ .get(testErrorRoute)
+ .expect(400);
+ const headers = result.header as Record;
+ expect(headers).toEqual(expect.objectContaining({ 'some-header': 'some-value' }));
+ });
+ });
+
+ describe('xsrf post-auth handler', () => {
+ const testPath = '/xsrf/test/route';
+ const destructiveMethods = ['POST', 'PUT', 'DELETE'];
+ const nonDestructiveMethods = ['GET', 'HEAD'];
+
+ const getSupertest = (method: string, path: string): supertest.Test => {
+ return (supertest(innerServer.listener) as any)[method.toLowerCase()](path) as supertest.Test;
+ };
+
+ beforeEach(async () => {
+ router.get({ path: testPath, validate: false }, (context, req, res) => {
+ return res.ok({ body: 'ok' });
+ });
+
+ destructiveMethods.forEach(method => {
+ ((router as any)[method.toLowerCase()] as RouteRegistrar)(
+ { path: testPath, validate: false },
+ (context, req, res) => {
+ return res.ok({ body: 'ok' });
+ }
+ );
+ ((router as any)[method.toLowerCase()] as RouteRegistrar)(
+ { path: whitelistedTestPath, validate: false },
+ (context, req, res) => {
+ return res.ok({ body: 'ok' });
+ }
+ );
+ });
+
+ await server.start();
+ });
+
+ nonDestructiveMethods.forEach(method => {
+ describe(`When using non-destructive ${method} method`, () => {
+ it('accepts requests without a token', async () => {
+ await getSupertest(method.toLowerCase(), testPath).expect(
+ 200,
+ method === 'HEAD' ? undefined : 'ok'
+ );
+ });
+
+ it('accepts requests with the xsrf header', async () => {
+ await getSupertest(method.toLowerCase(), testPath)
+ .set(xsrfHeader, 'anything')
+ .expect(200, method === 'HEAD' ? undefined : 'ok');
+ });
+ });
+ });
+
+ destructiveMethods.forEach(method => {
+ describe(`When using destructive ${method} method`, () => {
+ it('accepts requests with the xsrf header', async () => {
+ await getSupertest(method.toLowerCase(), testPath)
+ .set(xsrfHeader, 'anything')
+ .expect(200, 'ok');
+ });
+
+ it('accepts requests with the version header', async () => {
+ await getSupertest(method.toLowerCase(), testPath)
+ .set(versionHeader, actualVersion)
+ .expect(200, 'ok');
+ });
+
+ it('rejects requests without either an xsrf or version header', async () => {
+ await getSupertest(method.toLowerCase(), testPath).expect(400, {
+ statusCode: 400,
+ error: 'Bad Request',
+ message: 'Request must contain a kbn-xsrf header.',
+ });
+ });
+
+ it('accepts whitelisted requests without either an xsrf or version header', async () => {
+ await getSupertest(method.toLowerCase(), whitelistedTestPath).expect(200, 'ok');
+ });
+ });
+ });
+ });
+});
diff --git a/src/core/server/http/lifecycle_handlers.test.ts b/src/core/server/http/lifecycle_handlers.test.ts
new file mode 100644
index 0000000000000..48a6973b741ba
--- /dev/null
+++ b/src/core/server/http/lifecycle_handlers.test.ts
@@ -0,0 +1,269 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+ createCustomHeadersPreResponseHandler,
+ createVersionCheckPostAuthHandler,
+ createXsrfPostAuthHandler,
+} from './lifecycle_handlers';
+import { httpServerMock } from './http_server.mocks';
+import { HttpConfig } from './http_config';
+import { KibanaRequest, RouteMethod } from './router';
+
+const createConfig = (partial: Partial): HttpConfig => partial as HttpConfig;
+
+const forgeRequest = ({
+ headers = {},
+ path = '/',
+ method = 'get',
+}: Partial<{
+ headers: Record;
+ path: string;
+ method: RouteMethod;
+}>): KibanaRequest => {
+ return httpServerMock.createKibanaRequest({ headers, path, method });
+};
+
+describe('xsrf post-auth handler', () => {
+ let toolkit: ReturnType;
+ let responseFactory: ReturnType;
+
+ beforeEach(() => {
+ toolkit = httpServerMock.createToolkit();
+ responseFactory = httpServerMock.createLifecycleResponseFactory();
+ });
+
+ describe('non destructive methods', () => {
+ it('accepts requests without version or xsrf header', () => {
+ const config = createConfig({ xsrf: { whitelist: [], disableProtection: false } });
+ const handler = createXsrfPostAuthHandler(config);
+ const request = forgeRequest({ method: 'get', headers: {} });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(result).toEqual('next');
+ });
+ });
+
+ describe('destructive methods', () => {
+ it('accepts requests with xsrf header', () => {
+ const config = createConfig({ xsrf: { whitelist: [], disableProtection: false } });
+ const handler = createXsrfPostAuthHandler(config);
+ const request = forgeRequest({ method: 'post', headers: { 'kbn-xsrf': 'xsrf' } });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(result).toEqual('next');
+ });
+
+ it('accepts requests with version header', () => {
+ const config = createConfig({ xsrf: { whitelist: [], disableProtection: false } });
+ const handler = createXsrfPostAuthHandler(config);
+ const request = forgeRequest({ method: 'post', headers: { 'kbn-version': 'some-version' } });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(result).toEqual('next');
+ });
+
+ it('returns a bad request if called without xsrf or version header', () => {
+ const config = createConfig({ xsrf: { whitelist: [], disableProtection: false } });
+ const handler = createXsrfPostAuthHandler(config);
+ const request = forgeRequest({ method: 'post' });
+
+ responseFactory.badRequest.mockReturnValue('badRequest' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(toolkit.next).not.toHaveBeenCalled();
+ expect(responseFactory.badRequest).toHaveBeenCalledTimes(1);
+ expect(responseFactory.badRequest.mock.calls[0][0]).toMatchInlineSnapshot(`
+ Object {
+ "body": "Request must contain a kbn-xsrf header.",
+ }
+ `);
+ expect(result).toEqual('badRequest');
+ });
+
+ it('accepts requests if protection is disabled', () => {
+ const config = createConfig({ xsrf: { whitelist: [], disableProtection: true } });
+ const handler = createXsrfPostAuthHandler(config);
+ const request = forgeRequest({ method: 'post', headers: {} });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(result).toEqual('next');
+ });
+
+ it('accepts requests if path is whitelisted', () => {
+ const config = createConfig({
+ xsrf: { whitelist: ['/some-path'], disableProtection: false },
+ });
+ const handler = createXsrfPostAuthHandler(config);
+ const request = forgeRequest({ method: 'post', headers: {}, path: '/some-path' });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(result).toEqual('next');
+ });
+ });
+});
+
+describe('versionCheck post-auth handler', () => {
+ let toolkit: ReturnType;
+ let responseFactory: ReturnType;
+
+ beforeEach(() => {
+ toolkit = httpServerMock.createToolkit();
+ responseFactory = httpServerMock.createLifecycleResponseFactory();
+ });
+
+ it('forward the request to the next interceptor if header matches', () => {
+ const handler = createVersionCheckPostAuthHandler('actual-version');
+ const request = forgeRequest({ headers: { 'kbn-version': 'actual-version' } });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(result).toBe('next');
+ });
+
+ it('returns a badRequest error if header does not match', () => {
+ const handler = createVersionCheckPostAuthHandler('actual-version');
+ const request = forgeRequest({ headers: { 'kbn-version': 'another-version' } });
+
+ responseFactory.badRequest.mockReturnValue('badRequest' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(toolkit.next).not.toHaveBeenCalled();
+ expect(responseFactory.badRequest).toHaveBeenCalledTimes(1);
+ expect(responseFactory.badRequest.mock.calls[0][0]).toMatchInlineSnapshot(`
+ Object {
+ "body": Object {
+ "attributes": Object {
+ "expected": "actual-version",
+ "got": "another-version",
+ },
+ "message": "Browser client is out of date, please refresh the page (\\"kbn-version\\" header was \\"another-version\\" but should be \\"actual-version\\")",
+ },
+ }
+ `);
+ expect(result).toBe('badRequest');
+ });
+
+ it('forward the request to the next interceptor if header is not present', () => {
+ const handler = createVersionCheckPostAuthHandler('actual-version');
+ const request = forgeRequest({ headers: {} });
+
+ toolkit.next.mockReturnValue('next' as any);
+
+ const result = handler(request, responseFactory, toolkit);
+
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(responseFactory.badRequest).not.toHaveBeenCalled();
+ expect(result).toBe('next');
+ });
+});
+
+describe('customHeaders pre-response handler', () => {
+ let toolkit: ReturnType;
+
+ beforeEach(() => {
+ toolkit = httpServerMock.createToolkit();
+ });
+
+ it('adds the kbn-name header to the response', () => {
+ const config = createConfig({ name: 'my-server-name' });
+ const handler = createCustomHeadersPreResponseHandler(config as HttpConfig);
+
+ handler({} as any, {} as any, toolkit);
+
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(toolkit.next).toHaveBeenCalledWith({ headers: { 'kbn-name': 'my-server-name' } });
+ });
+
+ it('adds the custom headers defined in the configuration', () => {
+ const config = createConfig({
+ name: 'my-server-name',
+ customResponseHeaders: {
+ headerA: 'value-A',
+ headerB: 'value-B',
+ },
+ });
+ const handler = createCustomHeadersPreResponseHandler(config as HttpConfig);
+
+ handler({} as any, {} as any, toolkit);
+
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(toolkit.next).toHaveBeenCalledWith({
+ headers: {
+ 'kbn-name': 'my-server-name',
+ headerA: 'value-A',
+ headerB: 'value-B',
+ },
+ });
+ });
+
+ it('preserve the kbn-name value from server.name if definied in custom headders ', () => {
+ const config = createConfig({
+ name: 'my-server-name',
+ customResponseHeaders: {
+ 'kbn-name': 'custom-name',
+ headerA: 'value-A',
+ headerB: 'value-B',
+ },
+ });
+ const handler = createCustomHeadersPreResponseHandler(config as HttpConfig);
+
+ handler({} as any, {} as any, toolkit);
+
+ expect(toolkit.next).toHaveBeenCalledTimes(1);
+ expect(toolkit.next).toHaveBeenCalledWith({
+ headers: {
+ 'kbn-name': 'my-server-name',
+ headerA: 'value-A',
+ headerB: 'value-B',
+ },
+ });
+ });
+});
diff --git a/src/core/server/http/lifecycle_handlers.ts b/src/core/server/http/lifecycle_handlers.ts
new file mode 100644
index 0000000000000..ee877ee031a2b
--- /dev/null
+++ b/src/core/server/http/lifecycle_handlers.ts
@@ -0,0 +1,93 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { OnPostAuthHandler } from './lifecycle/on_post_auth';
+import { OnPreResponseHandler } from './lifecycle/on_pre_response';
+import { HttpConfig } from './http_config';
+import { Env } from '../config';
+import { LifecycleRegistrar } from './http_server';
+
+const VERSION_HEADER = 'kbn-version';
+const XSRF_HEADER = 'kbn-xsrf';
+const KIBANA_NAME_HEADER = 'kbn-name';
+
+export const createXsrfPostAuthHandler = (config: HttpConfig): OnPostAuthHandler => {
+ const { whitelist, disableProtection } = config.xsrf;
+
+ return (request, response, toolkit) => {
+ if (disableProtection || whitelist.includes(request.route.path)) {
+ return toolkit.next();
+ }
+
+ const isSafeMethod = request.route.method === 'get' || request.route.method === 'head';
+ const hasVersionHeader = VERSION_HEADER in request.headers;
+ const hasXsrfHeader = XSRF_HEADER in request.headers;
+
+ if (!isSafeMethod && !hasVersionHeader && !hasXsrfHeader) {
+ return response.badRequest({ body: `Request must contain a ${XSRF_HEADER} header.` });
+ }
+
+ return toolkit.next();
+ };
+};
+
+export const createVersionCheckPostAuthHandler = (kibanaVersion: string): OnPostAuthHandler => {
+ return (request, response, toolkit) => {
+ const requestVersion = request.headers[VERSION_HEADER];
+ if (requestVersion && requestVersion !== kibanaVersion) {
+ return response.badRequest({
+ body: {
+ message:
+ `Browser client is out of date, please refresh the page ` +
+ `("${VERSION_HEADER}" header was "${requestVersion}" but should be "${kibanaVersion}")`,
+ attributes: {
+ expected: kibanaVersion,
+ got: requestVersion,
+ },
+ },
+ });
+ }
+
+ return toolkit.next();
+ };
+};
+
+export const createCustomHeadersPreResponseHandler = (config: HttpConfig): OnPreResponseHandler => {
+ const serverName = config.name;
+ const customHeaders = config.customResponseHeaders;
+
+ return (request, response, toolkit) => {
+ const additionalHeaders = {
+ ...customHeaders,
+ [KIBANA_NAME_HEADER]: serverName,
+ };
+
+ return toolkit.next({ headers: additionalHeaders });
+ };
+};
+
+export const registerCoreHandlers = (
+ registrar: LifecycleRegistrar,
+ config: HttpConfig,
+ env: Env
+) => {
+ registrar.registerOnPreResponse(createCustomHeadersPreResponseHandler(config));
+ registrar.registerOnPostAuth(createXsrfPostAuthHandler(config));
+ registrar.registerOnPostAuth(createVersionCheckPostAuthHandler(env.packageInfo.version));
+};
diff --git a/src/core/server/http/test_utils.ts b/src/core/server/http/test_utils.ts
index e0a15cdc6e839..ffdc04d156ca0 100644
--- a/src/core/server/http/test_utils.ts
+++ b/src/core/server/http/test_utils.ts
@@ -41,6 +41,10 @@ configService.atPath.mockReturnValue(
enabled: false,
},
compression: { enabled: true },
+ xsrf: {
+ disableProtection: true,
+ whitelist: [],
+ },
} as any)
);
diff --git a/src/core/server/http/types.ts b/src/core/server/http/types.ts
index 92217515a22a1..9c8bfc073a524 100644
--- a/src/core/server/http/types.ts
+++ b/src/core/server/http/types.ts
@@ -250,16 +250,6 @@ export interface InternalHttpServiceSetup
contextName: T,
provider: RequestHandlerContextProvider
) => RequestHandlerContextContainer;
- config: {
- /**
- * @internalRemarks
- * Deprecated part of the server config, provided until
- * /~https://github.com/elastic/kibana/issues/40255
- *
- * @deprecated
- * */
- defaultRoute?: string;
- };
}
/** @public */
diff --git a/src/core/server/internal_types.ts b/src/core/server/internal_types.ts
index be4d830c55eab..ff68d1544d119 100644
--- a/src/core/server/internal_types.ts
+++ b/src/core/server/internal_types.ts
@@ -17,7 +17,10 @@
* under the License.
*/
+import { Type } from '@kbn/config-schema';
+
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
+import { ConfigDeprecationProvider } from './config';
import { ContextSetup } from './context';
import { InternalElasticsearchServiceSetup } from './elasticsearch';
import { InternalHttpServiceSetup } from './http';
@@ -47,3 +50,18 @@ export interface InternalCoreStart {
savedObjects: InternalSavedObjectsServiceStart;
uiSettings: InternalUiSettingsServiceStart;
}
+
+/**
+ * @internal
+ */
+export interface ServiceConfigDescriptor {
+ path: string;
+ /**
+ * Schema to use to validate the configuration.
+ */
+ schema: Type;
+ /**
+ * Provider for the {@link ConfigDeprecation} to apply to the plugin configuration.
+ */
+ deprecations?: ConfigDeprecationProvider;
+}
diff --git a/src/core/server/legacy/config/__snapshots__/legacy_object_to_config_adapter.test.ts.snap b/src/core/server/legacy/config/__snapshots__/legacy_object_to_config_adapter.test.ts.snap
index 0ebd8b8371628..74ecaa9f09c0e 100644
--- a/src/core/server/legacy/config/__snapshots__/legacy_object_to_config_adapter.test.ts.snap
+++ b/src/core/server/legacy/config/__snapshots__/legacy_object_to_config_adapter.test.ts.snap
@@ -8,10 +8,13 @@ Object {
"enabled": true,
},
"cors": false,
- "defaultRoute": undefined,
+ "customResponseHeaders": Object {
+ "custom-header": "custom-value",
+ },
"host": "host",
"keepaliveTimeout": 5000,
"maxPayload": 1000,
+ "name": "kibana-hostname",
"port": 1234,
"rewriteBasePath": false,
"socketTimeout": 2000,
@@ -21,6 +24,10 @@ Object {
"someNewValue": "new",
},
"uuid": undefined,
+ "xsrf": Object {
+ "disableProtection": false,
+ "whitelist": Array [],
+ },
}
`;
@@ -32,10 +39,13 @@ Object {
"enabled": true,
},
"cors": false,
- "defaultRoute": undefined,
+ "customResponseHeaders": Object {
+ "custom-header": "custom-value",
+ },
"host": "host",
"keepaliveTimeout": 5000,
"maxPayload": 1000,
+ "name": "kibana-hostname",
"port": 1234,
"rewriteBasePath": false,
"socketTimeout": 2000,
@@ -45,6 +55,10 @@ Object {
"key": "key",
},
"uuid": undefined,
+ "xsrf": Object {
+ "disableProtection": false,
+ "whitelist": Array [],
+ },
}
`;
diff --git a/src/core/server/legacy/config/legacy_object_to_config_adapter.test.ts b/src/core/server/legacy/config/legacy_object_to_config_adapter.test.ts
index db2bc117280ca..1c51564187442 100644
--- a/src/core/server/legacy/config/legacy_object_to_config_adapter.test.ts
+++ b/src/core/server/legacy/config/legacy_object_to_config_adapter.test.ts
@@ -80,9 +80,11 @@ describe('#get', () => {
test('correctly handles server config.', () => {
const configAdapter = new LegacyObjectToConfigAdapter({
server: {
+ name: 'kibana-hostname',
autoListen: true,
basePath: '/abc',
cors: false,
+ customResponseHeaders: { 'custom-header': 'custom-value' },
host: 'host',
maxPayloadBytes: 1000,
keepaliveTimeout: 5000,
@@ -92,14 +94,20 @@ describe('#get', () => {
ssl: { enabled: true, keyPassphrase: 'some-phrase', someNewValue: 'new' },
compression: { enabled: true },
someNotSupportedValue: 'val',
+ xsrf: {
+ disableProtection: false,
+ whitelist: [],
+ },
},
});
const configAdapterWithDisabledSSL = new LegacyObjectToConfigAdapter({
server: {
+ name: 'kibana-hostname',
autoListen: true,
basePath: '/abc',
cors: false,
+ customResponseHeaders: { 'custom-header': 'custom-value' },
host: 'host',
maxPayloadBytes: 1000,
keepaliveTimeout: 5000,
@@ -109,6 +117,10 @@ describe('#get', () => {
ssl: { enabled: false, certificate: 'cert', key: 'key' },
compression: { enabled: true },
someNotSupportedValue: 'val',
+ xsrf: {
+ disableProtection: false,
+ whitelist: [],
+ },
},
});
diff --git a/src/core/server/legacy/config/legacy_object_to_config_adapter.ts b/src/core/server/legacy/config/legacy_object_to_config_adapter.ts
index bdcde8262ef98..30bb150e6c15a 100644
--- a/src/core/server/legacy/config/legacy_object_to_config_adapter.ts
+++ b/src/core/server/legacy/config/legacy_object_to_config_adapter.ts
@@ -60,14 +60,15 @@ export class LegacyObjectToConfigAdapter extends ObjectToConfigAdapter {
private static transformServer(configValue: any = {}) {
// TODO: New platform uses just a subset of `server` config from the legacy platform,
- // new values will be exposed once we need them (eg. customResponseHeaders or xsrf).
+ // new values will be exposed once we need them
return {
autoListen: configValue.autoListen,
basePath: configValue.basePath,
- defaultRoute: configValue.defaultRoute,
cors: configValue.cors,
+ customResponseHeaders: configValue.customResponseHeaders,
host: configValue.host,
maxPayload: configValue.maxPayloadBytes,
+ name: configValue.name,
port: configValue.port,
rewriteBasePath: configValue.rewriteBasePath,
ssl: configValue.ssl,
@@ -75,6 +76,7 @@ export class LegacyObjectToConfigAdapter extends ObjectToConfigAdapter {
socketTimeout: configValue.socketTimeout,
compression: configValue.compression,
uuid: configValue.uuid,
+ xsrf: configValue.xsrf,
};
}
diff --git a/src/core/server/legacy/legacy_service.ts b/src/core/server/legacy/legacy_service.ts
index 2ed87f4c6d488..e17de7364ce59 100644
--- a/src/core/server/legacy/legacy_service.ts
+++ b/src/core/server/legacy/legacy_service.ts
@@ -84,7 +84,7 @@ export class LegacyService implements CoreService {
private settings?: LegacyVars;
constructor(private readonly coreContext: CoreContext) {
- const { logger, configService, env } = coreContext;
+ const { logger, configService } = coreContext;
this.log = logger.get('legacy-service');
this.devConfig$ = configService
@@ -93,7 +93,7 @@ export class LegacyService implements CoreService {
this.httpConfig$ = combineLatest(
configService.atPath(httpConfig.path),
configService.atPath(cspConfig.path)
- ).pipe(map(([http, csp]) => new HttpConfig(http, csp, env)));
+ ).pipe(map(([http, csp]) => new HttpConfig(http, csp)));
}
public async discoverPlugins(): Promise {
diff --git a/src/core/server/plugins/discovery/plugins_discovery.test.ts b/src/core/server/plugins/discovery/plugins_discovery.test.ts
index bf55fc7caae4c..2902aafdbf146 100644
--- a/src/core/server/plugins/discovery/plugins_discovery.test.ts
+++ b/src/core/server/plugins/discovery/plugins_discovery.test.ts
@@ -18,13 +18,14 @@
*/
import { mockPackage, mockReaddir, mockReadFile, mockStat } from './plugins_discovery.test.mocks';
+import { rawConfigServiceMock } from '../../config/raw_config_service.mock';
+import { loggingServiceMock } from '../../logging/logging_service.mock';
import { resolve } from 'path';
import { first, map, toArray } from 'rxjs/operators';
+
import { ConfigService, Env } from '../../config';
-import { rawConfigServiceMock } from '../../config/raw_config_service.mock';
import { getEnvOptions } from '../../config/__mocks__/env';
-import { loggingServiceMock } from '../../logging/logging_service.mock';
import { PluginWrapper } from '../plugin';
import { PluginsConfig, PluginsConfigType, config } from '../plugins_config';
import { discover } from './plugins_discovery';
@@ -37,6 +38,7 @@ const TEST_PLUGIN_SEARCH_PATHS = {
const TEST_EXTRA_PLUGIN_PATH = resolve(process.cwd(), 'my-extra-plugin');
const logger = loggingServiceMock.create();
+
beforeEach(() => {
mockReaddir.mockImplementation((path, cb) => {
if (path === TEST_PLUGIN_SEARCH_PATHS.nonEmptySrcPlugins) {
@@ -182,12 +184,84 @@ test('properly iterates through plugin search locations', async () => {
'kibana.json'
)})`,
]);
+});
+
+test('logs a warning about --plugin-path when used in development', async () => {
+ mockPackage.raw = {
+ branch: 'master',
+ version: '1.2.3',
+ build: {
+ distributable: true,
+ number: 1,
+ sha: '',
+ },
+ };
+
+ const env = Env.createDefault(
+ getEnvOptions({
+ cliArgs: { dev: false, envName: 'development' },
+ })
+ );
+ const configService = new ConfigService(
+ rawConfigServiceMock.create({ rawConfig: { plugins: { paths: [TEST_EXTRA_PLUGIN_PATH] } } }),
+ env,
+ logger
+ );
+ await configService.setSchema(config.path, config.schema);
+
+ const rawConfig = await configService
+ .atPath('plugins')
+ .pipe(first())
+ .toPromise();
+
+ discover(new PluginsConfig(rawConfig, env), {
+ coreId: Symbol(),
+ configService,
+ env,
+ logger,
+ });
+
+ expect(loggingServiceMock.collect(logger).warn).toEqual([
+ [
+ `Explicit plugin paths [${TEST_EXTRA_PLUGIN_PATH}] should only be used in development. Relative imports may not work properly in production.`,
+ ],
+ ]);
+});
+
+test('does not log a warning about --plugin-path when used in production', async () => {
+ mockPackage.raw = {
+ branch: 'master',
+ version: '1.2.3',
+ build: {
+ distributable: true,
+ number: 1,
+ sha: '',
+ },
+ };
+
+ const env = Env.createDefault(
+ getEnvOptions({
+ cliArgs: { dev: false, envName: 'production' },
+ })
+ );
+ const configService = new ConfigService(
+ rawConfigServiceMock.create({ rawConfig: { plugins: { paths: [TEST_EXTRA_PLUGIN_PATH] } } }),
+ env,
+ logger
+ );
+ await configService.setSchema(config.path, config.schema);
+
+ const rawConfig = await configService
+ .atPath('plugins')
+ .pipe(first())
+ .toPromise();
+
+ discover(new PluginsConfig(rawConfig, env), {
+ coreId: Symbol(),
+ configService,
+ env,
+ logger,
+ });
- expect(loggingServiceMock.collect(logger).warn).toMatchInlineSnapshot(`
-Array [
- Array [
- "Explicit plugin paths [${TEST_EXTRA_PLUGIN_PATH}] are only supported in development. Relative imports will not work in production.",
- ],
-]
-`);
+ expect(loggingServiceMock.collect(logger).warn).toEqual([]);
});
diff --git a/src/core/server/plugins/discovery/plugins_discovery.ts b/src/core/server/plugins/discovery/plugins_discovery.ts
index 521d02e487df6..79238afdf5c81 100644
--- a/src/core/server/plugins/discovery/plugins_discovery.ts
+++ b/src/core/server/plugins/discovery/plugins_discovery.ts
@@ -46,9 +46,9 @@ export function discover(config: PluginsConfig, coreContext: CoreContext) {
const log = coreContext.logger.get('plugins-discovery');
log.debug('Discovering plugins...');
- if (config.additionalPluginPaths.length) {
+ if (config.additionalPluginPaths.length && coreContext.env.mode.dev) {
log.warn(
- `Explicit plugin paths [${config.additionalPluginPaths}] are only supported in development. Relative imports will not work in production.`
+ `Explicit plugin paths [${config.additionalPluginPaths}] should only be used in development. Relative imports may not work properly in production.`
);
}
diff --git a/src/core/server/plugins/plugins_config.test.ts b/src/core/server/plugins/plugins_config.test.ts
new file mode 100644
index 0000000000000..180d6093e0404
--- /dev/null
+++ b/src/core/server/plugins/plugins_config.test.ts
@@ -0,0 +1,44 @@
+/*
+ * Licensed to Elasticsearch B.V. under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch B.V. licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { PluginsConfig, PluginsConfigType } from './plugins_config';
+import { Env } from '../config';
+import { getEnvOptions } from '../config/__mocks__/env';
+
+describe('PluginsConfig', () => {
+ it('retrieves additionalPluginPaths from config.paths when in production mode', () => {
+ const env = Env.createDefault(getEnvOptions({ cliArgs: { dev: false } }));
+ const rawConfig: PluginsConfigType = {
+ initialize: true,
+ paths: ['some-path', 'another-path'],
+ };
+ const config = new PluginsConfig(rawConfig, env);
+ expect(config.additionalPluginPaths).toEqual(['some-path', 'another-path']);
+ });
+
+ it('retrieves additionalPluginPaths from config.paths when in development mode', () => {
+ const env = Env.createDefault(getEnvOptions({ cliArgs: { dev: true } }));
+ const rawConfig: PluginsConfigType = {
+ initialize: true,
+ paths: ['some-path', 'another-path'],
+ };
+ const config = new PluginsConfig(rawConfig, env);
+ expect(config.additionalPluginPaths).toEqual(['some-path', 'another-path']);
+ });
+});
diff --git a/src/core/server/plugins/plugins_config.ts b/src/core/server/plugins/plugins_config.ts
index 93ae229737fae..8ebcc92672dde 100644
--- a/src/core/server/plugins/plugins_config.ts
+++ b/src/core/server/plugins/plugins_config.ts
@@ -29,7 +29,6 @@ export const config = {
/**
* Defines an array of directories where another plugin should be loaded from.
- * Should only be used in a development environment.
*/
paths: schema.arrayOf(schema.string(), { defaultValue: [] }),
}),
@@ -55,7 +54,6 @@ export class PluginsConfig {
constructor(rawConfig: PluginsConfigType, env: Env) {
this.initialize = rawConfig.initialize;
this.pluginSearchPaths = env.pluginSearchPaths;
- // Only allow custom plugin paths in dev.
- this.additionalPluginPaths = env.mode.dev ? rawConfig.paths : [];
+ this.additionalPluginPaths = rawConfig.paths;
}
}
diff --git a/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap b/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap
index edde1dee85f4f..5e6e977663bc4 100644
--- a/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap
+++ b/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap
@@ -18,6 +18,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -39,7 +40,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -89,6 +89,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -110,7 +111,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -160,6 +160,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -181,7 +182,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -235,6 +235,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -256,7 +257,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/translations/en.json",
@@ -306,6 +306,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -327,7 +328,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -377,6 +377,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -398,7 +399,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -448,6 +448,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -469,7 +470,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/translations/en.json",
@@ -519,6 +519,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -540,7 +541,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -592,6 +592,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -613,7 +614,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
@@ -663,6 +663,7 @@ Object {
"oss": false,
"quiet": false,
"repl": false,
+ "runExamples": false,
"silent": false,
"watch": false,
},
@@ -684,7 +685,6 @@ Object {
"version": Any,
},
"pluginSearchPaths": Any,
- "staticFilesDir": Any,
},
"i18n": Object {
"translationsUrl": "/mock-server-basepath/translations/en.json",
diff --git a/src/core/server/rendering/rendering_service.test.ts b/src/core/server/rendering/rendering_service.test.ts
index 63145f2b30573..43ff4f633085c 100644
--- a/src/core/server/rendering/rendering_service.test.ts
+++ b/src/core/server/rendering/rendering_service.test.ts
@@ -41,7 +41,6 @@ const INJECTED_METADATA = {
version: expect.any(String),
},
pluginSearchPaths: expect.any(Array),
- staticFilesDir: expect.any(String),
},
legacyMetadata: {
branch: expect.any(String),
@@ -50,6 +49,7 @@ const INJECTED_METADATA = {
version: expect.any(String),
},
};
+
const { createKibanaRequest, createRawRequest } = httpServerMock;
const legacyApp = { getId: () => 'legacy' };
diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md
index 48293eda44d33..35359c5d6c417 100644
--- a/src/core/server/server.api.md
+++ b/src/core/server/server.api.md
@@ -1,1980 +1,1979 @@
-## API Report File for "kibana"
-
-> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
-
-```ts
-
-import Boom from 'boom';
-import { BulkIndexDocumentsParams } from 'elasticsearch';
-import { CatAliasesParams } from 'elasticsearch';
-import { CatAllocationParams } from 'elasticsearch';
-import { CatCommonParams } from 'elasticsearch';
-import { CatFielddataParams } from 'elasticsearch';
-import { CatHealthParams } from 'elasticsearch';
-import { CatHelpParams } from 'elasticsearch';
-import { CatIndicesParams } from 'elasticsearch';
-import { CatRecoveryParams } from 'elasticsearch';
-import { CatSegmentsParams } from 'elasticsearch';
-import { CatShardsParams } from 'elasticsearch';
-import { CatSnapshotsParams } from 'elasticsearch';
-import { CatTasksParams } from 'elasticsearch';
-import { CatThreadPoolParams } from 'elasticsearch';
-import { ClearScrollParams } from 'elasticsearch';
-import { Client } from 'elasticsearch';
-import { ClusterAllocationExplainParams } from 'elasticsearch';
-import { ClusterGetSettingsParams } from 'elasticsearch';
-import { ClusterHealthParams } from 'elasticsearch';
-import { ClusterPendingTasksParams } from 'elasticsearch';
-import { ClusterPutSettingsParams } from 'elasticsearch';
-import { ClusterRerouteParams } from 'elasticsearch';
-import { ClusterStateParams } from 'elasticsearch';
-import { ClusterStatsParams } from 'elasticsearch';
-import { ConfigOptions } from 'elasticsearch';
-import { CountParams } from 'elasticsearch';
-import { CreateDocumentParams } from 'elasticsearch';
-import { DeleteDocumentByQueryParams } from 'elasticsearch';
-import { DeleteDocumentParams } from 'elasticsearch';
-import { DeleteScriptParams } from 'elasticsearch';
-import { DeleteTemplateParams } from 'elasticsearch';
-import { DetailedPeerCertificate } from 'tls';
-import { Duration } from 'moment';
-import { ExistsParams } from 'elasticsearch';
-import { ExplainParams } from 'elasticsearch';
-import { FieldStatsParams } from 'elasticsearch';
-import { GenericParams } from 'elasticsearch';
-import { GetParams } from 'elasticsearch';
-import { GetResponse } from 'elasticsearch';
-import { GetScriptParams } from 'elasticsearch';
-import { GetSourceParams } from 'elasticsearch';
-import { GetTemplateParams } from 'elasticsearch';
-import { IncomingHttpHeaders } from 'http';
-import { IndexDocumentParams } from 'elasticsearch';
-import { IndicesAnalyzeParams } from 'elasticsearch';
-import { IndicesClearCacheParams } from 'elasticsearch';
-import { IndicesCloseParams } from 'elasticsearch';
-import { IndicesCreateParams } from 'elasticsearch';
-import { IndicesDeleteAliasParams } from 'elasticsearch';
-import { IndicesDeleteParams } from 'elasticsearch';
-import { IndicesDeleteTemplateParams } from 'elasticsearch';
-import { IndicesExistsAliasParams } from 'elasticsearch';
-import { IndicesExistsParams } from 'elasticsearch';
-import { IndicesExistsTemplateParams } from 'elasticsearch';
-import { IndicesExistsTypeParams } from 'elasticsearch';
-import { IndicesFlushParams } from 'elasticsearch';
-import { IndicesFlushSyncedParams } from 'elasticsearch';
-import { IndicesForcemergeParams } from 'elasticsearch';
-import { IndicesGetAliasParams } from 'elasticsearch';
-import { IndicesGetFieldMappingParams } from 'elasticsearch';
-import { IndicesGetMappingParams } from 'elasticsearch';
-import { IndicesGetParams } from 'elasticsearch';
-import { IndicesGetSettingsParams } from 'elasticsearch';
-import { IndicesGetTemplateParams } from 'elasticsearch';
-import { IndicesGetUpgradeParams } from 'elasticsearch';
-import { IndicesOpenParams } from 'elasticsearch';
-import { IndicesPutAliasParams } from 'elasticsearch';
-import { IndicesPutMappingParams } from 'elasticsearch';
-import { IndicesPutSettingsParams } from 'elasticsearch';
-import { IndicesPutTemplateParams } from 'elasticsearch';
-import { IndicesRecoveryParams } from 'elasticsearch';
-import { IndicesRefreshParams } from 'elasticsearch';
-import { IndicesRolloverParams } from 'elasticsearch';
-import { IndicesSegmentsParams } from 'elasticsearch';
-import { IndicesShardStoresParams } from 'elasticsearch';
-import { IndicesShrinkParams } from 'elasticsearch';
-import { IndicesStatsParams } from 'elasticsearch';
-import { IndicesUpdateAliasesParams } from 'elasticsearch';
-import { IndicesUpgradeParams } from 'elasticsearch';
-import { IndicesValidateQueryParams } from 'elasticsearch';
-import { InfoParams } from 'elasticsearch';
-import { IngestDeletePipelineParams } from 'elasticsearch';
-import { IngestGetPipelineParams } from 'elasticsearch';
-import { IngestPutPipelineParams } from 'elasticsearch';
-import { IngestSimulateParams } from 'elasticsearch';
-import { KibanaConfigType } from 'src/core/server/kibana_config';
-import { Logger as Logger_2 } from 'src/core/server/logging';
-import { MGetParams } from 'elasticsearch';
-import { MGetResponse } from 'elasticsearch';
-import { MSearchParams } from 'elasticsearch';
-import { MSearchResponse } from 'elasticsearch';
-import { MSearchTemplateParams } from 'elasticsearch';
-import { MTermVectorsParams } from 'elasticsearch';
-import { NodesHotThreadsParams } from 'elasticsearch';
-import { NodesInfoParams } from 'elasticsearch';
-import { NodesStatsParams } from 'elasticsearch';
-import { ObjectType } from '@kbn/config-schema';
-import { Observable } from 'rxjs';
-import { PeerCertificate } from 'tls';
-import { PingParams } from 'elasticsearch';
-import { PutScriptParams } from 'elasticsearch';
-import { PutTemplateParams } from 'elasticsearch';
-import { Readable } from 'stream';
-import { RecursiveReadonly as RecursiveReadonly_2 } from 'kibana/public';
-import { ReindexParams } from 'elasticsearch';
-import { ReindexRethrottleParams } from 'elasticsearch';
-import { RenderSearchTemplateParams } from 'elasticsearch';
-import { Request } from 'hapi';
-import { ResponseObject } from 'hapi';
-import { ResponseToolkit } from 'hapi';
-import { SchemaTypeError } from '@kbn/config-schema';
-import { ScrollParams } from 'elasticsearch';
-import { SearchParams } from 'elasticsearch';
-import { SearchResponse } from 'elasticsearch';
-import { SearchShardsParams } from 'elasticsearch';
-import { SearchTemplateParams } from 'elasticsearch';
-import { Server } from 'hapi';
-import { ShallowPromise } from '@kbn/utility-types';
-import { SnapshotCreateParams } from 'elasticsearch';
-import { SnapshotCreateRepositoryParams } from 'elasticsearch';
-import { SnapshotDeleteParams } from 'elasticsearch';
-import { SnapshotDeleteRepositoryParams } from 'elasticsearch';
-import { SnapshotGetParams } from 'elasticsearch';
-import { SnapshotGetRepositoryParams } from 'elasticsearch';
-import { SnapshotRestoreParams } from 'elasticsearch';
-import { SnapshotStatusParams } from 'elasticsearch';
-import { SnapshotVerifyRepositoryParams } from 'elasticsearch';
-import { Stream } from 'stream';
-import { SuggestParams } from 'elasticsearch';
-import { TasksCancelParams } from 'elasticsearch';
-import { TasksGetParams } from 'elasticsearch';
-import { TasksListParams } from 'elasticsearch';
-import { TermvectorsParams } from 'elasticsearch';
-import { Type } from '@kbn/config-schema';
-import { TypeOf } from '@kbn/config-schema';
-import { UpdateDocumentByQueryParams } from 'elasticsearch';
-import { UpdateDocumentParams } from 'elasticsearch';
-import { Url } from 'url';
-
-// @public (undocumented)
-export interface APICaller {
- // (undocumented)
- (endpoint: 'cluster.state', params: ClusterStateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'bulk', params: BulkIndexDocumentsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'count', params: CountParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'create', params: CreateDocumentParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'delete', params: DeleteDocumentParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'deleteByQuery', params: DeleteDocumentByQueryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'deleteScript', params: DeleteScriptParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'deleteTemplate', params: DeleteTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'exists', params: ExistsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'explain', params: ExplainParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'fieldStats', params: FieldStatsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'get', params: GetParams, options?: CallAPIOptions): Promise>;
- // (undocumented)
- (endpoint: 'getScript', params: GetScriptParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'getSource', params: GetSourceParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'getTemplate', params: GetTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'index', params: IndexDocumentParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'info', params: InfoParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'mget', params: MGetParams, options?: CallAPIOptions): Promise>;
- // (undocumented)
- (endpoint: 'msearch', params: MSearchParams, options?: CallAPIOptions): Promise>;
- // (undocumented)
- (endpoint: 'msearchTemplate', params: MSearchTemplateParams, options?: CallAPIOptions): Promise>;
- // (undocumented)
- (endpoint: 'mtermvectors', params: MTermVectorsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'ping', params: PingParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'putScript', params: PutScriptParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'putTemplate', params: PutTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'reindex', params: ReindexParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'reindexRethrottle', params: ReindexRethrottleParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'renderSearchTemplate', params: RenderSearchTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'scroll', params: ScrollParams, options?: CallAPIOptions): Promise>;
- // (undocumented)
- (endpoint: 'search', params: SearchParams, options?: CallAPIOptions): Promise>;
- // (undocumented)
- (endpoint: 'searchShards', params: SearchShardsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'searchTemplate', params: SearchTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'suggest', params: SuggestParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'termvectors', params: TermvectorsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'update', params: UpdateDocumentParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'updateByQuery', params: UpdateDocumentByQueryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.aliases', params: CatAliasesParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.allocation', params: CatAllocationParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.count', params: CatAllocationParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.fielddata', params: CatFielddataParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.health', params: CatHealthParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.help', params: CatHelpParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.indices', params: CatIndicesParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.master', params: CatCommonParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.nodeattrs', params: CatCommonParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.nodes', params: CatCommonParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.pendingTasks', params: CatCommonParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.plugins', params: CatCommonParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.recovery', params: CatRecoveryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.repositories', params: CatCommonParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.segments', params: CatSegmentsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.shards', params: CatShardsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.snapshots', params: CatSnapshotsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.tasks', params: CatTasksParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cat.threadPool', params: CatThreadPoolParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.allocationExplain', params: ClusterAllocationExplainParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.getSettings', params: ClusterGetSettingsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.health', params: ClusterHealthParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.pendingTasks', params: ClusterPendingTasksParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.putSettings', params: ClusterPutSettingsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.reroute', params: ClusterRerouteParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'clearScroll', params: ClearScrollParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'cluster.stats', params: ClusterStatsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.analyze', params: IndicesAnalyzeParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.clearCache', params: IndicesClearCacheParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.close', params: IndicesCloseParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.create', params: IndicesCreateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.delete', params: IndicesDeleteParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.deleteAlias', params: IndicesDeleteAliasParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.deleteTemplate', params: IndicesDeleteTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.exists', params: IndicesExistsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.existsAlias', params: IndicesExistsAliasParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.existsTemplate', params: IndicesExistsTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.existsType', params: IndicesExistsTypeParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.flush', params: IndicesFlushParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.flushSynced', params: IndicesFlushSyncedParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.forcemerge', params: IndicesForcemergeParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.get', params: IndicesGetParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.getAlias', params: IndicesGetAliasParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.getFieldMapping', params: IndicesGetFieldMappingParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.getMapping', params: IndicesGetMappingParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.getSettings', params: IndicesGetSettingsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.getTemplate', params: IndicesGetTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.getUpgrade', params: IndicesGetUpgradeParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.open', params: IndicesOpenParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.putAlias', params: IndicesPutAliasParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.putMapping', params: IndicesPutMappingParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.putSettings', params: IndicesPutSettingsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.putTemplate', params: IndicesPutTemplateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.recovery', params: IndicesRecoveryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.refresh', params: IndicesRefreshParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.rollover', params: IndicesRolloverParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.segments', params: IndicesSegmentsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.shardStores', params: IndicesShardStoresParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.shrink', params: IndicesShrinkParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.stats', params: IndicesStatsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.updateAliases', params: IndicesUpdateAliasesParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.upgrade', params: IndicesUpgradeParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'indices.validateQuery', params: IndicesValidateQueryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'ingest.deletePipeline', params: IngestDeletePipelineParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'ingest.getPipeline', params: IngestGetPipelineParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'ingest.putPipeline', params: IngestPutPipelineParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'ingest.simulate', params: IngestSimulateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'nodes.hotThreads', params: NodesHotThreadsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'nodes.info', params: NodesInfoParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'nodes.stats', params: NodesStatsParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.create', params: SnapshotCreateParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.createRepository', params: SnapshotCreateRepositoryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.delete', params: SnapshotDeleteParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.deleteRepository', params: SnapshotDeleteRepositoryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.get', params: SnapshotGetParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.getRepository', params: SnapshotGetRepositoryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.restore', params: SnapshotRestoreParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.status', params: SnapshotStatusParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'snapshot.verifyRepository', params: SnapshotVerifyRepositoryParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'tasks.cancel', params: TasksCancelParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'tasks.get', params: TasksGetParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'tasks.list', params: TasksListParams, options?: CallAPIOptions): ReturnType;
- // (undocumented)
- (endpoint: 'transport.request', clientParams: AssistantAPIClientParams, options?: CallAPIOptions): Promise;
- // (undocumented)
- (endpoint: 'transport.request', clientParams: DeprecationAPIClientParams, options?: CallAPIOptions): Promise;
- // (undocumented)
- (endpoint: string, clientParams?: Record, options?: CallAPIOptions): Promise;
-}
-
-// @public (undocumented)
-export interface AssistanceAPIResponse {
- // (undocumented)
- indices: {
- [indexName: string]: {
- action_required: MIGRATION_ASSISTANCE_INDEX_ACTION;
- };
- };
-}
-
-// @public (undocumented)
-export interface AssistantAPIClientParams extends GenericParams {
- // (undocumented)
- method: 'GET';
- // (undocumented)
- path: '/_migration/assistance';
-}
-
-// @public (undocumented)
-export interface Authenticated extends AuthResultParams {
- // (undocumented)
- type: AuthResultType.authenticated;
-}
-
-// @public
-export type AuthenticationHandler = (request: KibanaRequest, response: LifecycleResponseFactory, toolkit: AuthToolkit) => AuthResult | IKibanaResponse | Promise;
-
-// @public
-export type AuthHeaders = Record;
-
-// @public (undocumented)
-export type AuthResult = Authenticated;
-
-// @public
-export interface AuthResultParams {
- requestHeaders?: AuthHeaders;
- responseHeaders?: AuthHeaders;
- state?: Record;
-}
-
-// @public (undocumented)
-export enum AuthResultType {
- // (undocumented)
- authenticated = "authenticated"
-}
-
-// @public
-export enum AuthStatus {
- authenticated = "authenticated",
- unauthenticated = "unauthenticated",
- unknown = "unknown"
-}
-
-// @public
-export interface AuthToolkit {
- authenticated: (data?: AuthResultParams) => AuthResult;
-}
-
-// @public
-export class BasePath {
- // @internal
- constructor(serverBasePath?: string);
- get: (request: KibanaRequest | LegacyRequest) => string;
- prepend: (path: string) => string;
- remove: (path: string) => string;
- readonly serverBasePath: string;
- set: (request: KibanaRequest | LegacyRequest, requestSpecificBasePath: string) => void;
-}
-
-// Warning: (ae-forgotten-export) The symbol "BootstrapArgs" needs to be exported by the entry point index.d.ts
-//
-// @internal (undocumented)
-export function bootstrap({ configs, cliArgs, applyConfigOverrides, features, }: BootstrapArgs): Promise;
-
-// @public
-export interface CallAPIOptions {
- signal?: AbortSignal;
- wrap401Errors?: boolean;
-}
-
-// @public
-export interface Capabilities {
- [key: string]: Record>;
- catalogue: Record;
- management: {
- [sectionId: string]: Record;
- };
- navLinks: Record;
-}
-
-// @public
-export type CapabilitiesProvider = () => Partial;
-
-// @public
-export interface CapabilitiesSetup {
- registerProvider(provider: CapabilitiesProvider): void;
- registerSwitcher(switcher: CapabilitiesSwitcher): void;
-}
-
-// @public
-export interface CapabilitiesStart {
- resolveCapabilities(request: KibanaRequest): Promise;
-}
-
-// @public
-export type CapabilitiesSwitcher = (request: KibanaRequest, uiCapabilities: Capabilities) => Partial | Promise>;
-
-// @public
-export class ClusterClient implements IClusterClient {
- constructor(config: ElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
- asScoped(request?: KibanaRequest | LegacyRequest | FakeRequest): IScopedClusterClient;
- callAsInternalUser: APICaller;
- close(): void;
- }
-
-// @public
-export type ConfigDeprecation = (config: Record, fromPath: string, logger: ConfigDeprecationLogger) => Record;
-
-// @public
-export interface ConfigDeprecationFactory {
- rename(oldKey: string, newKey: string): ConfigDeprecation;
- renameFromRoot(oldKey: string, newKey: string): ConfigDeprecation;
- unused(unusedKey: string): ConfigDeprecation;
- unusedFromRoot(unusedKey: string): ConfigDeprecation;
-}
-
-// @public
-export type ConfigDeprecationLogger = (message: string) => void;
-
-// @public
-export type ConfigDeprecationProvider = (factory: ConfigDeprecationFactory) => ConfigDeprecation[];
-
-// @public (undocumented)
-export type ConfigPath = string | string[];
-
-// @internal (undocumented)
-export class ConfigService {
- // Warning: (ae-forgotten-export) The symbol "RawConfigurationProvider" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "Env" needs to be exported by the entry point index.d.ts
- constructor(rawConfigProvider: RawConfigurationProvider, env: Env, logger: LoggerFactory);
- addDeprecationProvider(path: ConfigPath, provider: ConfigDeprecationProvider): void;
- atPath(path: ConfigPath): Observable;
- // Warning: (ae-forgotten-export) The symbol "Config" needs to be exported by the entry point index.d.ts
- getConfig$(): Observable;
- // (undocumented)
- getUnusedPaths(): Promise;
- // (undocumented)
- getUsedPaths(): Promise;
- // (undocumented)
- isEnabledAtPath(path: ConfigPath): Promise;
- optionalAtPath(path: ConfigPath): Observable;
- setSchema(path: ConfigPath, schema: Type): Promise;
- validate(): Promise;
- }
-
-// @public
-export interface ContextSetup {
- createContextContainer>(): IContextContainer;
-}
-
-// @internal (undocumented)
-export type CoreId = symbol;
-
-// @public
-export interface CoreSetup {
- // (undocumented)
- capabilities: CapabilitiesSetup;
- // (undocumented)
- context: ContextSetup;
- // (undocumented)
- elasticsearch: ElasticsearchServiceSetup;
- // (undocumented)
- http: HttpServiceSetup;
- // (undocumented)
- savedObjects: SavedObjectsServiceSetup;
- // (undocumented)
- uiSettings: UiSettingsServiceSetup;
- // (undocumented)
- uuid: UuidServiceSetup;
-}
-
-// @public
-export interface CoreStart {
- // (undocumented)
- capabilities: CapabilitiesStart;
- // (undocumented)
- savedObjects: SavedObjectsServiceStart;
- // (undocumented)
- uiSettings: UiSettingsServiceStart;
-}
-
-// @public
-export class CspConfig implements ICspConfig {
- // @internal
- constructor(rawCspConfig?: Partial>);
- // (undocumented)
- static readonly DEFAULT: CspConfig;
- // (undocumented)
- readonly header: string;
- // (undocumented)
- readonly rules: string[];
- // (undocumented)
- readonly strict: boolean;
- // (undocumented)
- readonly warnLegacyBrowsers: boolean;
-}
-
-// @public
-export interface CustomHttpResponseOptions {
- body?: T;
- headers?: ResponseHeaders;
- // (undocumented)
- statusCode: number;
-}
-
-// @public (undocumented)
-export interface DeprecationAPIClientParams extends GenericParams {
- // (undocumented)
- method: 'GET';
- // (undocumented)
- path: '/_migration/deprecations';
-}
-
-// @public (undocumented)
-export interface DeprecationAPIResponse {
- // (undocumented)
- cluster_settings: DeprecationInfo[];
- // (undocumented)
- index_settings: IndexSettingsDeprecationInfo;
- // (undocumented)
- ml_settings: DeprecationInfo[];
- // (undocumented)
- node_settings: DeprecationInfo[];
-}
-
-// @public (undocumented)
-export interface DeprecationInfo {
- // (undocumented)
- details?: string;
- // (undocumented)
- level: MIGRATION_DEPRECATION_LEVEL;
- // (undocumented)
- message: string;
- // (undocumented)
- url: string;
-}
-
-// @public
-export interface DiscoveredPlugin {
- readonly configPath: ConfigPath;
- readonly id: PluginName;
- readonly optionalPlugins: readonly PluginName[];
- readonly requiredPlugins: readonly PluginName[];
-}
-
-// Warning: (ae-forgotten-export) The symbol "ElasticsearchConfig" needs to be exported by the entry point index.d.ts
-//
-// @public (undocumented)
-export type ElasticsearchClientConfig = Pick & Pick & {
- pingTimeout?: ElasticsearchConfig['pingTimeout'] | ConfigOptions['pingTimeout'];
- requestTimeout?: ElasticsearchConfig['requestTimeout'] | ConfigOptions['requestTimeout'];
- sniffInterval?: ElasticsearchConfig['sniffInterval'] | ConfigOptions['sniffInterval'];
- ssl?: Partial;
-};
-
-// @public (undocumented)
-export interface ElasticsearchError extends Boom {
- // (undocumented)
- [code]?: string;
-}
-
-// @public
-export class ElasticsearchErrorHelpers {
- // (undocumented)
- static decorateNotAuthorizedError(error: Error, reason?: string): ElasticsearchError;
- // (undocumented)
- static isNotAuthorizedError(error: any): error is ElasticsearchError;
-}
-
-// @public (undocumented)
-export interface ElasticsearchServiceSetup {
- readonly adminClient$: Observable;
- readonly createClient: (type: string, clientConfig?: Partial) => IClusterClient;
- readonly dataClient$: Observable;
-}
-
-// @public (undocumented)
-export interface EnvironmentMode {
- // (undocumented)
- dev: boolean;
- // (undocumented)
- name: 'development' | 'production';
- // (undocumented)
- prod: boolean;
-}
-
-// @public
-export interface ErrorHttpResponseOptions {
- body?: ResponseError;
- headers?: ResponseHeaders;
-}
-
-// @public
-export interface FakeRequest {
- headers: Headers;
-}
-
-// @public
-export type GetAuthHeaders = (request: KibanaRequest | LegacyRequest) => AuthHeaders | undefined;
-
-// @public
-export type GetAuthState = (request: KibanaRequest | LegacyRequest) => {
- status: AuthStatus;
- state: unknown;
-};
-
-// @public
-export type HandlerContextType> = T extends HandlerFunction ? U : never;
-
-// @public
-export type HandlerFunction = (context: T, ...args: any[]) => any;
-
-// @public
-export type HandlerParameters> = T extends (context: any, ...args: infer U) => any ? U : never;
-
-// @public
-export type Headers = {
- [header in KnownHeaders]?: string | string[] | undefined;
-} & {
- [header: string]: string | string[] | undefined;
-};
-
-// @public
-export interface HttpResponseOptions {
- body?: HttpResponsePayload;
- headers?: ResponseHeaders;
-}
-
-// @public
-export type HttpResponsePayload = undefined | string | Record | Buffer | Stream;
-
-// @public
-export interface HttpServiceSetup {
- basePath: IBasePath;
- createCookieSessionStorageFactory: (cookieOptions: SessionStorageCookieOptions) => Promise>;
- createRouter: () => IRouter;
- csp: ICspConfig;
- isTlsEnabled: boolean;
- registerAuth: (handler: AuthenticationHandler) => void;
- registerOnPostAuth: (handler: OnPostAuthHandler) => void;
- registerOnPreAuth: (handler: OnPreAuthHandler) => void;
- registerOnPreResponse: (handler: OnPreResponseHandler) => void;
- registerRouteHandlerContext: (contextName: T, provider: RequestHandlerContextProvider) => RequestHandlerContextContainer;
-}
-
-// @public (undocumented)
-export interface HttpServiceStart {
- isListening: (port: number) => boolean;
-}
-
-// @public
-export type IBasePath = Pick;
-
-// @public
-export type IClusterClient = Pick;
-
-// @public
-export interface IContextContainer> {
- createHandler(pluginOpaqueId: PluginOpaqueId, handler: THandler): (...rest: HandlerParameters) => ShallowPromise>;
- registerContext>(pluginOpaqueId: PluginOpaqueId, contextName: TContextName, provider: IContextProvider): this;
-}
-
-// @public
-export type IContextProvider, TContextName extends keyof HandlerContextType> = (context: Partial>, ...rest: HandlerParameters