diff --git a/.eslintignore b/.eslintignore
index fbdd70703f3c4..9de2cc2872960 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -33,6 +33,7 @@ target
/x-pack/plugins/canvas/shareable_runtime/build
/x-pack/plugins/canvas/storybook
/x-pack/plugins/monitoring/public/lib/jquery_flot
+/x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/**
/x-pack/legacy/plugins/infra/common/graphql/types.ts
/x-pack/legacy/plugins/infra/public/graphql/types.ts
/x-pack/legacy/plugins/infra/server/graphql/types.ts
diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md
new file mode 100644
index 0000000000000..64805eefbfea1
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.getcustomnavlink_.md
@@ -0,0 +1,17 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [ChromeStart](./kibana-plugin-core-public.chromestart.md) > [getCustomNavLink$](./kibana-plugin-core-public.chromestart.getcustomnavlink_.md)
+
+## ChromeStart.getCustomNavLink$() method
+
+Get an observable of the current custom nav link
+
+Signature:
+
+```typescript
+getCustomNavLink$(): Observable | undefined>;
+```
+Returns:
+
+`Observable | undefined>`
+
diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.md
index b4eadc93fe78d..e983ad50d2afe 100644
--- a/docs/development/core/public/kibana-plugin-core-public.chromestart.md
+++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.md
@@ -55,6 +55,7 @@ core.chrome.setHelpExtension(elem => {
| [getBadge$()](./kibana-plugin-core-public.chromestart.getbadge_.md) | Get an observable of the current badge |
| [getBrand$()](./kibana-plugin-core-public.chromestart.getbrand_.md) | Get an observable of the current brand information. |
| [getBreadcrumbs$()](./kibana-plugin-core-public.chromestart.getbreadcrumbs_.md) | Get an observable of the current list of breadcrumbs |
+| [getCustomNavLink$()](./kibana-plugin-core-public.chromestart.getcustomnavlink_.md) | Get an observable of the current custom nav link |
| [getHelpExtension$()](./kibana-plugin-core-public.chromestart.gethelpextension_.md) | Get an observable of the current custom help conttent |
| [getIsNavDrawerLocked$()](./kibana-plugin-core-public.chromestart.getisnavdrawerlocked_.md) | Get an observable of the current locked state of the nav drawer. |
| [getIsVisible$()](./kibana-plugin-core-public.chromestart.getisvisible_.md) | Get an observable of the current visibility state of the chrome. |
@@ -64,6 +65,7 @@ core.chrome.setHelpExtension(elem => {
| [setBadge(badge)](./kibana-plugin-core-public.chromestart.setbadge.md) | Override the current badge |
| [setBrand(brand)](./kibana-plugin-core-public.chromestart.setbrand.md) | Set the brand configuration. |
| [setBreadcrumbs(newBreadcrumbs)](./kibana-plugin-core-public.chromestart.setbreadcrumbs.md) | Override the current set of breadcrumbs |
+| [setCustomNavLink(newCustomNavLink)](./kibana-plugin-core-public.chromestart.setcustomnavlink.md) | Override the current set of custom nav link |
| [setHelpExtension(helpExtension)](./kibana-plugin-core-public.chromestart.sethelpextension.md) | Override the current set of custom help content |
| [setHelpSupportUrl(url)](./kibana-plugin-core-public.chromestart.sethelpsupporturl.md) | Override the default support URL shown in the help menu |
| [setIsVisible(isVisible)](./kibana-plugin-core-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. |
diff --git a/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md b/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md
new file mode 100644
index 0000000000000..adfb57f9c5ff2
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.chromestart.setcustomnavlink.md
@@ -0,0 +1,24 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [ChromeStart](./kibana-plugin-core-public.chromestart.md) > [setCustomNavLink](./kibana-plugin-core-public.chromestart.setcustomnavlink.md)
+
+## ChromeStart.setCustomNavLink() method
+
+Override the current set of custom nav link
+
+Signature:
+
+```typescript
+setCustomNavLink(newCustomNavLink?: Partial): void;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| newCustomNavLink | Partial<ChromeNavLink>
| |
+
+Returns:
+
+`void`
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.coresetup.md b/docs/development/core/server/kibana-plugin-core-server.coresetup.md
index e9ed5b830b691..32221a320d2a1 100644
--- a/docs/development/core/server/kibana-plugin-core-server.coresetup.md
+++ b/docs/development/core/server/kibana-plugin-core-server.coresetup.md
@@ -22,7 +22,6 @@ export interface CoreSetupStartServicesAccessor<TPluginsStart, TStart> | [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) |
| [http](./kibana-plugin-core-server.coresetup.http.md) | HttpServiceSetup & {
resources: HttpResources;
}
| [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) |
| [logging](./kibana-plugin-core-server.coresetup.logging.md) | LoggingServiceSetup
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) |
-| [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | MetricsServiceSetup
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) |
| [savedObjects](./kibana-plugin-core-server.coresetup.savedobjects.md) | SavedObjectsServiceSetup
| [SavedObjectsServiceSetup](./kibana-plugin-core-server.savedobjectsservicesetup.md) |
| [status](./kibana-plugin-core-server.coresetup.status.md) | StatusServiceSetup
| [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) |
| [uiSettings](./kibana-plugin-core-server.coresetup.uisettings.md) | UiSettingsServiceSetup
| [UiSettingsServiceSetup](./kibana-plugin-core-server.uisettingsservicesetup.md) |
diff --git a/docs/development/core/server/kibana-plugin-core-server.coresetup.metrics.md b/docs/development/core/server/kibana-plugin-core-server.coresetup.metrics.md
deleted file mode 100644
index 77c9e867ef8ea..0000000000000
--- a/docs/development/core/server/kibana-plugin-core-server.coresetup.metrics.md
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CoreSetup](./kibana-plugin-core-server.coresetup.md) > [metrics](./kibana-plugin-core-server.coresetup.metrics.md)
-
-## CoreSetup.metrics property
-
-[MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md)
-
-Signature:
-
-```typescript
-metrics: MetricsServiceSetup;
-```
diff --git a/docs/development/core/server/kibana-plugin-core-server.corestart.md b/docs/development/core/server/kibana-plugin-core-server.corestart.md
index 6a6bacf1eef40..acd23f0f47386 100644
--- a/docs/development/core/server/kibana-plugin-core-server.corestart.md
+++ b/docs/development/core/server/kibana-plugin-core-server.corestart.md
@@ -19,6 +19,7 @@ export interface CoreStart
| [capabilities](./kibana-plugin-core-server.corestart.capabilities.md) | CapabilitiesStart
| [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) |
| [elasticsearch](./kibana-plugin-core-server.corestart.elasticsearch.md) | ElasticsearchServiceStart
| [ElasticsearchServiceStart](./kibana-plugin-core-server.elasticsearchservicestart.md) |
| [http](./kibana-plugin-core-server.corestart.http.md) | HttpServiceStart
| [HttpServiceStart](./kibana-plugin-core-server.httpservicestart.md) |
+| [metrics](./kibana-plugin-core-server.corestart.metrics.md) | MetricsServiceStart
| |
| [savedObjects](./kibana-plugin-core-server.corestart.savedobjects.md) | SavedObjectsServiceStart
| [SavedObjectsServiceStart](./kibana-plugin-core-server.savedobjectsservicestart.md) |
| [uiSettings](./kibana-plugin-core-server.corestart.uisettings.md) | UiSettingsServiceStart
| [UiSettingsServiceStart](./kibana-plugin-core-server.uisettingsservicestart.md) |
diff --git a/docs/development/core/server/kibana-plugin-core-server.corestart.metrics.md b/docs/development/core/server/kibana-plugin-core-server.corestart.metrics.md
new file mode 100644
index 0000000000000..a51c2f842c346
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.corestart.metrics.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CoreStart](./kibana-plugin-core-server.corestart.md) > [metrics](./kibana-plugin-core-server.corestart.metrics.md)
+
+## CoreStart.metrics property
+
+
+Signature:
+
+```typescript
+metrics: MetricsServiceStart;
+```
diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md
index 1a03ac5ee3d1a..74422c82fc9ea 100644
--- a/docs/development/core/server/kibana-plugin-core-server.md
+++ b/docs/development/core/server/kibana-plugin-core-server.md
@@ -112,7 +112,7 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [LoggerFactory](./kibana-plugin-core-server.loggerfactory.md) | The single purpose of LoggerFactory
interface is to define a way to retrieve a context-based logger instance. |
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | Provides APIs to plugins for customizing the plugin's logger. |
| [LogMeta](./kibana-plugin-core-server.logmeta.md) | Contextual metadata |
-| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | APIs to retrieves metrics gathered and exposed by the core platform. |
+| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | |
| [NodesVersionCompatibility](./kibana-plugin-core-server.nodesversioncompatibility.md) | |
| [OnPostAuthToolkit](./kibana-plugin-core-server.onpostauthtoolkit.md) | A tool set defining an outcome of OnPostAuth interceptor for incoming request. |
| [OnPreAuthToolkit](./kibana-plugin-core-server.onpreauthtoolkit.md) | A tool set defining an outcome of OnPreAuth interceptor for incoming request. |
@@ -150,7 +150,7 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [SavedObjectsBulkUpdateResponse](./kibana-plugin-core-server.savedobjectsbulkupdateresponse.md) | |
| [SavedObjectsClientProviderOptions](./kibana-plugin-core-server.savedobjectsclientprovideroptions.md) | Options to control the creation of the Saved Objects Client. |
| [SavedObjectsClientWrapperOptions](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.md) | Options passed to each SavedObjectsClientWrapperFactory to aid in creating the wrapper instance. |
-| [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) | See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation. |
+| [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) | See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation.Note: this type intentially doesn't include a type definition for defining the dynamic
mapping parameter. Saved Object fields should always inherit the dynamic: 'strict'
paramater. If you are unsure of the shape of your data use type: 'object', enabled: false
instead. |
| [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) | See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation. |
| [SavedObjectsCreateOptions](./kibana-plugin-core-server.savedobjectscreateoptions.md) | |
| [SavedObjectsDeleteByNamespaceOptions](./kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md) | |
diff --git a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md
deleted file mode 100644
index 61107fbf20ad9..0000000000000
--- a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) > [getOpsMetrics$](./kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md)
-
-## MetricsServiceSetup.getOpsMetrics$ property
-
-Retrieve an observable emitting the [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) gathered. The observable will emit an initial value during core's `start` phase, and a new value every fixed interval of time, based on the `opts.interval` configuration property.
-
-Signature:
-
-```typescript
-getOpsMetrics$: () => Observable;
-```
-
-## Example
-
-
-```ts
-core.metrics.getOpsMetrics$().subscribe(metrics => {
- // do something with the metrics
-})
-
-```
-
diff --git a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md
index 00045aeac74b4..0bec919797b6f 100644
--- a/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md
+++ b/docs/development/core/server/kibana-plugin-core-server.metricsservicesetup.md
@@ -4,17 +4,8 @@
## MetricsServiceSetup interface
-APIs to retrieves metrics gathered and exposed by the core platform.
-
Signature:
```typescript
export interface MetricsServiceSetup
```
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [getOpsMetrics$](./kibana-plugin-core-server.metricsservicesetup.getopsmetrics_.md) | () => Observable<OpsMetrics>
| Retrieve an observable emitting the [OpsMetrics](./kibana-plugin-core-server.opsmetrics.md) gathered. The observable will emit an initial value during core's start
phase, and a new value every fixed interval of time, based on the opts.interval
configuration property. |
-
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md
deleted file mode 100644
index e63e543e68d51..0000000000000
--- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) > [dynamic](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md)
-
-## SavedObjectsComplexFieldMapping.dynamic property
-
-Signature:
-
-```typescript
-dynamic?: string;
-```
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.md
index 60e62212609d9..a7d13b0015e3f 100644
--- a/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.md
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectscomplexfieldmapping.md
@@ -6,6 +6,8 @@
See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation.
+Note: this type intentially doesn't include a type definition for defining the `dynamic` mapping parameter. Saved Object fields should always inherit the `dynamic: 'strict'` paramater. If you are unsure of the shape of your data use `type: 'object', enabled: false` instead.
+
Signature:
```typescript
@@ -16,7 +18,6 @@ export interface SavedObjectsComplexFieldMapping
| Property | Type | Description |
| --- | --- | --- |
-| [dynamic](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md) | string
| |
| [properties](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.properties.md) | SavedObjectsMappingProperties
| |
| [type](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.type.md) | string
| |
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md
new file mode 100644
index 0000000000000..f1916e89c2c98
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilter.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isFilter](./kibana-plugin-plugins-data-public.isfilter.md)
+
+## isFilter variable
+
+Signature:
+
+```typescript
+isFilter: (x: unknown) => x is Filter
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md
new file mode 100644
index 0000000000000..558da72cc26bb
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isfilters.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isFilters](./kibana-plugin-plugins-data-public.isfilters.md)
+
+## isFilters variable
+
+Signature:
+
+```typescript
+isFilters: (x: unknown) => x is Filter[]
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isquery.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isquery.md
new file mode 100644
index 0000000000000..0884566333aa8
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.isquery.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isQuery](./kibana-plugin-plugins-data-public.isquery.md)
+
+## isQuery variable
+
+Signature:
+
+```typescript
+isQuery: (x: unknown) => x is Query
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.istimerange.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.istimerange.md
new file mode 100644
index 0000000000000..e9420493c82fb
--- /dev/null
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.istimerange.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [isTimeRange](./kibana-plugin-plugins-data-public.istimerange.md)
+
+## isTimeRange variable
+
+Signature:
+
+```typescript
+isTimeRange: (x: unknown) => x is TimeRange
+```
diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
index f62479f02926e..feeb686a1f5ed 100644
--- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
+++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.md
@@ -110,6 +110,10 @@
| [getKbnTypeNames](./kibana-plugin-plugins-data-public.getkbntypenames.md) | Get the esTypes known by all kbnFieldTypes {Array} |
| [indexPatterns](./kibana-plugin-plugins-data-public.indexpatterns.md) | |
| [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md) | |
+| [isFilter](./kibana-plugin-plugins-data-public.isfilter.md) | |
+| [isFilters](./kibana-plugin-plugins-data-public.isfilters.md) | |
+| [isQuery](./kibana-plugin-plugins-data-public.isquery.md) | |
+| [isTimeRange](./kibana-plugin-plugins-data-public.istimerange.md) | |
| [parseSearchSourceJSON](./kibana-plugin-plugins-data-public.parsesearchsourcejson.md) | |
| [QueryStringInput](./kibana-plugin-plugins-data-public.querystringinput.md) | |
| [search](./kibana-plugin-plugins-data-public.search.md) | |
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/index.md b/docs/development/plugins/kibana_utils/common/state_containers/index.md
new file mode 100644
index 0000000000000..b4e1071ceb732
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/index.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md)
+
+## API Reference
+
+## Packages
+
+| Package | Description |
+| --- | --- |
+| [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) | State containers are Redux-store-like objects meant to help you manage state in your services or apps. Refer to [guides and examples](https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_containers) for more info |
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestate.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestate.md
new file mode 100644
index 0000000000000..92893afc02bef
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestate.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [BaseState](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestate.md)
+
+## BaseState type
+
+Base [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) state shape
+
+Signature:
+
+```typescript
+export declare type BaseState = object;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.get.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.get.md
new file mode 100644
index 0000000000000..b939954d92aa6
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.get.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md) > [get](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.get.md)
+
+## BaseStateContainer.get property
+
+Retrieves current state from the container
+
+Signature:
+
+```typescript
+get: () => State;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md
new file mode 100644
index 0000000000000..66c25c87f5e37
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md)
+
+## BaseStateContainer interface
+
+Base state container shape without transitions or selectors
+
+Signature:
+
+```typescript
+export interface BaseStateContainer
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [get](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.get.md) | () => State
| Retrieves current state from the container |
+| [set](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.set.md) | (state: State) => void
| Sets state into container |
+| [state$](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.state_.md) | Observable<State>
| of state |
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.set.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.set.md
new file mode 100644
index 0000000000000..ed4ff365adfb3
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.set.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md) > [set](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.set.md)
+
+## BaseStateContainer.set property
+
+Sets state into container
+
+Signature:
+
+```typescript
+set: (state: State) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.state_.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.state_.md
new file mode 100644
index 0000000000000..35838fa53d539
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.state_.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md) > [state$](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.state_.md)
+
+## BaseStateContainer.state$ property
+
+ of state
+
+Signature:
+
+```typescript
+state$: Observable;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.comparator.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.comparator.md
new file mode 100644
index 0000000000000..12af33756fb19
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.comparator.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [Comparator](./kibana-plugin-plugins-kibana_utils-common-state_containers.comparator.md)
+
+## Comparator type
+
+Used to compare state. see [useContainerSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md)
+
+Signature:
+
+```typescript
+export declare type Comparator = (previous: Result, current: Result) => boolean;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md
new file mode 100644
index 0000000000000..e05f1fb392fe6
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [Connect](./kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md)
+
+## Connect type
+
+Similar to `connect` from react-redux, allows to map state from state container to component's props
+
+Signature:
+
+```typescript
+export declare type Connect = (mapStateToProp: MapStateToProps>) => (component: ComponentType) => FC>;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer.md
new file mode 100644
index 0000000000000..cc43b59676dc1
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer.md
@@ -0,0 +1,24 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [createStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer.md)
+
+## createStateContainer() function
+
+Creates a state container without transitions and without selectors.
+
+Signature:
+
+```typescript
+export declare function createStateContainer(defaultState: State): ReduxLikeStateContainer;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| defaultState | State
| initial state |
+
+Returns:
+
+`ReduxLikeStateContainer`
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_1.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_1.md
new file mode 100644
index 0000000000000..794bf63588312
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_1.md
@@ -0,0 +1,25 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [createStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_1.md)
+
+## createStateContainer() function
+
+Creates a state container with transitions, but without selectors
+
+Signature:
+
+```typescript
+export declare function createStateContainer(defaultState: State, pureTransitions: PureTransitions): ReduxLikeStateContainer;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| defaultState | State
| initial state |
+| pureTransitions | PureTransitions
| state transitions configuration object. Map of . |
+
+Returns:
+
+`ReduxLikeStateContainer`
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_2.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_2.md
new file mode 100644
index 0000000000000..1946baae202f1
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_2.md
@@ -0,0 +1,27 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [createStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_2.md)
+
+## createStateContainer() function
+
+Creates a state container with transitions and selectors
+
+Signature:
+
+```typescript
+export declare function createStateContainer(defaultState: State, pureTransitions: PureTransitions, pureSelectors: PureSelectors, options?: CreateStateContainerOptions): ReduxLikeStateContainer;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| defaultState | State
| initial state |
+| pureTransitions | PureTransitions
| state transitions configuration object. Map of . |
+| pureSelectors | PureSelectors
| state selectors configuration object. Map of . |
+| options | CreateStateContainerOptions
| state container options [CreateStateContainerOptions](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md) |
+
+Returns:
+
+`ReduxLikeStateContainer`
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.freeze.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.freeze.md
new file mode 100644
index 0000000000000..4f772c7c54d08
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.freeze.md
@@ -0,0 +1,25 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [CreateStateContainerOptions](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md) > [freeze](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.freeze.md)
+
+## CreateStateContainerOptions.freeze property
+
+Function to use when freezing state. Supply identity function. If not provided, default deepFreeze is use.
+
+Signature:
+
+```typescript
+freeze?: (state: T) => T;
+```
+
+## Example
+
+If you expect that your state will be mutated externally an you cannot prevent that
+
+```ts
+{
+ freeze: state => state,
+}
+
+```
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md
new file mode 100644
index 0000000000000..d328d306e93e1
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md
@@ -0,0 +1,20 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [CreateStateContainerOptions](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md)
+
+## CreateStateContainerOptions interface
+
+State container options
+
+Signature:
+
+```typescript
+export interface CreateStateContainerOptions
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [freeze](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.freeze.md) | <T>(state: T) => T
| Function to use when freezing state. Supply identity function. If not provided, default deepFreeze is use. |
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainerreacthelpers.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainerreacthelpers.md
new file mode 100644
index 0000000000000..a6076490c2746
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainerreacthelpers.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [createStateContainerReactHelpers](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainerreacthelpers.md)
+
+## createStateContainerReactHelpers variable
+
+Creates helpers for using [State Containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) with react Refer to [guide](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_containers/react.md) for details
+
+Signature:
+
+```typescript
+createStateContainerReactHelpers: >() => {
+ Provider: React.Provider;
+ Consumer: React.Consumer;
+ context: React.Context;
+ useContainer: () => Container;
+ useState: () => UnboxState;
+ useTransitions: () => Container["transitions"];
+ useSelector: (selector: (state: UnboxState) => Result, comparator?: Comparator) => Result;
+ connect: Connect>;
+}
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.dispatch.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.dispatch.md
new file mode 100644
index 0000000000000..d4057a549bb0d
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.dispatch.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [Dispatch](./kibana-plugin-plugins-kibana_utils-common-state_containers.dispatch.md)
+
+## Dispatch type
+
+Redux like dispatch
+
+Signature:
+
+```typescript
+export declare type Dispatch = (action: T) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepureselector.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepureselector.md
new file mode 100644
index 0000000000000..5e4e86ad82d53
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepureselector.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [EnsurePureSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepureselector.md)
+
+## EnsurePureSelector type
+
+
+Signature:
+
+```typescript
+export declare type EnsurePureSelector = Ensure>;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepuretransition.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepuretransition.md
new file mode 100644
index 0000000000000..0e621e989346b
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepuretransition.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [EnsurePureTransition](./kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepuretransition.md)
+
+## EnsurePureTransition type
+
+
+Signature:
+
+```typescript
+export declare type EnsurePureTransition = Ensure>;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.mapstatetoprops.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.mapstatetoprops.md
new file mode 100644
index 0000000000000..8e6a49ac72742
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.mapstatetoprops.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [MapStateToProps](./kibana-plugin-plugins-kibana_utils-common-state_containers.mapstatetoprops.md)
+
+## MapStateToProps type
+
+State container state to component props mapper. See [Connect](./kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md)
+
+Signature:
+
+```typescript
+export declare type MapStateToProps = (state: State) => StateProps;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.md
new file mode 100644
index 0000000000000..e74ff2c6885be
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.md
@@ -0,0 +1,52 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md)
+
+## kibana-plugin-plugins-kibana\_utils-common-state\_containers package
+
+State containers are Redux-store-like objects meant to help you manage state in your services or apps. Refer to [guides and examples](https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_containers) for more info
+
+## Functions
+
+| Function | Description |
+| --- | --- |
+| [createStateContainer(defaultState)](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer.md) | Creates a state container without transitions and without selectors. |
+| [createStateContainer(defaultState, pureTransitions)](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_1.md) | Creates a state container with transitions, but without selectors |
+| [createStateContainer(defaultState, pureTransitions, pureSelectors, options)](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainer_2.md) | Creates a state container with transitions and selectors |
+
+## Interfaces
+
+| Interface | Description |
+| --- | --- |
+| [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md) | Base state container shape without transitions or selectors |
+| [CreateStateContainerOptions](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontaineroptions.md) | State container options |
+| [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) | Fully featured state container which matches Redux store interface. Extends [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) Allows to use state container with redux libraries |
+| [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) | Fully featured state container with [Selectors](./kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md) and . Extends [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md) |
+
+## Variables
+
+| Variable | Description |
+| --- | --- |
+| [createStateContainerReactHelpers](./kibana-plugin-plugins-kibana_utils-common-state_containers.createstatecontainerreacthelpers.md) | Creates helpers for using [State Containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) with react Refer to [guide](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_containers/react.md) for details |
+| [useContainerSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md) | React hook to apply selector to state container to extract only needed information. Will re-render your component only when the section changes. |
+| [useContainerState](./kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerstate.md) | React hooks that returns the latest state of a [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md). |
+
+## Type Aliases
+
+| Type Alias | Description |
+| --- | --- |
+| [BaseState](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestate.md) | Base [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) state shape |
+| [Comparator](./kibana-plugin-plugins-kibana_utils-common-state_containers.comparator.md) | Used to compare state. see [useContainerSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md) |
+| [Connect](./kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md) | Similar to connect
from react-redux, allows to map state from state container to component's props |
+| [Dispatch](./kibana-plugin-plugins-kibana_utils-common-state_containers.dispatch.md) | Redux like dispatch |
+| [EnsurePureSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepureselector.md) | |
+| [EnsurePureTransition](./kibana-plugin-plugins-kibana_utils-common-state_containers.ensurepuretransition.md) | |
+| [MapStateToProps](./kibana-plugin-plugins-kibana_utils-common-state_containers.mapstatetoprops.md) | State container state to component props mapper. See [Connect](./kibana-plugin-plugins-kibana_utils-common-state_containers.connect.md) |
+| [Middleware](./kibana-plugin-plugins-kibana_utils-common-state_containers.middleware.md) | Redux like Middleware |
+| [PureSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.pureselector.md) | |
+| [PureSelectorsToSelectors](./kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectorstoselectors.md) | |
+| [PureSelectorToSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectortoselector.md) | |
+| [Reducer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reducer.md) | Redux like Reducer |
+| [Selector](./kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md) | |
+| [UnboxState](./kibana-plugin-plugins-kibana_utils-common-state_containers.unboxstate.md) | Utility type for inferring state shape from [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) |
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.middleware.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.middleware.md
new file mode 100644
index 0000000000000..574b83306dc95
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.middleware.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [Middleware](./kibana-plugin-plugins-kibana_utils-common-state_containers.middleware.md)
+
+## Middleware type
+
+Redux like Middleware
+
+Signature:
+
+```typescript
+export declare type Middleware = (store: Pick, 'getState' | 'dispatch'>) => (next: (action: TransitionDescription) => TransitionDescription | any) => Dispatch;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselector.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselector.md
new file mode 100644
index 0000000000000..6ac07cba446f5
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselector.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [PureSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.pureselector.md)
+
+## PureSelector type
+
+
+Signature:
+
+```typescript
+export declare type PureSelector = (state: State) => Selector;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectorstoselectors.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectorstoselectors.md
new file mode 100644
index 0000000000000..82a91f7c87e17
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectorstoselectors.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [PureSelectorsToSelectors](./kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectorstoselectors.md)
+
+## PureSelectorsToSelectors type
+
+
+Signature:
+
+```typescript
+export declare type PureSelectorsToSelectors = {
+ [K in keyof T]: PureSelectorToSelector>;
+};
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectortoselector.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectortoselector.md
new file mode 100644
index 0000000000000..5c12afd1cd971
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectortoselector.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [PureSelectorToSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.pureselectortoselector.md)
+
+## PureSelectorToSelector type
+
+
+Signature:
+
+```typescript
+export declare type PureSelectorToSelector> = ReturnType>;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reducer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reducer.md
new file mode 100644
index 0000000000000..519e6ce7d7cfb
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reducer.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [Reducer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reducer.md)
+
+## Reducer type
+
+Redux like Reducer
+
+Signature:
+
+```typescript
+export declare type Reducer = (state: State, action: TransitionDescription) => State;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.addmiddleware.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.addmiddleware.md
new file mode 100644
index 0000000000000..e90da05e30d87
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.addmiddleware.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) > [addMiddleware](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.addmiddleware.md)
+
+## ReduxLikeStateContainer.addMiddleware property
+
+Signature:
+
+```typescript
+addMiddleware: (middleware: Middleware) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.dispatch.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.dispatch.md
new file mode 100644
index 0000000000000..7a9755ee3b65c
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.dispatch.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) > [dispatch](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.dispatch.md)
+
+## ReduxLikeStateContainer.dispatch property
+
+Signature:
+
+```typescript
+dispatch: (action: TransitionDescription) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.getstate.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.getstate.md
new file mode 100644
index 0000000000000..86e1c6dd34cd6
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.getstate.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) > [getState](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.getstate.md)
+
+## ReduxLikeStateContainer.getState property
+
+Signature:
+
+```typescript
+getState: () => State;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md
new file mode 100644
index 0000000000000..0e08119c1eae4
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md
@@ -0,0 +1,25 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md)
+
+## ReduxLikeStateContainer interface
+
+Fully featured state container which matches Redux store interface. Extends [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) Allows to use state container with redux libraries
+
+Signature:
+
+```typescript
+export interface ReduxLikeStateContainer extends StateContainer
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [addMiddleware](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.addmiddleware.md) | (middleware: Middleware<State>) => void
| |
+| [dispatch](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.dispatch.md) | (action: TransitionDescription) => void
| |
+| [getState](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.getstate.md) | () => State
| |
+| [reducer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.reducer.md) | Reducer<State>
| |
+| [replaceReducer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.replacereducer.md) | (nextReducer: Reducer<State>) => void
| |
+| [subscribe](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.subscribe.md) | (listener: (state: State) => void) => () => void
| |
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.reducer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.reducer.md
new file mode 100644
index 0000000000000..49eabf19340f2
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.reducer.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) > [reducer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.reducer.md)
+
+## ReduxLikeStateContainer.reducer property
+
+Signature:
+
+```typescript
+reducer: Reducer;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.replacereducer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.replacereducer.md
new file mode 100644
index 0000000000000..2582d31d9adc4
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.replacereducer.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) > [replaceReducer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.replacereducer.md)
+
+## ReduxLikeStateContainer.replaceReducer property
+
+Signature:
+
+```typescript
+replaceReducer: (nextReducer: Reducer) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.subscribe.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.subscribe.md
new file mode 100644
index 0000000000000..15139a7bd9f3e
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.subscribe.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [ReduxLikeStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.md) > [subscribe](./kibana-plugin-plugins-kibana_utils-common-state_containers.reduxlikestatecontainer.subscribe.md)
+
+## ReduxLikeStateContainer.subscribe property
+
+Signature:
+
+```typescript
+subscribe: (listener: (state: State) => void) => () => void;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md
new file mode 100644
index 0000000000000..5c143551d130b
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [Selector](./kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md)
+
+## Selector type
+
+
+Signature:
+
+```typescript
+export declare type Selector = (...args: Args) => Result;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md
new file mode 100644
index 0000000000000..23ec1c8e5be01
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md
@@ -0,0 +1,21 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md)
+
+## StateContainer interface
+
+Fully featured state container with [Selectors](./kibana-plugin-plugins-kibana_utils-common-state_containers.selector.md) and . Extends [BaseStateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.basestatecontainer.md)
+
+Signature:
+
+```typescript
+export interface StateContainer extends BaseStateContainer
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [selectors](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.selectors.md) | Readonly<PureSelectorsToSelectors<PureSelectors>>
| |
+| [transitions](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.transitions.md) | Readonly<PureTransitionsToTransitions<PureTransitions>>
| |
+
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.selectors.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.selectors.md
new file mode 100644
index 0000000000000..2afac07b59e39
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.selectors.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) > [selectors](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.selectors.md)
+
+## StateContainer.selectors property
+
+Signature:
+
+```typescript
+selectors: Readonly>;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.transitions.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.transitions.md
new file mode 100644
index 0000000000000..4712d3287beef
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.transitions.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md) > [transitions](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.transitions.md)
+
+## StateContainer.transitions property
+
+Signature:
+
+```typescript
+transitions: Readonly>;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.unboxstate.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.unboxstate.md
new file mode 100644
index 0000000000000..d4f99841456d7
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.unboxstate.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [UnboxState](./kibana-plugin-plugins-kibana_utils-common-state_containers.unboxstate.md)
+
+## UnboxState type
+
+Utility type for inferring state shape from [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md)
+
+Signature:
+
+```typescript
+export declare type UnboxState> = Container extends StateContainer ? T : never;
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md
new file mode 100644
index 0000000000000..fe5f30a9c8472
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [useContainerSelector](./kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerselector.md)
+
+## useContainerSelector variable
+
+React hook to apply selector to state container to extract only needed information. Will re-render your component only when the section changes.
+
+Signature:
+
+```typescript
+useContainerSelector: , Result>(container: Container, selector: (state: UnboxState) => Result, comparator?: Comparator) => Result
+```
diff --git a/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerstate.md b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerstate.md
new file mode 100644
index 0000000000000..7cef47c58f9d9
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/common/state_containers/kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerstate.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-common-state\_containers](./kibana-plugin-plugins-kibana_utils-common-state_containers.md) > [useContainerState](./kibana-plugin-plugins-kibana_utils-common-state_containers.usecontainerstate.md)
+
+## useContainerState variable
+
+React hooks that returns the latest state of a [StateContainer](./kibana-plugin-plugins-kibana_utils-common-state_containers.statecontainer.md).
+
+Signature:
+
+```typescript
+useContainerState: >(container: Container) => UnboxState
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/index.md b/docs/development/plugins/kibana_utils/public/state_sync/index.md
new file mode 100644
index 0000000000000..4b345d9130bd5
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/index.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md)
+
+## API Reference
+
+## Packages
+
+| Package | Description |
+| --- | --- |
+| [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) | State syncing utilities are a set of helpers for syncing your application state with URL or browser storage.They are designed to work together with state containers (). But state containers are not required.State syncing utilities include:- util which: - Subscribes to state changes and pushes them to state storage. - Optionally subscribes to state storage changes and pushes them to state. - Two types of storage compatible with syncState
: - - Serializes state and persists it to URL's query param in rison or hashed format. Listens for state updates in the URL and pushes them back to state. - - Serializes state and persists it to browser storage.Refer [here](https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_sync) for a complete guide and examples |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.createkbnurlstatestorage.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.createkbnurlstatestorage.md
new file mode 100644
index 0000000000000..22f70ce22b574
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.createkbnurlstatestorage.md
@@ -0,0 +1,16 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [createKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.createkbnurlstatestorage.md)
+
+## createKbnUrlStateStorage variable
+
+Creates [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) state storage
+
+Signature:
+
+```typescript
+createKbnUrlStateStorage: ({ useHash, history }?: {
+ useHash: boolean;
+ history?: History | undefined;
+}) => IKbnUrlStateStorage
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.createsessionstoragestatestorage.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.createsessionstoragestatestorage.md
new file mode 100644
index 0000000000000..dccff93ad1724
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.createsessionstoragestatestorage.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [createSessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.createsessionstoragestatestorage.md)
+
+## createSessionStorageStateStorage variable
+
+Creates [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) [guide](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync/storages/session_storage.md)
+
+Signature:
+
+```typescript
+createSessionStorageStateStorage: (storage?: Storage) => ISessionStorageStateStorage
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md
new file mode 100644
index 0000000000000..29a511d57d7bd
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) > [cancel](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md)
+
+## IKbnUrlStateStorage.cancel property
+
+cancels any pending url updates
+
+Signature:
+
+```typescript
+cancel: () => void;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.change_.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.change_.md
new file mode 100644
index 0000000000000..2b55f2aca70c8
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.change_.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) > [change$](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.change_.md)
+
+## IKbnUrlStateStorage.change$ property
+
+Signature:
+
+```typescript
+change$: (key: string) => Observable;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.flush.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.flush.md
new file mode 100644
index 0000000000000..e0e6aa9be4368
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.flush.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) > [flush](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.flush.md)
+
+## IKbnUrlStateStorage.flush property
+
+synchronously runs any pending url updates returned boolean indicates if change occurred
+
+Signature:
+
+```typescript
+flush: (opts?: {
+ replace?: boolean;
+ }) => boolean;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.get.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.get.md
new file mode 100644
index 0000000000000..0eb60c21fbbbf
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.get.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) > [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.get.md)
+
+## IKbnUrlStateStorage.get property
+
+Signature:
+
+```typescript
+get: (key: string) => State | null;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md
new file mode 100644
index 0000000000000..56cefebd2acfe
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md
@@ -0,0 +1,24 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md)
+
+## IKbnUrlStateStorage interface
+
+KbnUrlStateStorage is a state storage for [syncState()](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md) utility which: 1. Keeps state in sync with the URL. 2. Serializes data and stores it in the URL in one of the supported formats: \* Rison encoded. \* Hashed URL: In URL we store only the hash from the serialized state, but the state itself is stored in sessionStorage. See kibana's advanced option for more context state:storeInSessionStorage 3. Takes care of listening to the URL updates and notifies state about the updates. 4. Takes care of batching URL updates to prevent redundant browser history records. [GUIDE](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync/storages/kbn_url_storage.md)
+
+Signature:
+
+```typescript
+export interface IKbnUrlStateStorage extends IStateStorage
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [cancel](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md) | () => void
| cancels any pending url updates |
+| [change$](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.change_.md) | <State = unknown>(key: string) => Observable<State | null>
| |
+| [flush](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.flush.md) | (opts?: {
replace?: boolean;
}) => boolean
| synchronously runs any pending url updates returned boolean indicates if change occurred |
+| [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.get.md) | <State = unknown>(key: string) => State | null
| |
+| [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.set.md) | <State>(key: string, state: State, opts?: {
replace: boolean;
}) => Promise<string | undefined>
| |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.set.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.set.md
new file mode 100644
index 0000000000000..2eab44d344414
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.set.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) > [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.set.md)
+
+## IKbnUrlStateStorage.set property
+
+Signature:
+
+```typescript
+set: (key: string, state: State, opts?: {
+ replace: boolean;
+ }) => Promise;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md
new file mode 100644
index 0000000000000..ca69609936405
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md
@@ -0,0 +1,24 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [INullableBaseStateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md)
+
+## INullableBaseStateContainer interface
+
+Extension of with one constraint: set state should handle `null` as incoming state
+
+Signature:
+
+```typescript
+export interface INullableBaseStateContainer extends BaseStateContainer
+```
+
+## Remarks
+
+State container for stateSync() have to accept "null" for example, set() implementation could handle null and fallback to some default state this is required to handle edge case, when state in storage becomes empty and syncing is in progress. state container will be notified about about storage becoming empty with null passed in
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.set.md) | (state: State | null) => void
| |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.set.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.set.md
new file mode 100644
index 0000000000000..dd2978f59484a
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.set.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [INullableBaseStateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md) > [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.set.md)
+
+## INullableBaseStateContainer.set property
+
+Signature:
+
+```typescript
+set: (state: State | null) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.get.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.get.md
new file mode 100644
index 0000000000000..83131c77132ce
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.get.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) > [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.get.md)
+
+## ISessionStorageStateStorage.get property
+
+Signature:
+
+```typescript
+get: (key: string) => State | null;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md
new file mode 100644
index 0000000000000..7792bc3932f95
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md
@@ -0,0 +1,21 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md)
+
+## ISessionStorageStateStorage interface
+
+[IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) for storing state in browser [guide](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync/storages/session_storage.md)
+
+Signature:
+
+```typescript
+export interface ISessionStorageStateStorage extends IStateStorage
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.get.md) | <State = unknown>(key: string) => State | null
| |
+| [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.set.md) | <State>(key: string, state: State) => void
| |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.set.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.set.md
new file mode 100644
index 0000000000000..04b0ab01f0d13
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.set.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) > [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.set.md)
+
+## ISessionStorageStateStorage.set property
+
+Signature:
+
+```typescript
+set: (key: string, state: State) => void;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.cancel.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.cancel.md
new file mode 100644
index 0000000000000..ce771d52a6e60
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.cancel.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) > [cancel](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.cancel.md)
+
+## IStateStorage.cancel property
+
+Optional method to cancel any pending activity syncState() will call it, if it is provided by IStateStorage
+
+Signature:
+
+```typescript
+cancel?: () => void;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.change_.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.change_.md
new file mode 100644
index 0000000000000..ed6672a3d83c6
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.change_.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) > [change$](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.change_.md)
+
+## IStateStorage.change$ property
+
+Should notify when the stored state has changed
+
+Signature:
+
+```typescript
+change$?: (key: string) => Observable;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.get.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.get.md
new file mode 100644
index 0000000000000..2c0b2ee970cc6
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.get.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) > [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.get.md)
+
+## IStateStorage.get property
+
+Should retrieve state from the storage and deserialize it
+
+Signature:
+
+```typescript
+get: (key: string) => State | null;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md
new file mode 100644
index 0000000000000..2c34a185fb7b1
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md
@@ -0,0 +1,25 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md)
+
+## IStateStorage interface
+
+Any StateStorage have to implement IStateStorage interface StateStorage is responsible for: \* state serialisation / deserialization \* persisting to and retrieving from storage
+
+For an example take a look at already implemented [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) and [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) state storages
+
+Signature:
+
+```typescript
+export interface IStateStorage
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [cancel](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.cancel.md) | () => void
| Optional method to cancel any pending activity syncState() will call it, if it is provided by IStateStorage |
+| [change$](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.change_.md) | <State = unknown>(key: string) => Observable<State | null>
| Should notify when the stored state has changed |
+| [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.get.md) | <State = unknown>(key: string) => State | null
| Should retrieve state from the storage and deserialize it |
+| [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.set.md) | <State>(key: string, state: State) => any
| Take in a state object, should serialise and persist |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.set.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.set.md
new file mode 100644
index 0000000000000..3f286994ed4af
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.set.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) > [set](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.set.md)
+
+## IStateStorage.set property
+
+Take in a state object, should serialise and persist
+
+Signature:
+
+```typescript
+set: (key: string, state: State) => any;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md
new file mode 100644
index 0000000000000..f9368de4240ac
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateSyncConfig](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md)
+
+## IStateSyncConfig interface
+
+Config for setting up state syncing with
+
+Signature:
+
+```typescript
+export interface IStateSyncConfig
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [stateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statecontainer.md) | INullableBaseStateContainer<State>
| State container to keep in sync with storage, have to implement [INullableBaseStateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md) interface We encourage to use as a state container, but it is also possible to implement own custom container for advanced use cases |
+| [stateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statestorage.md) | StateStorage
| State storage to use, State storage is responsible for serialising / deserialising and persisting / retrieving stored stateThere are common strategies already implemented: see [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) which replicate what State (AppState, GlobalState) in legacy world did |
+| [storageKey](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.storagekey.md) | string
| Storage key to use for syncing, e.g. storageKey '\_a' should sync state to ?\_a query param |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statecontainer.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statecontainer.md
new file mode 100644
index 0000000000000..0098dd5c99aeb
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statecontainer.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateSyncConfig](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md) > [stateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statecontainer.md)
+
+## IStateSyncConfig.stateContainer property
+
+State container to keep in sync with storage, have to implement [INullableBaseStateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md) interface We encourage to use as a state container, but it is also possible to implement own custom container for advanced use cases
+
+Signature:
+
+```typescript
+stateContainer: INullableBaseStateContainer;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statestorage.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statestorage.md
new file mode 100644
index 0000000000000..ef872ba0ba9b5
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statestorage.md
@@ -0,0 +1,15 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateSyncConfig](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md) > [stateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.statestorage.md)
+
+## IStateSyncConfig.stateStorage property
+
+State storage to use, State storage is responsible for serialising / deserialising and persisting / retrieving stored state
+
+There are common strategies already implemented: see [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) which replicate what State (AppState, GlobalState) in legacy world did
+
+Signature:
+
+```typescript
+stateStorage: StateStorage;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.storagekey.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.storagekey.md
new file mode 100644
index 0000000000000..d3887c23df1e0
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.storagekey.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IStateSyncConfig](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md) > [storageKey](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.storagekey.md)
+
+## IStateSyncConfig.storageKey property
+
+Storage key to use for syncing, e.g. storageKey '\_a' should sync state to ?\_a query param
+
+Signature:
+
+```typescript
+storageKey: string;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md
new file mode 100644
index 0000000000000..137db68cd6b48
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md
@@ -0,0 +1,20 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [ISyncStateRef](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md)
+
+## ISyncStateRef interface
+
+
+Signature:
+
+```typescript
+export interface ISyncStateRef
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [start](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.start.md) | StartSyncStateFnType
| start state syncing |
+| [stop](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.stop.md) | StopSyncStateFnType
| stop state syncing |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.start.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.start.md
new file mode 100644
index 0000000000000..d8df808ba215f
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.start.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [ISyncStateRef](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md) > [start](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.start.md)
+
+## ISyncStateRef.start property
+
+start state syncing
+
+Signature:
+
+```typescript
+start: StartSyncStateFnType;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.stop.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.stop.md
new file mode 100644
index 0000000000000..70356dd9d6c79
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.stop.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [ISyncStateRef](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md) > [stop](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.stop.md)
+
+## ISyncStateRef.stop property
+
+stop state syncing
+
+Signature:
+
+```typescript
+stop: StopSyncStateFnType;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.md
new file mode 100644
index 0000000000000..2b02c98e0d605
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.md
@@ -0,0 +1,48 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md)
+
+## kibana-plugin-plugins-kibana\_utils-public-state\_sync package
+
+State syncing utilities are a set of helpers for syncing your application state with URL or browser storage.
+
+They are designed to work together with state containers (). But state containers are not required.
+
+State syncing utilities include:
+
+- [syncState()](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md) util which: - Subscribes to state changes and pushes them to state storage. - Optionally subscribes to state storage changes and pushes them to state. - Two types of storage compatible with `syncState`: - [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) - Serializes state and persists it to URL's query param in rison or hashed format. Listens for state updates in the URL and pushes them back to state. - [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) - Serializes state and persists it to browser storage.
+
+Refer [here](https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_sync) for a complete guide and examples
+
+## Functions
+
+| Function | Description |
+| --- | --- |
+| [syncState({ storageKey, stateStorage, stateContainer, })](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md) | Utility for syncing application state wrapped in state container with some kind of storage (e.g. URL) Refer [here](https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_sync) for a complete guide and examples |
+| [syncStates(stateSyncConfigs)](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstates.md) | |
+
+## Interfaces
+
+| Interface | Description |
+| --- | --- |
+| [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) | KbnUrlStateStorage is a state storage for [syncState()](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md) utility which: 1. Keeps state in sync with the URL. 2. Serializes data and stores it in the URL in one of the supported formats: \* Rison encoded. \* Hashed URL: In URL we store only the hash from the serialized state, but the state itself is stored in sessionStorage. See kibana's advanced option for more context state:storeInSessionStorage 3. Takes care of listening to the URL updates and notifies state about the updates. 4. Takes care of batching URL updates to prevent redundant browser history records. [GUIDE](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync/storages/kbn_url_storage.md) |
+| [INullableBaseStateContainer](./kibana-plugin-plugins-kibana_utils-public-state_sync.inullablebasestatecontainer.md) | Extension of with one constraint: set state should handle null
as incoming state |
+| [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) | [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) for storing state in browser [guide](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync/storages/session_storage.md) |
+| [IStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatestorage.md) | Any StateStorage have to implement IStateStorage interface StateStorage is responsible for: \* state serialisation / deserialization \* persisting to and retrieving from storageFor an example take a look at already implemented [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) and [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) state storages |
+| [IStateSyncConfig](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md) | Config for setting up state syncing with |
+| [ISyncStateRef](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md) | |
+
+## Variables
+
+| Variable | Description |
+| --- | --- |
+| [createKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.createkbnurlstatestorage.md) | Creates [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) state storage |
+| [createSessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.createsessionstoragestatestorage.md) | Creates [ISessionStorageStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.isessionstoragestatestorage.md) [guide](https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_sync/storages/session_storage.md) |
+
+## Type Aliases
+
+| Type Alias | Description |
+| --- | --- |
+| [StartSyncStateFnType](./kibana-plugin-plugins-kibana_utils-public-state_sync.startsyncstatefntype.md) | |
+| [StopSyncStateFnType](./kibana-plugin-plugins-kibana_utils-public-state_sync.stopsyncstatefntype.md) | |
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.startsyncstatefntype.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.startsyncstatefntype.md
new file mode 100644
index 0000000000000..23f71ba330d4b
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.startsyncstatefntype.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [StartSyncStateFnType](./kibana-plugin-plugins-kibana_utils-public-state_sync.startsyncstatefntype.md)
+
+## StartSyncStateFnType type
+
+
+Signature:
+
+```typescript
+export declare type StartSyncStateFnType = () => void;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.stopsyncstatefntype.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.stopsyncstatefntype.md
new file mode 100644
index 0000000000000..69ff6e899e860
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.stopsyncstatefntype.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [StopSyncStateFnType](./kibana-plugin-plugins-kibana_utils-public-state_sync.stopsyncstatefntype.md)
+
+## StopSyncStateFnType type
+
+
+Signature:
+
+```typescript
+export declare type StopSyncStateFnType = () => void;
+```
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md
new file mode 100644
index 0000000000000..d095c3fffc512
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md
@@ -0,0 +1,93 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [syncState](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstate.md)
+
+## syncState() function
+
+Utility for syncing application state wrapped in state container with some kind of storage (e.g. URL) Refer [here](https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_sync) for a complete guide and examples
+
+Signature:
+
+```typescript
+export declare function syncState({ storageKey, stateStorage, stateContainer, }: IStateSyncConfig): ISyncStateRef;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| { storageKey, stateStorage, stateContainer, } | IStateSyncConfig<State, IStateStorage>
| |
+
+Returns:
+
+`ISyncStateRef`
+
+- [ISyncStateRef](./kibana-plugin-plugins-kibana_utils-public-state_sync.isyncstateref.md)
+
+## Remarks
+
+1. It is responsibility of consumer to make sure that initial app state and storage are in sync before starting syncing No initial sync happens when syncState() is called
+
+## Example 1
+
+1. the simplest use case
+
+```ts
+const stateStorage = createKbnUrlStateStorage();
+syncState({
+ storageKey: '_s',
+ stateContainer,
+ stateStorage
+});
+
+```
+
+## Example 2
+
+2. conditionally configuring sync strategy
+
+```ts
+const stateStorage = createKbnUrlStateStorage({useHash: config.get('state:stateContainerInSessionStorage')})
+syncState({
+ storageKey: '_s',
+ stateContainer,
+ stateStorage
+});
+
+```
+
+## Example 3
+
+3. implementing custom sync strategy
+
+```ts
+const localStorageStateStorage = {
+ set: (storageKey, state) => localStorage.setItem(storageKey, JSON.stringify(state)),
+ get: (storageKey) => localStorage.getItem(storageKey) ? JSON.parse(localStorage.getItem(storageKey)) : null
+};
+syncState({
+ storageKey: '_s',
+ stateContainer,
+ stateStorage: localStorageStateStorage
+});
+
+```
+
+## Example 4
+
+4. Transform state before serialising Useful for: \* Migration / backward compatibility \* Syncing part of state \* Providing default values
+
+```ts
+const stateToStorage = (s) => ({ tab: s.tab });
+syncState({
+ storageKey: '_s',
+ stateContainer: {
+ get: () => stateToStorage(stateContainer.get()),
+ set: stateContainer.set(({ tab }) => ({ ...stateContainer.get(), tab }),
+ state$: stateContainer.state$.pipe(map(stateToStorage))
+ },
+ stateStorage
+});
+
+```
+
diff --git a/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.syncstates.md b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.syncstates.md
new file mode 100644
index 0000000000000..87a2449a384df
--- /dev/null
+++ b/docs/development/plugins/kibana_utils/public/state_sync/kibana-plugin-plugins-kibana_utils-public-state_sync.syncstates.md
@@ -0,0 +1,42 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [syncStates](./kibana-plugin-plugins-kibana_utils-public-state_sync.syncstates.md)
+
+## syncStates() function
+
+Signature:
+
+```typescript
+export declare function syncStates(stateSyncConfigs: Array>): ISyncStateRef;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| stateSyncConfigs | Array<IStateSyncConfig<any>>
| Array of [IStateSyncConfig](./kibana-plugin-plugins-kibana_utils-public-state_sync.istatesyncconfig.md) to sync |
+
+Returns:
+
+`ISyncStateRef`
+
+## Example
+
+sync multiple different sync configs
+
+```ts
+syncStates([
+ {
+ storageKey: '_s1',
+ stateStorage: stateStorage1,
+ stateContainer: stateContainer1,
+ },
+ {
+ storageKey: '_s2',
+ stateStorage: stateStorage2,
+ stateContainer: stateContainer2,
+ },
+]);
+
+```
+
diff --git a/docs/setup/connect-to-elasticsearch.asciidoc b/docs/setup/connect-to-elasticsearch.asciidoc
index 0575b8532508f..bffb3f97cd1b9 100644
--- a/docs/setup/connect-to-elasticsearch.asciidoc
+++ b/docs/setup/connect-to-elasticsearch.asciidoc
@@ -23,8 +23,8 @@ experimental[]
To visualize data in a CSV, JSON, or log file, you can upload it using the File
Data Visualizer. On the home page, click *Import a CSV, NDSON, or log file*, and
then drag your file into the File Data Visualizer. Alternatively, you can open
-it by navigating to the Machine Learning app page from the sidebar menu and
-selecting the Data Visualizer from the top navigation bar on the opening page.
+it by navigating to *Machine Learning* from the side navigation and selecting
+*Data Visualizer*.
[role="screenshot"]
image::images/data-viz-homepage.jpg[File Data Visualizer on the home page]
diff --git a/scripts/backport.js b/scripts/backport.js
index 64cd5721834ea..2094534e2c4b3 100644
--- a/scripts/backport.js
+++ b/scripts/backport.js
@@ -18,4 +18,5 @@
*/
require('../src/setup_node_env/node_version_validator');
-require('backport');
+var backport = require('backport');
+backport.run();
diff --git a/src/core/server/index.ts b/src/core/server/index.ts
index e0afd5e57f041..7520111bf33ac 100644
--- a/src/core/server/index.ts
+++ b/src/core/server/index.ts
@@ -60,7 +60,7 @@ import {
} from './saved_objects';
import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
import { UuidServiceSetup } from './uuid';
-import { MetricsServiceSetup } from './metrics';
+import { MetricsServiceStart } from './metrics';
import { StatusServiceSetup } from './status';
import {
LoggingServiceSetup,
@@ -403,8 +403,6 @@ export interface CoreSetup {
contracts: new Map([['plugin-id', 'plugin-value']]),
},
rendering: renderingServiceMock,
- metrics: metricsServiceMock.createInternalSetupContract(),
uuid: uuidSetup,
status: statusServiceMock.createInternalSetupContract(),
logging: loggingServiceMock.createInternalSetupContract(),
diff --git a/src/core/server/legacy/legacy_service.ts b/src/core/server/legacy/legacy_service.ts
index be737f6593c02..a544bad6c0e41 100644
--- a/src/core/server/legacy/legacy_service.ts
+++ b/src/core/server/legacy/legacy_service.ts
@@ -276,6 +276,9 @@ export class LegacyService implements CoreService {
createSerializer: startDeps.core.savedObjects.createSerializer,
getTypeRegistry: startDeps.core.savedObjects.getTypeRegistry,
},
+ metrics: {
+ getOpsMetrics$: startDeps.core.metrics.getOpsMetrics$,
+ },
uiSettings: { asScopedToClient: startDeps.core.uiSettings.asScopedToClient },
};
@@ -312,9 +315,6 @@ export class LegacyService implements CoreService {
logging: {
configure: (config$) => setupDeps.core.logging.configure([], config$),
},
- metrics: {
- getOpsMetrics$: setupDeps.core.metrics.getOpsMetrics$,
- },
savedObjects: {
setClientFactoryProvider: setupDeps.core.savedObjects.setClientFactoryProvider,
addClientWrapper: setupDeps.core.savedObjects.addClientWrapper,
diff --git a/src/core/server/metrics/metrics_service.mock.ts b/src/core/server/metrics/metrics_service.mock.ts
index cc53a4e27d571..769f6ee2a549a 100644
--- a/src/core/server/metrics/metrics_service.mock.ts
+++ b/src/core/server/metrics/metrics_service.mock.ts
@@ -16,29 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-
+import { BehaviorSubject } from 'rxjs';
import { MetricsService } from './metrics_service';
import {
InternalMetricsServiceSetup,
InternalMetricsServiceStart,
- MetricsServiceSetup,
MetricsServiceStart,
} from './types';
-const createSetupContractMock = () => {
- const setupContract: jest.Mocked = {
- getOpsMetrics$: jest.fn(),
- };
- return setupContract;
-};
-
const createInternalSetupContractMock = () => {
- const setupContract: jest.Mocked = createSetupContractMock();
+ const setupContract: jest.Mocked = {};
return setupContract;
};
const createStartContractMock = () => {
- const startContract: jest.Mocked = {};
+ const startContract: jest.Mocked = {
+ getOpsMetrics$: jest.fn(),
+ };
+ startContract.getOpsMetrics$.mockReturnValue(
+ new BehaviorSubject({
+ process: {
+ memory: {
+ heap: { total_in_bytes: 1, used_in_bytes: 1, size_limit: 1 },
+ resident_set_size_in_bytes: 1,
+ },
+ event_loop_delay: 1,
+ pid: 1,
+ uptime_in_millis: 1,
+ },
+ os: {
+ platform: 'darwin' as const,
+ platformRelease: 'test',
+ load: { '1m': 1, '5m': 1, '15m': 1 },
+ memory: { total_in_bytes: 1, free_in_bytes: 1, used_in_bytes: 1 },
+ uptime_in_millis: 1,
+ },
+ response_times: { avg_in_millis: 1, max_in_millis: 1 },
+ requests: { disconnects: 1, total: 1, statusCodes: { '200': 1 } },
+ concurrent_connections: 1,
+ })
+ );
return startContract;
};
@@ -60,7 +77,7 @@ const createMock = () => {
export const metricsServiceMock = {
create: createMock,
- createSetupContract: createSetupContractMock,
+ createSetupContract: createStartContractMock,
createStartContract: createStartContractMock,
createInternalSetupContract: createInternalSetupContractMock,
createInternalStartContract: createInternalStartContractMock,
diff --git a/src/core/server/metrics/metrics_service.test.ts b/src/core/server/metrics/metrics_service.test.ts
index b3cc06ffca1d2..f2019de7b6cab 100644
--- a/src/core/server/metrics/metrics_service.test.ts
+++ b/src/core/server/metrics/metrics_service.test.ts
@@ -75,8 +75,8 @@ describe('MetricsService', () => {
it('resets the collector after each collection', async () => {
mockOpsCollector.collect.mockResolvedValue(dummyMetrics);
- const { getOpsMetrics$ } = await metricsService.setup({ http: httpMock });
- await metricsService.start();
+ await metricsService.setup({ http: httpMock });
+ const { getOpsMetrics$ } = await metricsService.start();
// `advanceTimersByTime` only ensure the interval handler is executed
// however the `reset` call is executed after the async call to `collect`
@@ -109,8 +109,8 @@ describe('MetricsService', () => {
describe('#stop', () => {
it('stops the metrics interval', async () => {
- const { getOpsMetrics$ } = await metricsService.setup({ http: httpMock });
- await metricsService.start();
+ await metricsService.setup({ http: httpMock });
+ const { getOpsMetrics$ } = await metricsService.start();
expect(mockOpsCollector.collect).toHaveBeenCalledTimes(1);
@@ -125,8 +125,8 @@ describe('MetricsService', () => {
});
it('completes the metrics observable', async () => {
- const { getOpsMetrics$ } = await metricsService.setup({ http: httpMock });
- await metricsService.start();
+ await metricsService.setup({ http: httpMock });
+ const { getOpsMetrics$ } = await metricsService.start();
let completed = false;
diff --git a/src/core/server/metrics/metrics_service.ts b/src/core/server/metrics/metrics_service.ts
index 0ea9d00792600..f28fb21aaac0d 100644
--- a/src/core/server/metrics/metrics_service.ts
+++ b/src/core/server/metrics/metrics_service.ts
@@ -45,12 +45,7 @@ export class MetricsService
public async setup({ http }: MetricsServiceSetupDeps): Promise {
this.metricsCollector = new OpsMetricsCollector(http.server);
-
- const metricsObservable = this.metrics$.asObservable();
-
- return {
- getOpsMetrics$: () => metricsObservable,
- };
+ return {};
}
public async start(): Promise {
@@ -68,7 +63,11 @@ export class MetricsService
this.refreshMetrics();
}, config.interval.asMilliseconds());
- return {};
+ const metricsObservable = this.metrics$.asObservable();
+
+ return {
+ getOpsMetrics$: () => metricsObservable,
+ };
}
private async refreshMetrics() {
diff --git a/src/core/server/metrics/types.ts b/src/core/server/metrics/types.ts
index 5c8f18fff380d..cbf0acacd6bab 100644
--- a/src/core/server/metrics/types.ts
+++ b/src/core/server/metrics/types.ts
@@ -20,12 +20,14 @@
import { Observable } from 'rxjs';
import { OpsProcessMetrics, OpsOsMetrics, OpsServerMetrics } from './collectors';
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+export interface MetricsServiceSetup {}
/**
* APIs to retrieves metrics gathered and exposed by the core platform.
*
* @public
*/
-export interface MetricsServiceSetup {
+export interface MetricsServiceStart {
/**
* Retrieve an observable emitting the {@link OpsMetrics} gathered.
* The observable will emit an initial value during core's `start` phase, and a new value every fixed interval of time,
@@ -40,8 +42,6 @@ export interface MetricsServiceSetup {
*/
getOpsMetrics$: () => Observable;
}
-// eslint-disable-next-line @typescript-eslint/no-empty-interface
-export interface MetricsServiceStart {}
export type InternalMetricsServiceSetup = MetricsServiceSetup;
export type InternalMetricsServiceStart = MetricsServiceStart;
diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts
index 2ac5bd98f7ed4..4491942951c50 100644
--- a/src/core/server/mocks.ts
+++ b/src/core/server/mocks.ts
@@ -129,7 +129,6 @@ function createCoreSetupMock({
http: httpMock,
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
status: statusServiceMock.createSetupContract(),
- metrics: metricsServiceMock.createSetupContract(),
uiSettings: uiSettingsMock,
uuid: uuidServiceMock.createSetupContract(),
logging: loggingServiceMock.createSetupContract(),
@@ -146,6 +145,7 @@ function createCoreStartMock() {
capabilities: capabilitiesServiceMock.createStartContract(),
elasticsearch: elasticsearchServiceMock.createStart(),
http: httpServiceMock.createStartContract(),
+ metrics: metricsServiceMock.createStartContract(),
savedObjects: savedObjectsServiceMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
};
@@ -159,7 +159,6 @@ function createInternalCoreSetupMock() {
context: contextServiceMock.createSetupContract(),
elasticsearch: elasticsearchServiceMock.createInternalSetup(),
http: httpServiceMock.createInternalSetupContract(),
- metrics: metricsServiceMock.createInternalSetupContract(),
savedObjects: savedObjectsServiceMock.createInternalSetupContract(),
status: statusServiceMock.createInternalSetupContract(),
uuid: uuidServiceMock.createSetupContract(),
@@ -176,6 +175,7 @@ function createInternalCoreStartMock() {
capabilities: capabilitiesServiceMock.createStartContract(),
elasticsearch: elasticsearchServiceMock.createStart(),
http: httpServiceMock.createInternalStartContract(),
+ metrics: metricsServiceMock.createStartContract(),
savedObjects: savedObjectsServiceMock.createInternalStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
};
diff --git a/src/core/server/plugins/plugin_context.ts b/src/core/server/plugins/plugin_context.ts
index 32bc8dc088cad..4643789d99a88 100644
--- a/src/core/server/plugins/plugin_context.ts
+++ b/src/core/server/plugins/plugin_context.ts
@@ -169,9 +169,6 @@ export function createPluginSetupContext(
logging: {
configure: (config$) => deps.logging.configure(['plugins', plugin.name], config$),
},
- metrics: {
- getOpsMetrics$: deps.metrics.getOpsMetrics$,
- },
savedObjects: {
setClientFactoryProvider: deps.savedObjects.setClientFactoryProvider,
addClientWrapper: deps.savedObjects.addClientWrapper,
@@ -225,6 +222,9 @@ export function createPluginStartContext(
createSerializer: deps.savedObjects.createSerializer,
getTypeRegistry: deps.savedObjects.getTypeRegistry,
},
+ metrics: {
+ getOpsMetrics$: deps.metrics.getOpsMetrics$,
+ },
uiSettings: {
asScopedToClient: deps.uiSettings.asScopedToClient,
},
diff --git a/src/core/server/saved_objects/mappings/types.ts b/src/core/server/saved_objects/mappings/types.ts
index 8362d1f16bd2a..c037ed733549e 100644
--- a/src/core/server/saved_objects/mappings/types.ts
+++ b/src/core/server/saved_objects/mappings/types.ts
@@ -145,10 +145,14 @@ export interface SavedObjectsCoreFieldMapping {
/**
* See {@link SavedObjectsFieldMapping} for documentation.
*
+ * Note: this type intentially doesn't include a type definition for defining
+ * the `dynamic` mapping parameter. Saved Object fields should always inherit
+ * the `dynamic: 'strict'` paramater. If you are unsure of the shape of your
+ * data use `type: 'object', enabled: false` instead.
+ *
* @public
*/
export interface SavedObjectsComplexFieldMapping {
- dynamic?: string;
type?: string;
properties: SavedObjectsMappingProperties;
}
diff --git a/src/core/server/saved_objects/migrations/core/build_active_mappings.ts b/src/core/server/saved_objects/migrations/core/build_active_mappings.ts
index c2a7b11e057cd..4561f4d30e104 100644
--- a/src/core/server/saved_objects/migrations/core/build_active_mappings.ts
+++ b/src/core/server/saved_objects/migrations/core/build_active_mappings.ts
@@ -130,6 +130,8 @@ function defaultMapping(): IndexMapping {
dynamic: 'strict',
properties: {
migrationVersion: {
+ // Saved Objects can't redefine dynamic, but we cheat here to support migrations
+ // @ts-expect-error
dynamic: 'true',
type: 'object',
},
diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md
index 4d6316fceb568..108826ad61aa2 100644
--- a/src/core/server/server.api.md
+++ b/src/core/server/server.api.md
@@ -712,8 +712,6 @@ export interface CoreSetup Observable;
}
// @public (undocumented)
@@ -1970,8 +1974,6 @@ export interface SavedObjectsClientWrapperOptions {
// @public
export interface SavedObjectsComplexFieldMapping {
- // (undocumented)
- dynamic?: string;
// (undocumented)
properties: SavedObjectsMappingProperties;
// (undocumented)
diff --git a/src/core/server/server.ts b/src/core/server/server.ts
index 3bbcd0e37e142..dc37b77c57c92 100644
--- a/src/core/server/server.ts
+++ b/src/core/server/server.ts
@@ -150,7 +150,7 @@ export class Server {
savedObjects: savedObjectsSetup,
});
- const metricsSetup = await this.metrics.setup({ http: httpSetup });
+ await this.metrics.setup({ http: httpSetup });
const renderingSetup = await this.rendering.setup({
http: httpSetup,
@@ -181,7 +181,6 @@ export class Server {
status: statusSetup,
uiSettings: uiSettingsSetup,
uuid: uuidSetup,
- metrics: metricsSetup,
rendering: renderingSetup,
httpResources: httpResourcesSetup,
logging: loggingSetup,
@@ -211,12 +210,14 @@ export class Server {
});
const capabilitiesStart = this.capabilities.start();
const uiSettingsStart = await this.uiSettings.start();
+ const metricsStart = await this.metrics.start();
const httpStart = this.http.getStartContract();
this.coreStart = {
capabilities: capabilitiesStart,
elasticsearch: elasticsearchStart,
http: httpStart,
+ metrics: metricsStart,
savedObjects: savedObjectsStart,
uiSettings: uiSettingsStart,
};
@@ -236,7 +237,6 @@ export class Server {
await this.rendering.start({
legacy: this.legacy,
});
- await this.metrics.start();
return this.coreStart;
}
diff --git a/src/dev/build/tasks/copy_source_task.js b/src/dev/build/tasks/copy_source_task.js
index ddc6d000bca19..32eb7bf8712e3 100644
--- a/src/dev/build/tasks/copy_source_task.js
+++ b/src/dev/build/tasks/copy_source_task.js
@@ -34,9 +34,7 @@ export const CopySourceTask = {
'!src/test_utils/**',
'!src/fixtures/**',
'!src/legacy/core_plugins/tests_bundle/**',
- '!src/legacy/core_plugins/testbed/**',
'!src/legacy/core_plugins/console/public/tests/**',
- '!src/plugins/testbed/**',
'!src/cli/cluster/**',
'!src/cli/repl/**',
'!src/es_archiver/**',
diff --git a/src/dev/run_check_published_api_changes.ts b/src/dev/run_check_published_api_changes.ts
index 45dafe1b415e3..0aa450c8b002a 100644
--- a/src/dev/run_check_published_api_changes.ts
+++ b/src/dev/run_check_published_api_changes.ts
@@ -43,7 +43,18 @@ import getopts from 'getopts';
*/
const getReportFileName = (folder: string) => {
- return folder.indexOf('public') > -1 ? 'public' : 'server';
+ switch (true) {
+ case folder.includes('public'):
+ return 'public';
+ case folder.includes('server'):
+ return 'server';
+ case folder.includes('common'):
+ return 'common';
+ default:
+ throw new Error(
+ `folder "${folder}" expected to include one of ["public", "server", "common"]`
+ );
+ }
};
const apiExtractorConfig = (folder: string): ExtractorConfig => {
@@ -131,7 +142,7 @@ const runApiExtractor = (
messageCallback: (message: ExtractorMessage) => {
if (message.messageId === 'console-api-report-not-copied') {
// ConsoleMessageId.ApiReportNotCopied
- log.warning(`You have changed the signature of the ${folder} Core API`);
+ log.warning(`You have changed the signature of the ${folder} public API`);
log.warning(
'To accept these changes run `node scripts/check_published_api_changes.js --accept` and then:\n' +
"\t 1. Commit the updated documentation and API review file '" +
@@ -142,7 +153,7 @@ const runApiExtractor = (
message.handled = true;
} else if (message.messageId === 'console-api-report-copied') {
// ConsoleMessageId.ApiReportCopied
- log.warning(`You have changed the signature of the ${folder} Core API`);
+ log.warning(`You have changed the signature of the ${folder} public API`);
log.warning(
"Please commit the updated API documentation and the API review file: '" +
config.reportFilePath
@@ -150,7 +161,7 @@ const runApiExtractor = (
message.handled = true;
} else if (message.messageId === 'console-api-report-unchanged') {
// ConsoleMessageId.ApiReportUnchanged
- log.info(`Core ${folder} API: no changes detected ✔`);
+ log.info(`${folder} API: no changes detected ✔`);
message.handled = true;
}
},
@@ -170,7 +181,7 @@ async function run(
folder: string,
{ log, opts }: { log: ToolingLog; opts: Options }
): Promise {
- log.info(`Core ${folder} API: checking for changes in API signature...`);
+ log.info(`${folder} API: checking for changes in API signature...`);
const { apiReportChanged, succeeded } = runApiExtractor(log, folder, opts.accept);
@@ -188,7 +199,7 @@ async function run(
log.error(e);
return false;
}
- log.info(`Core ${folder} API: updated documentation ✔`);
+ log.info(`${folder} API: updated documentation ✔`);
}
// If the api signature changed or any errors or warnings occured, exit with an error
@@ -224,24 +235,31 @@ async function run(
opts.help = true;
}
- const folders = ['core/public', 'core/server', 'plugins/data/server', 'plugins/data/public'];
+ const core = ['core/public', 'core/server'];
+ const plugins = [
+ 'plugins/data/server',
+ 'plugins/data/public',
+ 'plugins/kibana_utils/common/state_containers',
+ 'plugins/kibana_utils/public/state_sync',
+ ];
+ const folders = [...core, ...plugins];
if (opts.help) {
process.stdout.write(
dedent(chalk`
{dim usage:} node scripts/check_published_api_changes [...options]
- Checks for any changes to the Kibana Core API
+ Checks for any changes to the Kibana shared API
Examples:
- {dim # Checks for any changes to the Kibana Core API}
+ {dim # Checks for any changes to the Kibana shared API}
{dim $} node scripts/check_published_api_changes
- {dim # Checks for any changes to the Kibana Core API and updates the documentation}
+ {dim # Checks for any changes to the Kibana shared API and updates the documentation}
{dim $} node scripts/check_published_api_changes --docs
- {dim # Checks for and automatically accepts and updates documentation for any changes to the Kibana Core API}
+ {dim # Checks for and automatically accepts and updates documentation for any changes to the Kibana shared API}
{dim $} node scripts/check_published_api_changes --accept
{dim # Only checks the core/public directory}
@@ -249,7 +267,7 @@ async function run(
Options:
--accept {dim Accepts all changes by updating the API Review files and documentation}
- --docs {dim Updates the Core API documentation}
+ --docs {dim Updates the API documentation}
--filter {dim RegExp that folder names must match, folders: [${folders.join(', ')}]}
--help {dim Show this message}
`)
@@ -259,20 +277,22 @@ async function run(
}
try {
- log.info(`Core: Building types...`);
+ log.info(`Building types for api extractor...`);
await runBuildTypes();
} catch (e) {
log.error(e);
return false;
}
- const results = await Promise.all(
- folders
- .filter((folder) => (opts.filter.length ? folder.match(opts.filter) : true))
- .map((folder) => run(folder, { log, opts }))
+ const filteredFolders = folders.filter((folder) =>
+ opts.filter.length ? folder.match(opts.filter) : true
);
+ const results = [];
+ for (const folder of filteredFolders) {
+ results.push(await run(folder, { log, opts }));
+ }
- if (results.find((r) => r === false) !== undefined) {
+ if (results.includes(false)) {
process.exitCode = 1;
}
})().catch((e) => {
diff --git a/src/legacy/core_plugins/testbed/README.md b/src/legacy/core_plugins/testbed/README.md
deleted file mode 100644
index ac50ffbb804b5..0000000000000
--- a/src/legacy/core_plugins/testbed/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-## Kibana Testbed
-
-Sometimes when developing for Kibana, it is useful to have an isolated routable space to demonstrate new functionality. This Testbed provides such a space.
-
-To make use of the testbed, edit the testbed.js, testbed.html, and testbed.less files as necessary. When you are done demonstrating
-your new functionality, remember to cleanup your changes and restore the testbed to its pristine state for the next person.
-
-To access the testbed, visit `http://localhost:5601/app/kibana#/testbed`
diff --git a/src/legacy/core_plugins/testbed/package.json b/src/legacy/core_plugins/testbed/package.json
deleted file mode 100644
index 98fcaf7eda95d..0000000000000
--- a/src/legacy/core_plugins/testbed/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "testbed",
- "version": "kibana"
-}
\ No newline at end of file
diff --git a/src/legacy/core_plugins/testbed/public/testbed.html b/src/legacy/core_plugins/testbed/public/testbed.html
deleted file mode 100644
index 52455beb02360..0000000000000
--- a/src/legacy/core_plugins/testbed/public/testbed.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
{{ testbed.data }}
-
-
-
-
-
-
-
-
diff --git a/src/legacy/server/status/routes/api/register_stats.js b/src/legacy/server/status/routes/api/register_stats.js
index 09957e61f74d3..0221c7e0ea085 100644
--- a/src/legacy/server/status/routes/api/register_stats.js
+++ b/src/legacy/server/status/routes/api/register_stats.js
@@ -54,7 +54,7 @@ export function registerStatsApi(usageCollection, server, config, kbnServer) {
/* kibana_stats gets singled out from the collector set as it is used
* for health-checking Kibana and fetch does not rely on fetching data
* from ES */
- server.newPlatform.setup.core.metrics.getOpsMetrics$().subscribe((metrics) => {
+ server.newPlatform.start.core.metrics.getOpsMetrics$().subscribe((metrics) => {
lastMetrics = {
...metrics,
timestamp: new Date().toISOString(),
diff --git a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx
index 3c559a6cde211..b52bf5bf02b7b 100644
--- a/src/plugins/dashboard/public/application/dashboard_app_controller.tsx
+++ b/src/plugins/dashboard/public/application/dashboard_app_controller.tsx
@@ -60,6 +60,7 @@ import {
ViewMode,
SavedObjectEmbeddableInput,
ContainerOutput,
+ EmbeddableInput,
} from '../../../embeddable/public';
import { NavAction, SavedDashboardPanel } from '../types';
@@ -430,9 +431,16 @@ export class DashboardAppController {
.getStateTransfer(scopedHistory())
.getIncomingEmbeddablePackage();
if (incomingState) {
- container.addNewEmbeddable(incomingState.type, {
- savedObjectId: incomingState.id,
- });
+ if ('id' in incomingState) {
+ container.addNewEmbeddable(incomingState.type, {
+ savedObjectId: incomingState.id,
+ });
+ } else if ('input' in incomingState) {
+ container.addNewEmbeddable(
+ incomingState.type,
+ incomingState.input
+ );
+ }
}
}
diff --git a/src/plugins/data/common/es_query/filters/meta_filter.ts b/src/plugins/data/common/es_query/filters/meta_filter.ts
index ff6dff9d8b749..e3099ae6a4026 100644
--- a/src/plugins/data/common/es_query/filters/meta_filter.ts
+++ b/src/plugins/data/common/es_query/filters/meta_filter.ts
@@ -107,3 +107,13 @@ export const pinFilter = (filter: Filter) =>
export const unpinFilter = (filter: Filter) =>
!isFilterPinned(filter) ? filter : toggleFilterPinned(filter);
+
+export const isFilter = (x: unknown): x is Filter =>
+ !!x &&
+ typeof x === 'object' &&
+ !!(x as Filter).meta &&
+ typeof (x as Filter).meta === 'object' &&
+ typeof (x as Filter).meta.disabled === 'boolean';
+
+export const isFilters = (x: unknown): x is Filter[] =>
+ Array.isArray(x) && !x.find((y) => !isFilter(y));
diff --git a/src/plugins/data/common/index.ts b/src/plugins/data/common/index.ts
index adbd93d518fc7..b40e02b709d30 100644
--- a/src/plugins/data/common/index.ts
+++ b/src/plugins/data/common/index.ts
@@ -20,11 +20,12 @@
export * from './constants';
export * from './es_query';
export * from './field_formats';
+export * from './field_mapping';
export * from './index_patterns';
export * from './kbn_field_types';
export * from './query';
export * from './search';
export * from './search/aggs';
+export * from './timefilter';
export * from './types';
export * from './utils';
-export * from './field_mapping';
diff --git a/src/plugins/data/common/query/index.ts b/src/plugins/data/common/query/index.ts
index 421cc4f63e4ef..4e90f6f8bb83e 100644
--- a/src/plugins/data/common/query/index.ts
+++ b/src/plugins/data/common/query/index.ts
@@ -19,3 +19,4 @@
export * from './filter_manager';
export * from './types';
+export * from './is_query';
diff --git a/src/legacy/core_plugins/testbed/index.js b/src/plugins/data/common/query/is_query.ts
similarity index 73%
rename from src/legacy/core_plugins/testbed/index.js
rename to src/plugins/data/common/query/is_query.ts
index f0b61ea0c3de7..08a99a39b1ac1 100644
--- a/src/legacy/core_plugins/testbed/index.js
+++ b/src/plugins/data/common/query/is_query.ts
@@ -17,14 +17,11 @@
* under the License.
*/
-import { resolve } from 'path';
+import { Query } from './types';
-export default function (kibana) {
- return new kibana.Plugin({
- id: 'testbed',
- publicDir: resolve(__dirname, 'public'),
- uiExports: {
- hacks: ['plugins/testbed'],
- },
- });
-}
+export const isQuery = (x: unknown): x is Query =>
+ !!x &&
+ typeof x === 'object' &&
+ typeof (x as Query).language === 'string' &&
+ (typeof (x as Query).query === 'string' ||
+ (typeof (x as Query).query === 'object' && !!(x as Query).query));
diff --git a/src/legacy/core_plugins/testbed/public/index.js b/src/plugins/data/common/timefilter/index.ts
similarity index 94%
rename from src/legacy/core_plugins/testbed/public/index.js
rename to src/plugins/data/common/timefilter/index.ts
index c6687de249cf2..e0c509e119fda 100644
--- a/src/legacy/core_plugins/testbed/public/index.js
+++ b/src/plugins/data/common/timefilter/index.ts
@@ -17,4 +17,4 @@
* under the License.
*/
-import './testbed';
+export { isTimeRange } from './is_time_range';
diff --git a/src/legacy/core_plugins/testbed/public/testbed.js b/src/plugins/data/common/timefilter/is_time_range.ts
similarity index 78%
rename from src/legacy/core_plugins/testbed/public/testbed.js
rename to src/plugins/data/common/timefilter/is_time_range.ts
index 13005a6106ca4..f206cd04dde31 100644
--- a/src/legacy/core_plugins/testbed/public/testbed.js
+++ b/src/plugins/data/common/timefilter/is_time_range.ts
@@ -17,13 +17,10 @@
* under the License.
*/
-import uiRoutes from 'ui/routes';
-import template from './testbed.html';
+import { TimeRange } from './types';
-uiRoutes.when('/testbed', {
- template: template,
- controllerAs: 'testbed',
- controller: class TestbedController {
- constructor() {}
- },
-});
+export const isTimeRange = (x: unknown): x is TimeRange =>
+ !!x &&
+ typeof x === 'object' &&
+ typeof (x as TimeRange).from === 'string' &&
+ typeof (x as TimeRange).to === 'string';
diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts
index 3665d9dc2b46e..efce8d2c021c9 100644
--- a/src/plugins/data/public/index.ts
+++ b/src/plugins/data/public/index.ts
@@ -440,6 +440,8 @@ export {
getKbnTypeNames,
} from '../common';
+export { isTimeRange, isQuery, isFilter, isFilters } from '../common';
+
export * from '../common/field_mapping';
/*
diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md
index 25c9b0718050a..b12ad94017fbb 100644
--- a/src/plugins/data/public/public.api.md
+++ b/src/plugins/data/public/public.api.md
@@ -1291,6 +1291,26 @@ export interface ISearchStrategy {
search: ISearch;
}
+// Warning: (ae-missing-release-tag) "isFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export const isFilter: (x: unknown) => x is Filter;
+
+// Warning: (ae-missing-release-tag) "isFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export const isFilters: (x: unknown) => x is Filter[];
+
+// Warning: (ae-missing-release-tag) "isQuery" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export const isQuery: (x: unknown) => x is Query;
+
+// Warning: (ae-missing-release-tag) "isTimeRange" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
+//
+// @public (undocumented)
+export const isTimeRange: (x: unknown) => x is TimeRange;
+
// Warning: (ae-missing-release-tag) "ISyncSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
diff --git a/src/plugins/discover/public/application/angular/directives/histogram.tsx b/src/plugins/discover/public/application/angular/directives/histogram.tsx
index 8b646106fe52f..9afe5e48bc5b8 100644
--- a/src/plugins/discover/public/application/angular/directives/histogram.tsx
+++ b/src/plugins/discover/public/application/angular/directives/histogram.tsx
@@ -323,6 +323,7 @@ export class DiscoverHistogram extends Component
{
+ test('validates given time ranges correctly', async () => {
+ const { toasts } = notificationServiceMock.createStartContract();
+ [
+ { from: '', to: '', result: false },
+ { from: 'now', to: 'now+1h', result: true },
+ { from: 'now', to: 'lala+1h', result: false },
+ { from: '', to: 'now', result: false },
+ { from: 'now', to: '', result: false },
+ { from: ' 2020-06-02T13:36:13.689Z', to: 'now', result: true },
+ { from: ' 2020-06-02T13:36:13.689Z', to: '2020-06-02T13:36:13.690Z', result: true },
+ ].map((test) => {
+ expect(validateTimeRange({ from: test.from, to: test.to }, toasts)).toEqual(test.result);
+ });
+ });
+
+ test('displays a toast when invalid data is entered', async () => {
+ const { toasts } = notificationServiceMock.createStartContract();
+ expect(validateTimeRange({ from: 'now', to: 'null' }, toasts)).toEqual(false);
+ expect(toasts.addDanger).toHaveBeenCalledWith({
+ title: 'Invalid time range',
+ text: "The provided time range is invalid. (from: 'now', to: 'null')",
+ });
+ });
+});
diff --git a/src/plugins/discover/public/application/helpers/validate_time_range.ts b/src/plugins/discover/public/application/helpers/validate_time_range.ts
new file mode 100644
index 0000000000000..411147f827333
--- /dev/null
+++ b/src/plugins/discover/public/application/helpers/validate_time_range.ts
@@ -0,0 +1,49 @@
+/*
+ * 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 dateMath from '@elastic/datemath';
+import { i18n } from '@kbn/i18n';
+import { ToastsStart } from 'kibana/public';
+
+/**
+ * Validates a given time filter range, provided by URL or UI
+ * Unless valid, it returns false and displays a notification
+ */
+export function validateTimeRange(
+ { from, to }: { from: string; to: string },
+ toastNotifications: ToastsStart
+): boolean {
+ const fromMoment = dateMath.parse(from);
+ const toMoment = dateMath.parse(to);
+ if (!fromMoment || !toMoment || !fromMoment.isValid() || !toMoment.isValid()) {
+ toastNotifications.addDanger({
+ title: i18n.translate('discover.notifications.invalidTimeRangeTitle', {
+ defaultMessage: `Invalid time range`,
+ }),
+ text: i18n.translate('discover.notifications.invalidTimeRangeText', {
+ defaultMessage: `The provided time range is invalid. (from: '{from}', to: '{to}')`,
+ values: {
+ from,
+ to,
+ },
+ }),
+ });
+ return false;
+ }
+ return true;
+}
diff --git a/src/plugins/discover/public/index.ts b/src/plugins/discover/public/index.ts
index 4154fdfeb3ff4..6ac8f674b6153 100644
--- a/src/plugins/discover/public/index.ts
+++ b/src/plugins/discover/public/index.ts
@@ -27,4 +27,4 @@ export function plugin(initializerContext: PluginInitializerContext) {
export { SavedSearch, SavedSearchLoader, createSavedSearchesLoader } from './saved_searches';
export { ISearchEmbeddable, SEARCH_EMBEDDABLE_TYPE, SearchInput } from './application/embeddable';
-export { DISCOVER_APP_URL_GENERATOR } from './url_generator';
+export { DISCOVER_APP_URL_GENERATOR, DiscoverUrlGeneratorState } from './url_generator';
diff --git a/src/plugins/discover/public/kibana_services.ts b/src/plugins/discover/public/kibana_services.ts
index cca63cd880b60..2c6bbcc3ecce1 100644
--- a/src/plugins/discover/public/kibana_services.ts
+++ b/src/plugins/discover/public/kibana_services.ts
@@ -60,10 +60,23 @@ export const [getDocViewsRegistry, setDocViewsRegistry] = createGetterSetter createHashHistory());
+/**
+ * Discover currently uses two `history` instances: one from Kibana Platform and
+ * another from `history` package. Below function is used every time Discover
+ * app is loaded to synchronize both instances.
+ *
+ * This helper is temporary until https://github.com/elastic/kibana/issues/65161 is resolved.
+ */
+export const syncHistoryLocations = () => {
+ const h = getHistory();
+ Object.assign(h.location, createHashHistory().location);
+ return h;
+};
+
export const [getScopedHistory, setScopedHistory] = createGetterSetter(
'scopedHistory'
);
diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts
index ba97efa55068d..e97ac783c616f 100644
--- a/src/plugins/discover/public/plugin.ts
+++ b/src/plugins/discover/public/plugin.ts
@@ -55,6 +55,7 @@ import {
setServices,
setScopedHistory,
getScopedHistory,
+ syncHistoryLocations,
getServices,
} from './kibana_services';
import { createSavedSearchesLoader } from './saved_searches';
@@ -245,6 +246,7 @@ export class DiscoverPlugin
throw Error('Discover plugin method initializeInnerAngular is undefined');
}
setScopedHistory(params.history);
+ syncHistoryLocations();
appMounted();
const {
plugins: { data: dataStart },
diff --git a/src/plugins/discover/public/url_generator.ts b/src/plugins/discover/public/url_generator.ts
index 42d689050d5ad..c7f2e2147e819 100644
--- a/src/plugins/discover/public/url_generator.ts
+++ b/src/plugins/discover/public/url_generator.ts
@@ -98,11 +98,13 @@ export class DiscoverUrlGenerator
const queryState: QueryState = {};
if (query) appState.query = query;
- if (filters) appState.filters = filters?.filter((f) => !esFilters.isFilterPinned(f));
+ if (filters && filters.length)
+ appState.filters = filters?.filter((f) => !esFilters.isFilterPinned(f));
if (indexPatternId) appState.index = indexPatternId;
if (timeRange) queryState.time = timeRange;
- if (filters) queryState.filters = filters?.filter((f) => esFilters.isFilterPinned(f));
+ if (filters && filters.length)
+ queryState.filters = filters?.filter((f) => esFilters.isFilterPinned(f));
if (refreshInterval) queryState.refreshInterval = refreshInterval;
let url = `${this.params.appBasePath}#/${savedSearchPath}`;
diff --git a/src/plugins/embeddable/kibana.json b/src/plugins/embeddable/kibana.json
index 06b0e88da334f..332237d19e218 100644
--- a/src/plugins/embeddable/kibana.json
+++ b/src/plugins/embeddable/kibana.json
@@ -4,6 +4,7 @@
"server": false,
"ui": true,
"requiredPlugins": [
+ "data",
"inspector",
"uiActions"
],
diff --git a/src/plugins/embeddable/public/index.ts b/src/plugins/embeddable/public/index.ts
index 1d1dc79121937..f19974942c43d 100644
--- a/src/plugins/embeddable/public/index.ts
+++ b/src/plugins/embeddable/public/index.ts
@@ -28,6 +28,7 @@ export {
ACTION_EDIT_PANEL,
Adapters,
AddPanelAction,
+ ChartActionContext,
Container,
ContainerInput,
ContainerOutput,
@@ -69,7 +70,7 @@ export {
isRangeSelectTriggerContext,
isValueClickTriggerContext,
EmbeddableStateTransfer,
- EmbeddableOriginatingAppState,
+ EmbeddableEditorState,
EmbeddablePackageState,
EmbeddableRenderer,
EmbeddableRendererProps,
diff --git a/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx b/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx
index 4b602efb02717..594a7ad73c396 100644
--- a/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx
+++ b/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx
@@ -59,7 +59,7 @@ test('redirects to app using state transfer', async () => {
const embeddable = new EditableEmbeddable({ id: '123', viewMode: ViewMode.EDIT }, true);
embeddable.getOutput = jest.fn(() => ({ editApp: 'ultraVisualize', editPath: '/123' }));
await action.execute({ embeddable });
- expect(stateTransferMock.navigateToWithOriginatingApp).toHaveBeenCalledWith('ultraVisualize', {
+ expect(stateTransferMock.navigateToEditor).toHaveBeenCalledWith('ultraVisualize', {
path: '/123',
state: { originatingApp: 'superCoolCurrentApp' },
});
diff --git a/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts b/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts
index d983dc9f41853..9177a77d547b0 100644
--- a/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts
+++ b/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts
@@ -24,7 +24,7 @@ import { take } from 'rxjs/operators';
import { ViewMode } from '../types';
import { EmbeddableFactoryNotFoundError } from '../errors';
import { EmbeddableStart } from '../../plugin';
-import { IEmbeddable, EmbeddableOriginatingAppState, EmbeddableStateTransfer } from '../..';
+import { IEmbeddable, EmbeddableEditorState, EmbeddableStateTransfer } from '../..';
export const ACTION_EDIT_PANEL = 'editPanel';
@@ -35,7 +35,7 @@ interface ActionContext {
interface NavigationContext {
app: string;
path: string;
- state?: EmbeddableOriginatingAppState;
+ state?: EmbeddableEditorState;
}
export class EditPanelAction implements Action {
@@ -88,7 +88,7 @@ export class EditPanelAction implements Action {
const appTarget = this.getAppTarget(context);
if (appTarget) {
if (this.stateTransfer && appTarget.state) {
- await this.stateTransfer.navigateToWithOriginatingApp(appTarget.app, {
+ await this.stateTransfer.navigateToEditor(appTarget.app, {
path: appTarget.path,
state: appTarget.state,
});
diff --git a/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx b/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx
index 9c544e86e189a..fcecf117d7d52 100644
--- a/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx
+++ b/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx
@@ -51,8 +51,7 @@ export abstract class Embeddable<
// to update input when the parent changes.
private parentSubscription?: Rx.Subscription;
- // TODO: Rename to destroyed.
- private destoyed: boolean = false;
+ private destroyed: boolean = false;
constructor(input: TEmbeddableInput, output: TEmbeddableOutput, parent?: IContainer) {
this.id = input.id;
@@ -123,7 +122,7 @@ export abstract class Embeddable<
}
public updateInput(changes: Partial): void {
- if (this.destoyed) {
+ if (this.destroyed) {
throw new Error('Embeddable has been destroyed');
}
if (this.parent) {
@@ -135,7 +134,7 @@ export abstract class Embeddable<
}
public render(domNode: HTMLElement | Element): void {
- if (this.destoyed) {
+ if (this.destroyed) {
throw new Error('Embeddable has been destroyed');
}
return;
@@ -155,7 +154,7 @@ export abstract class Embeddable<
* implementors to add any additional clean up tasks, like unmounting and unsubscribing.
*/
public destroy(): void {
- this.destoyed = true;
+ this.destroyed = true;
this.input$.complete();
this.output$.complete();
diff --git a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.test.ts b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.test.ts
index 0d5ae6be68185..b7dd95ccba32c 100644
--- a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.test.ts
+++ b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.test.ts
@@ -38,7 +38,7 @@ describe('embeddable state transfer', () => {
});
it('can send an outgoing originating app state', async () => {
- await stateTransfer.navigateToWithOriginatingApp(destinationApp, { state: { originatingApp } });
+ await stateTransfer.navigateToEditor(destinationApp, { state: { originatingApp } });
expect(application.navigateToApp).toHaveBeenCalledWith('superUltraVisualize', {
state: { originatingApp: 'superUltraTestDashboard' },
});
@@ -50,7 +50,7 @@ describe('embeddable state transfer', () => {
application.navigateToApp,
(historyMock as unknown) as ScopedHistory
);
- await stateTransfer.navigateToWithOriginatingApp(destinationApp, {
+ await stateTransfer.navigateToEditor(destinationApp, {
state: { originatingApp },
appendToExistingState: true,
});
@@ -94,7 +94,7 @@ describe('embeddable state transfer', () => {
application.navigateToApp,
(historyMock as unknown) as ScopedHistory
);
- const fetchedState = stateTransfer.getIncomingOriginatingApp();
+ const fetchedState = stateTransfer.getIncomingEditorState();
expect(fetchedState).toEqual({ originatingApp: 'extremeSportsKibana' });
});
@@ -104,7 +104,7 @@ describe('embeddable state transfer', () => {
application.navigateToApp,
(historyMock as unknown) as ScopedHistory
);
- const fetchedState = stateTransfer.getIncomingOriginatingApp();
+ const fetchedState = stateTransfer.getIncomingEditorState();
expect(fetchedState).toBeUndefined();
});
diff --git a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts
index 57b425d2df45c..8f70e5a66c478 100644
--- a/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts
+++ b/src/plugins/embeddable/public/lib/state_transfer/embeddable_state_transfer.ts
@@ -20,8 +20,8 @@
import { cloneDeep } from 'lodash';
import { ScopedHistory, ApplicationStart } from '../../../../../core/public';
import {
- EmbeddableOriginatingAppState,
- isEmbeddableOriginatingAppState,
+ EmbeddableEditorState,
+ isEmbeddableEditorState,
EmbeddablePackageState,
isEmbeddablePackageState,
} from './types';
@@ -39,16 +39,16 @@ export class EmbeddableStateTransfer {
) {}
/**
- * Fetches an {@link EmbeddableOriginatingAppState | originating app} argument from the scoped
+ * Fetches an {@link EmbeddableEditorState | originating app} argument from the scoped
* history's location state.
*
* @param history - the scoped history to fetch from
* @param options.keysToRemoveAfterFetch - an array of keys to be removed from the state after they are retrieved
*/
- public getIncomingOriginatingApp(options?: {
+ public getIncomingEditorState(options?: {
keysToRemoveAfterFetch?: string[];
- }): EmbeddableOriginatingAppState | undefined {
- return this.getIncomingState(isEmbeddableOriginatingAppState, {
+ }): EmbeddableEditorState | undefined {
+ return this.getIncomingState(isEmbeddableEditorState, {
keysToRemoveAfterFetch: options?.keysToRemoveAfterFetch,
});
}
@@ -70,17 +70,17 @@ export class EmbeddableStateTransfer {
/**
* A wrapper around the {@link ApplicationStart.navigateToApp} method which navigates to the specified appId
- * with {@link EmbeddableOriginatingAppState | originating app state}
+ * with {@link EmbeddableEditorState | embeddable editor state}
*/
- public async navigateToWithOriginatingApp(
+ public async navigateToEditor(
appId: string,
options?: {
path?: string;
- state: EmbeddableOriginatingAppState;
+ state: EmbeddableEditorState;
appendToExistingState?: boolean;
}
): Promise {
- await this.navigateToWithState(appId, options);
+ await this.navigateToWithState(appId, options);
}
/**
diff --git a/src/plugins/embeddable/public/lib/state_transfer/index.ts b/src/plugins/embeddable/public/lib/state_transfer/index.ts
index e51efc5dcca26..7daa7a0ea81d6 100644
--- a/src/plugins/embeddable/public/lib/state_transfer/index.ts
+++ b/src/plugins/embeddable/public/lib/state_transfer/index.ts
@@ -18,4 +18,4 @@
*/
export { EmbeddableStateTransfer } from './embeddable_state_transfer';
-export { EmbeddableOriginatingAppState, EmbeddablePackageState } from './types';
+export { EmbeddableEditorState, EmbeddablePackageState } from './types';
diff --git a/src/plugins/embeddable/public/lib/state_transfer/types.ts b/src/plugins/embeddable/public/lib/state_transfer/types.ts
index 8eae441d1be23..a6721784302ac 100644
--- a/src/plugins/embeddable/public/lib/state_transfer/types.ts
+++ b/src/plugins/embeddable/public/lib/state_transfer/types.ts
@@ -17,33 +17,49 @@
* under the License.
*/
+import { EmbeddableInput } from '..';
+
/**
* Represents a state package that contains the last active app id.
* @public
*/
-export interface EmbeddableOriginatingAppState {
+export interface EmbeddableEditorState {
originatingApp: string;
+ byValueMode?: boolean;
+ valueInput?: EmbeddableInput;
}
-export function isEmbeddableOriginatingAppState(
- state: unknown
-): state is EmbeddableOriginatingAppState {
+export function isEmbeddableEditorState(state: unknown): state is EmbeddableEditorState {
return ensureFieldOfTypeExists('originatingApp', state, 'string');
}
/**
- * Represents a state package that contains all fields necessary to create an embeddable in a container.
+ * Represents a state package that contains all fields necessary to create an embeddable by reference in a container.
* @public
*/
-export interface EmbeddablePackageState {
+export interface EmbeddablePackageByReferenceState {
type: string;
id: string;
}
+/**
+ * Represents a state package that contains all fields necessary to create an embeddable by value in a container.
+ * @public
+ */
+export interface EmbeddablePackageByValueState {
+ type: string;
+ input: EmbeddableInput;
+}
+
+export type EmbeddablePackageState =
+ | EmbeddablePackageByReferenceState
+ | EmbeddablePackageByValueState;
+
export function isEmbeddablePackageState(state: unknown): state is EmbeddablePackageState {
return (
- ensureFieldOfTypeExists('type', state, 'string') &&
- ensureFieldOfTypeExists('id', state, 'string')
+ (ensureFieldOfTypeExists('type', state, 'string') &&
+ ensureFieldOfTypeExists('id', state, 'string')) ||
+ ensureFieldOfTypeExists('input', state, 'object')
);
}
diff --git a/src/plugins/embeddable/public/lib/triggers/triggers.ts b/src/plugins/embeddable/public/lib/triggers/triggers.ts
index 2b447c89e2850..5bb96a708b7ac 100644
--- a/src/plugins/embeddable/public/lib/triggers/triggers.ts
+++ b/src/plugins/embeddable/public/lib/triggers/triggers.ts
@@ -39,10 +39,6 @@ export interface ValueClickTriggerContext {
};
}
-export const isValueClickTriggerContext = (
- context: ValueClickTriggerContext | RangeSelectTriggerContext
-): context is ValueClickTriggerContext => context.data && 'data' in context.data;
-
export interface RangeSelectTriggerContext {
embeddable?: T;
data: {
@@ -53,8 +49,16 @@ export interface RangeSelectTriggerContext
};
}
+export type ChartActionContext =
+ | ValueClickTriggerContext
+ | RangeSelectTriggerContext;
+
+export const isValueClickTriggerContext = (
+ context: ChartActionContext
+): context is ValueClickTriggerContext => context.data && 'data' in context.data;
+
export const isRangeSelectTriggerContext = (
- context: ValueClickTriggerContext | RangeSelectTriggerContext
+ context: ChartActionContext
): context is RangeSelectTriggerContext => context.data && 'range' in context.data;
export const CONTEXT_MENU_TRIGGER = 'CONTEXT_MENU_TRIGGER';
diff --git a/src/plugins/embeddable/public/mocks.tsx b/src/plugins/embeddable/public/mocks.tsx
index 49910525c7ab1..efd0ccdc4553d 100644
--- a/src/plugins/embeddable/public/mocks.tsx
+++ b/src/plugins/embeddable/public/mocks.tsx
@@ -31,6 +31,7 @@ import { coreMock } from '../../../core/public/mocks';
import { UiActionsService } from './lib/ui_actions';
import { CoreStart } from '../../../core/public';
import { Start as InspectorStart } from '../../inspector/public';
+import { dataPluginMock } from '../../data/public/mocks';
// eslint-disable-next-line
import { inspectorPluginMock } from '../../inspector/public/mocks';
@@ -78,9 +79,9 @@ export const createEmbeddablePanelMock = ({
export const createEmbeddableStateTransferMock = (): Partial => {
return {
- getIncomingOriginatingApp: jest.fn(),
+ getIncomingEditorState: jest.fn(),
getIncomingEmbeddablePackage: jest.fn(),
- navigateToWithOriginatingApp: jest.fn(),
+ navigateToEditor: jest.fn(),
navigateToWithEmbeddablePackage: jest.fn(),
};
};
@@ -100,6 +101,8 @@ const createStartContract = (): Start => {
EmbeddablePanel: jest.fn(),
getEmbeddablePanel: jest.fn(),
getStateTransfer: jest.fn(() => createEmbeddableStateTransferMock() as EmbeddableStateTransfer),
+ filtersAndTimeRangeFromContext: jest.fn(),
+ filtersFromContext: jest.fn(),
};
return startContract;
};
@@ -108,11 +111,13 @@ const createInstance = (setupPlugins: Partial = {})
const plugin = new EmbeddablePublicPlugin({} as any);
const setup = plugin.setup(coreMock.createSetup(), {
uiActions: setupPlugins.uiActions || uiActionsPluginMock.createSetupContract(),
+ data: dataPluginMock.createSetupContract(),
});
const doStart = (startPlugins: Partial = {}) =>
plugin.start(coreMock.createStart(), {
uiActions: startPlugins.uiActions || uiActionsPluginMock.createStartContract(),
inspector: inspectorPluginMock.createStartContract(),
+ data: dataPluginMock.createStartContract(),
});
return {
plugin,
diff --git a/src/plugins/embeddable/public/plugin.tsx b/src/plugins/embeddable/public/plugin.tsx
index c4e0ca44a4e7e..03bb4a4779267 100644
--- a/src/plugins/embeddable/public/plugin.tsx
+++ b/src/plugins/embeddable/public/plugin.tsx
@@ -17,6 +17,13 @@
* under the License.
*/
import React from 'react';
+import {
+ DataPublicPluginSetup,
+ DataPublicPluginStart,
+ Filter,
+ TimeRange,
+ esFilters,
+} from '../../data/public';
import { getSavedObjectFinder } from '../../saved_objects/public';
import { UiActionsSetup, UiActionsStart } from '../../ui_actions/public';
import { Start as InspectorStart } from '../../inspector/public';
@@ -36,15 +43,20 @@ import {
defaultEmbeddableFactoryProvider,
IEmbeddable,
EmbeddablePanel,
+ ChartActionContext,
+ isRangeSelectTriggerContext,
+ isValueClickTriggerContext,
} from './lib';
import { EmbeddableFactoryDefinition } from './lib/embeddables/embeddable_factory_definition';
import { EmbeddableStateTransfer } from './lib/state_transfer';
export interface EmbeddableSetupDependencies {
+ data: DataPublicPluginSetup;
uiActions: UiActionsSetup;
}
export interface EmbeddableStartDependencies {
+ data: DataPublicPluginStart;
uiActions: UiActionsStart;
inspector: InspectorStart;
}
@@ -70,6 +82,19 @@ export interface EmbeddableStart {
embeddableFactoryId: string
) => EmbeddableFactory | undefined;
getEmbeddableFactories: () => IterableIterator;
+
+ /**
+ * Given {@link ChartActionContext} returns a list of `data` plugin {@link Filter} entries.
+ */
+ filtersFromContext: (context: ChartActionContext) => Promise;
+
+ /**
+ * Returns possible time range and filters that can be constructed from {@link ChartActionContext} object.
+ */
+ filtersAndTimeRangeFromContext: (
+ context: ChartActionContext
+ ) => Promise<{ filters: Filter[]; timeRange?: TimeRange }>;
+
EmbeddablePanel: EmbeddablePanelHOC;
getEmbeddablePanel: (stateTransfer?: EmbeddableStateTransfer) => EmbeddablePanelHOC;
getStateTransfer: (history?: ScopedHistory) => EmbeddableStateTransfer;
@@ -107,7 +132,7 @@ export class EmbeddablePublicPlugin implements Plugin {
this.embeddableFactories.set(
@@ -121,6 +146,41 @@ export class EmbeddablePublicPlugin implements Plugin {
+ try {
+ if (isRangeSelectTriggerContext(context))
+ return await data.actions.createFiltersFromRangeSelectAction(context.data);
+ if (isValueClickTriggerContext(context))
+ return await data.actions.createFiltersFromValueClickAction(context.data);
+ // eslint-disable-next-line no-console
+ console.warn("Can't extract filters from action.", context);
+ } catch (error) {
+ // eslint-disable-next-line no-console
+ console.warn('Error extracting filters from action. Returning empty filter list.', error);
+ }
+ return [];
+ };
+
+ const filtersAndTimeRangeFromContext: EmbeddableStart['filtersAndTimeRangeFromContext'] = async (
+ context
+ ) => {
+ const filters = await filtersFromContext(context);
+
+ if (!context.data.timeFieldName) return { filters };
+
+ const { timeRangeFilter, restOfFilters } = esFilters.extractTimeFilter(
+ context.data.timeFieldName,
+ filters
+ );
+
+ return {
+ filters: restOfFilters,
+ timeRange: timeRangeFilter
+ ? esFilters.convertRangeFilterToTimeRangeString(timeRangeFilter)
+ : undefined,
+ };
+ };
+
const getEmbeddablePanelHoc = (stateTransfer?: EmbeddableStateTransfer) => ({
embeddable,
hideHeader,
@@ -146,6 +206,8 @@ export class EmbeddablePublicPlugin implements Plugin {
return history
? new EmbeddableStateTransfer(core.application.navigateToApp, history)
diff --git a/src/plugins/embeddable/public/tests/test_plugin.ts b/src/plugins/embeddable/public/tests/test_plugin.ts
index e13a906e30338..bb12e3d7b9011 100644
--- a/src/plugins/embeddable/public/tests/test_plugin.ts
+++ b/src/plugins/embeddable/public/tests/test_plugin.ts
@@ -23,6 +23,7 @@ import { UiActionsStart } from '../../../ui_actions/public';
import { uiActionsPluginMock } from '../../../ui_actions/public/mocks';
// eslint-disable-next-line
import { inspectorPluginMock } from '../../../inspector/public/mocks';
+import { dataPluginMock } from '../../../data/public/mocks';
import { coreMock } from '../../../../core/public/mocks';
import { EmbeddablePublicPlugin, EmbeddableSetup, EmbeddableStart } from '../plugin';
@@ -42,7 +43,10 @@ export const testPlugin = (
const uiActions = uiActionsPluginMock.createPlugin(coreSetup, coreStart);
const initializerContext = {} as any;
const plugin = new EmbeddablePublicPlugin(initializerContext);
- const setup = plugin.setup(coreSetup, { uiActions: uiActions.setup });
+ const setup = plugin.setup(coreSetup, {
+ data: dataPluginMock.createSetupContract(),
+ uiActions: uiActions.setup,
+ });
return {
plugin,
@@ -51,8 +55,9 @@ export const testPlugin = (
setup,
doStart: (anotherCoreStart: CoreStart = coreStart) => {
const start = plugin.start(anotherCoreStart, {
- uiActions: uiActionsPluginMock.createStartContract(),
+ data: dataPluginMock.createStartContract(),
inspector: inspectorPluginMock.createStartContract(),
+ uiActions: uiActionsPluginMock.createStartContract(),
});
return start;
},
diff --git a/src/plugins/kibana_usage_collection/server/__snapshots__/index.test.ts.snap b/src/plugins/kibana_usage_collection/server/__snapshots__/index.test.ts.snap
index 41c4c33b53c8d..f07912eff02b7 100644
--- a/src/plugins/kibana_usage_collection/server/__snapshots__/index.test.ts.snap
+++ b/src/plugins/kibana_usage_collection/server/__snapshots__/index.test.ts.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`kibana_usage_collection Runs the setup method without issues 1`] = `true`;
+exports[`kibana_usage_collection Runs the setup method without issues 1`] = `false`;
exports[`kibana_usage_collection Runs the setup method without issues 2`] = `true`;
diff --git a/src/plugins/kibana_usage_collection/server/index.test.ts b/src/plugins/kibana_usage_collection/server/index.test.ts
index c2680fef01caa..d4b065896c88c 100644
--- a/src/plugins/kibana_usage_collection/server/index.test.ts
+++ b/src/plugins/kibana_usage_collection/server/index.test.ts
@@ -17,7 +17,6 @@
* under the License.
*/
-import { BehaviorSubject } from 'rxjs';
import {
coreMock,
savedObjectsRepositoryMock,
@@ -47,30 +46,6 @@ describe('kibana_usage_collection', () => {
test('Runs the setup method without issues', () => {
const coreSetup = coreMock.createSetup();
- coreSetup.metrics.getOpsMetrics$.mockImplementation(
- () =>
- new BehaviorSubject({
- process: {
- memory: {
- heap: { total_in_bytes: 1, used_in_bytes: 1, size_limit: 1 },
- resident_set_size_in_bytes: 1,
- },
- event_loop_delay: 1,
- pid: 1,
- uptime_in_millis: 1,
- },
- os: {
- platform: 'darwin' as const,
- platformRelease: 'test',
- load: { '1m': 1, '5m': 1, '15m': 1 },
- memory: { total_in_bytes: 1, free_in_bytes: 1, used_in_bytes: 1 },
- uptime_in_millis: 1,
- },
- response_times: { avg_in_millis: 1, max_in_millis: 1 },
- requests: { disconnects: 1, total: 1, statusCodes: { '200': 1 } },
- concurrent_connections: 1,
- })
- );
expect(pluginInstance.setup(coreSetup, { usageCollection })).toBe(undefined);
usageCollectors.forEach(({ isReady }) => {
@@ -86,6 +61,7 @@ describe('kibana_usage_collection', () => {
coreStart.uiSettings.asScopedToClient.mockImplementation(() =>
uiSettingsServiceMock.createClient()
);
+
expect(pluginInstance.start(coreStart)).toBe(undefined);
usageCollectors.forEach(({ isReady }) => {
expect(isReady()).toBe(true); // All should return true at this point
diff --git a/src/plugins/kibana_usage_collection/server/plugin.ts b/src/plugins/kibana_usage_collection/server/plugin.ts
index 64d5367100236..803a9146bd08f 100644
--- a/src/plugins/kibana_usage_collection/server/plugin.ts
+++ b/src/plugins/kibana_usage_collection/server/plugin.ts
@@ -18,18 +18,18 @@
*/
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
-import { Observable } from 'rxjs';
+import { Subject, Observable } from 'rxjs';
import {
PluginInitializerContext,
CoreSetup,
Plugin,
- MetricsServiceSetup,
ISavedObjectsRepository,
IUiSettingsClient,
SharedGlobalConfig,
SavedObjectsClient,
CoreStart,
SavedObjectsServiceSetup,
+ OpsMetrics,
} from '../../../core/server';
import {
registerApplicationUsageCollector,
@@ -49,16 +49,18 @@ export class KibanaUsageCollectionPlugin implements Plugin {
private readonly legacyConfig$: Observable;
private savedObjectsClient?: ISavedObjectsRepository;
private uiSettingsClient?: IUiSettingsClient;
+ private metric$: Subject;
constructor(initializerContext: PluginInitializerContext) {
this.legacyConfig$ = initializerContext.config.legacy.globalConfig$;
+ this.metric$ = new Subject();
}
public setup(
- { savedObjects, metrics, getStartServices }: CoreSetup,
+ { savedObjects }: CoreSetup,
{ usageCollection }: KibanaUsageCollectionPluginsDepsSetup
) {
- this.registerUsageCollectors(usageCollection, metrics, (opts) =>
+ this.registerUsageCollectors(usageCollection, this.metric$, (opts) =>
savedObjects.registerType(opts)
);
}
@@ -68,19 +70,22 @@ export class KibanaUsageCollectionPlugin implements Plugin {
this.savedObjectsClient = savedObjects.createInternalRepository();
const savedObjectsClient = new SavedObjectsClient(this.savedObjectsClient);
this.uiSettingsClient = uiSettings.asScopedToClient(savedObjectsClient);
+ core.metrics.getOpsMetrics$().subscribe(this.metric$);
}
- public stop() {}
+ public stop() {
+ this.metric$.complete();
+ }
private registerUsageCollectors(
usageCollection: UsageCollectionSetup,
- metrics: MetricsServiceSetup,
+ metric$: Subject,
registerType: SavedObjectsRegisterType
) {
const getSavedObjectsClient = () => this.savedObjectsClient;
const getUiSettingsClient = () => this.uiSettingsClient;
- registerOpsStatsCollector(usageCollection, metrics.getOpsMetrics$());
+ registerOpsStatsCollector(usageCollection, metric$);
registerKibanaUsageCollector(usageCollection, this.legacyConfig$);
registerManagementUsageCollector(usageCollection, getUiSettingsClient);
registerUiMetricUsageCollector(usageCollection, registerType, getSavedObjectsClient);
diff --git a/src/plugins/kibana_utils/common/state_containers/common.api.md b/src/plugins/kibana_utils/common/state_containers/common.api.md
new file mode 100644
index 0000000000000..f85458499b719
--- /dev/null
+++ b/src/plugins/kibana_utils/common/state_containers/common.api.md
@@ -0,0 +1,156 @@
+## API Report File for "kibana"
+
+> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
+
+```ts
+
+import { ComponentType } from 'react';
+import { Ensure } from '@kbn/utility-types';
+import { FC } from 'react';
+import { Observable } from 'rxjs';
+import React from 'react';
+
+// @public
+export type BaseState = object;
+
+// @public
+export interface BaseStateContainer {
+ get: () => State;
+ set: (state: State) => void;
+ // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "Observable"
+ state$: Observable;
+}
+
+// @public
+export type Comparator = (previous: Result, current: Result) => boolean;
+
+// @public
+export type Connect = (mapStateToProp: MapStateToProps>) => (component: ComponentType) => FC>;
+
+// @public
+export function createStateContainer(defaultState: State): ReduxLikeStateContainer;
+
+// @public
+export function createStateContainer(defaultState: State, pureTransitions: PureTransitions): ReduxLikeStateContainer;
+
+// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "PureSelectors"
+//
+// @public
+export function createStateContainer(defaultState: State, pureTransitions: PureTransitions, pureSelectors: PureSelectors, options?: CreateStateContainerOptions): ReduxLikeStateContainer;
+
+// @public
+export interface CreateStateContainerOptions {
+ freeze?: (state: T) => T;
+}
+
+// @public
+export const createStateContainerReactHelpers: >() => {
+ Provider: React.Provider;
+ Consumer: React.Consumer;
+ context: React.Context;
+ useContainer: () => Container;
+ useState: () => UnboxState;
+ useTransitions: () => Container["transitions"];
+ useSelector: (selector: (state: UnboxState) => Result, comparator?: Comparator) => Result;
+ connect: Connect>;
+};
+
+// @public
+export type Dispatch = (action: T) => void;
+
+// @public (undocumented)
+export type EnsurePureSelector = Ensure>;
+
+// Warning: (ae-incompatible-release-tags) The symbol "EnsurePureTransition" is marked as @public, but its signature references "PureTransition" which is marked as @internal
+//
+// @public (undocumented)
+export type EnsurePureTransition = Ensure>;
+
+// @public
+export type MapStateToProps = (state: State) => StateProps;
+
+// Warning: (ae-incompatible-release-tags) The symbol "Middleware" is marked as @public, but its signature references "TransitionDescription" which is marked as @internal
+//
+// @public
+export type Middleware = (store: Pick, 'getState' | 'dispatch'>) => (next: (action: TransitionDescription) => TransitionDescription | any) => Dispatch;
+
+// @public (undocumented)
+export type PureSelector = (state: State) => Selector;
+
+// @public (undocumented)
+export type PureSelectorsToSelectors = {
+ [K in keyof T]: PureSelectorToSelector>;
+};
+
+// @public (undocumented)
+export type PureSelectorToSelector> = ReturnType>;
+
+// @internal (undocumented)
+export type PureTransition = (state: State) => Transition;
+
+// @internal (undocumented)
+export type PureTransitionsToTransitions = {
+ [K in keyof T]: PureTransitionToTransition>;
+};
+
+// @internal (undocumented)
+export type PureTransitionToTransition> = ReturnType;
+
+// Warning: (ae-incompatible-release-tags) The symbol "Reducer" is marked as @public, but its signature references "TransitionDescription" which is marked as @internal
+//
+// @public
+export type Reducer = (state: State, action: TransitionDescription) => State;
+
+// @public
+export interface ReduxLikeStateContainer extends StateContainer {
+ // (undocumented)
+ addMiddleware: (middleware: Middleware) => void;
+ // Warning: (ae-incompatible-release-tags) The symbol "dispatch" is marked as @public, but its signature references "TransitionDescription" which is marked as @internal
+ //
+ // (undocumented)
+ dispatch: (action: TransitionDescription) => void;
+ // (undocumented)
+ getState: () => State;
+ // (undocumented)
+ reducer: Reducer;
+ // (undocumented)
+ replaceReducer: (nextReducer: Reducer) => void;
+ // (undocumented)
+ subscribe: (listener: (state: State) => void) => () => void;
+}
+
+// @public (undocumented)
+export type Selector = (...args: Args) => Result;
+
+// @public
+export interface StateContainer extends BaseStateContainer {
+ // (undocumented)
+ selectors: Readonly>;
+ // Warning: (ae-incompatible-release-tags) The symbol "transitions" is marked as @public, but its signature references "PureTransitionsToTransitions" which is marked as @internal
+ //
+ // (undocumented)
+ transitions: Readonly>;
+}
+
+// @internal (undocumented)
+export type Transition = (...args: Args) => State;
+
+// @internal (undocumented)
+export interface TransitionDescription {
+ // (undocumented)
+ args: Args;
+ // (undocumented)
+ type: Type;
+}
+
+// @public
+export type UnboxState> = Container extends StateContainer ? T : never;
+
+// @public
+export const useContainerSelector: , Result>(container: Container, selector: (state: UnboxState) => Result, comparator?: Comparator) => Result;
+
+// @public
+export const useContainerState: >(container: Container) => UnboxState;
+
+
+```
diff --git a/src/plugins/kibana_utils/common/state_containers/create_state_container.ts b/src/plugins/kibana_utils/common/state_containers/create_state_container.ts
index 69e204a642f93..6bb6e66616c91 100644
--- a/src/plugins/kibana_utils/common/state_containers/create_state_container.ts
+++ b/src/plugins/kibana_utils/common/state_containers/create_state_container.ts
@@ -44,29 +44,57 @@ const defaultFreeze: (value: T) => T = isProduction
return value as T;
};
+/**
+ * State container options
+ * @public
+ */
export interface CreateStateContainerOptions {
/**
- * Function to use when freezing state. Supply identity function
+ * Function to use when freezing state. Supply identity function.
+ * If not provided, default `deepFreeze` is used.
*
+ * @example
+ * If you expect that your state will be mutated externally an you cannot
+ * prevent that
* ```ts
* {
* freeze: state => state,
* }
* ```
- *
- * if you expect that your state will be mutated externally an you cannot
- * prevent that.
*/
freeze?: (state: T) => T;
}
+/**
+ * Creates a state container without transitions and without selectors.
+ * @param defaultState - initial state
+ * @typeParam State - shape of state
+ * @public
+ */
export function createStateContainer(
defaultState: State
): ReduxLikeStateContainer;
+/**
+ * Creates a state container with transitions, but without selectors.
+ * @param defaultState - initial state
+ * @param pureTransitions - state transitions configuration object. Map of {@link PureTransition}.
+ * @typeParam State - shape of state
+ * @public
+ */
export function createStateContainer(
defaultState: State,
pureTransitions: PureTransitions
): ReduxLikeStateContainer;
+
+/**
+ * Creates a state container with transitions and selectors.
+ * @param defaultState - initial state
+ * @param pureTransitions - state transitions configuration object. Map of {@link PureTransition}.
+ * @param pureSelectors - state selectors configuration object. Map of {@link PureSelectors}.
+ * @param options - state container options {@link CreateStateContainerOptions}
+ * @typeParam State - shape of state
+ * @public
+ */
export function createStateContainer<
State extends BaseState,
PureTransitions extends object,
@@ -77,14 +105,17 @@ export function createStateContainer<
pureSelectors: PureSelectors,
options?: CreateStateContainerOptions
): ReduxLikeStateContainer;
+/**
+ * @internal
+ */
export function createStateContainer<
State extends BaseState,
PureTransitions extends object,
PureSelectors extends object
>(
defaultState: State,
- pureTransitions: PureTransitions = {} as PureTransitions,
- pureSelectors: PureSelectors = {} as PureSelectors,
+ pureTransitions: PureTransitions = {} as PureTransitions, // TODO: https://github.com/elastic/kibana/issues/54439
+ pureSelectors: PureSelectors = {} as PureSelectors, // TODO: https://github.com/elastic/kibana/issues/54439
options: CreateStateContainerOptions = {}
): ReduxLikeStateContainer {
const { freeze = defaultFreeze } = options;
diff --git a/src/plugins/kibana_utils/common/state_containers/create_state_container_react_helpers.ts b/src/plugins/kibana_utils/common/state_containers/create_state_container_react_helpers.ts
index 8536f97e00ed0..4712c2fc233f8 100644
--- a/src/plugins/kibana_utils/common/state_containers/create_state_container_react_helpers.ts
+++ b/src/plugins/kibana_utils/common/state_containers/create_state_container_react_helpers.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import * as React from 'react';
+import React from 'react';
import useObservable from 'react-use/lib/useObservable';
import defaultComparator from 'fast-deep-equal';
import { Comparator, Connect, StateContainer, UnboxState } from './types';
@@ -25,23 +25,27 @@ import { Comparator, Connect, StateContainer, UnboxState } from './types';
const { useContext, useLayoutEffect, useRef, createElement: h } = React;
/**
- * Returns the latest state of a state container.
+ * React hooks that returns the latest state of a {@link StateContainer}.
*
- * @param container State container which state to track.
+ * @param container - {@link StateContainer} which state to track.
+ * @returns - latest {@link StateContainer} state
+ * @public
*/
export const useContainerState = >(
container: Container
): UnboxState => useObservable(container.state$, container.get());
/**
- * Apply selector to state container to extract only needed information. Will
+ * React hook to apply selector to state container to extract only needed information. Will
* re-render your component only when the section changes.
*
- * @param container State container which state to track.
- * @param selector Function used to pick parts of state.
- * @param comparator Comparator function used to memoize previous result, to not
+ * @param container - {@link StateContainer} which state to track.
+ * @param selector - Function used to pick parts of state.
+ * @param comparator - {@link Comparator} function used to memoize previous result, to not
* re-render React component if state did not change. By default uses
* `fast-deep-equal` package.
+ * @returns - result of a selector(state)
+ * @public
*/
export const useContainerSelector = , Result>(
container: Container,
@@ -68,6 +72,11 @@ export const useContainerSelector = ,
return value;
};
+/**
+ * Creates helpers for using {@link StateContainer | State Containers} with react
+ * Refer to {@link https://github.com/elastic/kibana/blob/master/src/plugins/kibana_utils/docs/state_containers/react.md | guide} for details
+ * @public
+ */
export const createStateContainerReactHelpers = >() => {
const context = React.createContext(null as any);
diff --git a/src/plugins/kibana_utils/common/state_containers/index.ts b/src/plugins/kibana_utils/common/state_containers/index.ts
index 43e204ecb79f7..e2e056bd67da2 100644
--- a/src/plugins/kibana_utils/common/state_containers/index.ts
+++ b/src/plugins/kibana_utils/common/state_containers/index.ts
@@ -17,6 +17,40 @@
* under the License.
*/
-export * from './types';
-export * from './create_state_container';
-export * from './create_state_container_react_helpers';
+/**
+ * State containers are Redux-store-like objects meant to help you manage state in your services or apps.
+ * Refer to {@link https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_containers | guides and examples} for more info
+ *
+ * @packageDocumentation
+ */
+
+export {
+ BaseState,
+ BaseStateContainer,
+ TransitionDescription,
+ StateContainer,
+ ReduxLikeStateContainer,
+ Dispatch,
+ Middleware,
+ Selector,
+ Comparator,
+ MapStateToProps,
+ Connect,
+ Reducer,
+ UnboxState,
+ PureSelectorToSelector,
+ PureSelectorsToSelectors,
+ EnsurePureSelector,
+ PureTransitionsToTransitions,
+ PureTransitionToTransition,
+ EnsurePureTransition,
+ PureSelector,
+ PureTransition,
+ Transition,
+} from './types';
+export { createStateContainer, CreateStateContainerOptions } from './create_state_container';
+export {
+ createStateContainerReactHelpers,
+ useContainerSelector,
+ useContainerState,
+} from './create_state_container_react_helpers';
diff --git a/src/plugins/kibana_utils/common/state_containers/types.ts b/src/plugins/kibana_utils/common/state_containers/types.ts
index 29ffa4cd486b5..b6adb89d9be7b 100644
--- a/src/plugins/kibana_utils/common/state_containers/types.ts
+++ b/src/plugins/kibana_utils/common/state_containers/types.ts
@@ -19,28 +19,76 @@
import { Observable } from 'rxjs';
import { Ensure } from '@kbn/utility-types';
+import { FC, ComponentType } from 'react';
+/**
+ * Base {@link StateContainer} state shape
+ * @public
+ */
export type BaseState = object;
+
+/**
+ * @internal
+ */
export interface TransitionDescription {
type: Type;
args: Args;
}
+/**
+ * @internal
+ */
export type Transition = (...args: Args) => State;
+/**
+ * @internal
+ */
export type PureTransition = (
state: State
) => Transition;
+/**
+ * @public
+ */
export type EnsurePureTransition = Ensure>;
+/**
+ * @internal
+ */
export type PureTransitionToTransition> = ReturnType;
+/**
+ * @internal
+ */
export type PureTransitionsToTransitions = {
[K in keyof T]: PureTransitionToTransition>;
};
+/**
+ * Base state container shape without transitions or selectors
+ * @typeParam State - Shape of state in the container. Have to match {@link BaseState} constraint
+ * @public
+ */
export interface BaseStateContainer {
+ /**
+ * Retrieves current state from the container
+ * @returns current state
+ * @public
+ */
get: () => State;
+ /**
+ * Sets state into container
+ * @param state - new state to set
+ */
set: (state: State) => void;
+ /**
+ * {@link Observable} of state
+ */
state$: Observable;
}
+/**
+ * Fully featured state container with {@link Selector | Selectors} and {@link Transition | Transitions}. Extends {@link BaseStateContainer}.
+ * @typeParam State - Shape of state in the container. Has to match {@link BaseState} constraint
+ * @typeParam PureTransitions - map of {@link PureTransition | transitions} to provide on state container
+ * @typeParam PureSelectors - map of {@link PureSelector | selectors} to provide on state container
+ * @public
+ */
export interface StateContainer<
State extends BaseState,
PureTransitions extends object = object,
@@ -50,6 +98,11 @@ export interface StateContainer<
selectors: Readonly>;
}
+/**
+ * Fully featured state container which matches Redux store interface. Extends {@link StateContainer}.
+ * Allows to use state container with redux libraries.
+ * @public
+ */
export interface ReduxLikeStateContainer<
State extends BaseState,
PureTransitions extends object = {},
@@ -63,45 +116,92 @@ export interface ReduxLikeStateContainer<
subscribe: (listener: (state: State) => void) => () => void;
}
+/**
+ * Redux like dispatch
+ * @public
+ */
export type Dispatch = (action: T) => void;
+/**
+ * Redux like Middleware
+ * @public
+ */
export type Middleware = (
store: Pick, 'getState' | 'dispatch'>
) => (
next: (action: TransitionDescription) => TransitionDescription | any
) => Dispatch;
-
+/**
+ * Redux like Reducer
+ * @public
+ */
export type Reducer = (
state: State,
action: TransitionDescription
) => State;
+/**
+ * Utility type for inferring state shape from {@link StateContainer}
+ * @public
+ */
export type UnboxState<
Container extends StateContainer
> = Container extends StateContainer ? T : never;
+/**
+ * Utility type for inferring transitions type from {@link StateContainer}
+ * @public
+ */
export type UnboxTransitions<
Container extends StateContainer
> = Container extends StateContainer ? T : never;
+/**
+ * @public
+ */
export type Selector = (...args: Args) => Result;
+/**
+ * @public
+ */
export type PureSelector = (
state: State
) => Selector;
+/**
+ * @public
+ */
export type EnsurePureSelector = Ensure>;
+/**
+ * @public
+ */
export type PureSelectorToSelector> = ReturnType<
EnsurePureSelector
>;
+/**
+ * @public
+ */
export type PureSelectorsToSelectors = {
[K in keyof T]: PureSelectorToSelector>;
};
+/**
+ * Used to compare state, see {@link useContainerSelector}.
+ * @public
+ */
export type Comparator = (previous: Result, current: Result) => boolean;
-
+/**
+ * State container state to component props mapper.
+ * See {@link Connect}
+ * @public
+ */
export type MapStateToProps = (
state: State
) => StateProps;
+/**
+ * Similar to `connect` from react-redux,
+ * allows to map state from state container to component's props.
+ * @public
+ */
export type Connect = <
Props extends object,
StatePropKeys extends keyof Props
>(
mapStateToProp: MapStateToProps>
-) => (component: React.ComponentType) => React.FC>;
+) => (component: ComponentType) => FC>;
diff --git a/src/plugins/kibana_utils/public/state_sync/index.ts b/src/plugins/kibana_utils/public/state_sync/index.ts
index 1dfa998c5bb9d..da60b36255367 100644
--- a/src/plugins/kibana_utils/public/state_sync/index.ts
+++ b/src/plugins/kibana_utils/public/state_sync/index.ts
@@ -17,11 +17,32 @@
* under the License.
*/
+/**
+ * State syncing utilities are a set of helpers for syncing your application state
+ * with browser URL or browser storage.
+ *
+ * They are designed to work together with {@link https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_containers | state containers}. But state containers are not required.
+ *
+ * State syncing utilities include:
+ *
+ * *{@link syncState} util which:
+ * * Subscribes to state changes and pushes them to state storage.
+ * * Optionally subscribes to state storage changes and pushes them to state.
+ * * Two types of storages compatible with `syncState`:
+ * * {@link IKbnUrlStateStorage} - Serializes state and persists it to URL's query param in rison or hashed format.
+ * Listens for state updates in the URL and pushes them back to state.
+ * * {@link ISessionStorageStateStorage} - Serializes state and persists it to browser storage.
+ *
+ * Refer {@link https://github.com/elastic/kibana/tree/master/src/plugins/kibana_utils/docs/state_sync | here} for a complete guide and examples.
+ * @packageDocumentation
+ */
+
export {
createSessionStorageStateStorage,
createKbnUrlStateStorage,
IKbnUrlStateStorage,
ISessionStorageStateStorage,
+ IStateStorage,
} from './state_sync_state_storage';
export { IStateSyncConfig, INullableBaseStateContainer } from './types';
export {
diff --git a/src/plugins/kibana_utils/public/state_sync/public.api.md b/src/plugins/kibana_utils/public/state_sync/public.api.md
new file mode 100644
index 0000000000000..c174ba798d01a
--- /dev/null
+++ b/src/plugins/kibana_utils/public/state_sync/public.api.md
@@ -0,0 +1,97 @@
+## API Report File for "kibana"
+
+> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
+
+```ts
+
+import { History } from 'history';
+import { Observable } from 'rxjs';
+
+// @public
+export const createKbnUrlStateStorage: ({ useHash, history }?: {
+ useHash: boolean;
+ history?: History | undefined;
+}) => IKbnUrlStateStorage;
+
+// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "Storage"
+//
+// @public
+export const createSessionStorageStateStorage: (storage?: Storage) => ISessionStorageStateStorage;
+
+// @public
+export interface IKbnUrlStateStorage extends IStateStorage {
+ cancel: () => void;
+ // (undocumented)
+ change$: