(event: any) => void
| |
| [onDestroy](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.ondestroy.md) | (fn: () => void) => void
| |
| [reload](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.reload.md) | () => void
| |
+| [uiState](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.uistate.md) | PersistedState
| |
| [update](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.update.md) | (params: any) => void
| |
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.uistate.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.uistate.md
new file mode 100644
index 0000000000000..8d74c8e555fee
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.uistate.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [IInterpreterRenderHandlers](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.md) > [uiState](./kibana-plugin-plugins-expressions-public.iinterpreterrenderhandlers.uistate.md)
+
+## IInterpreterRenderHandlers.uiState property
+
+Signature:
+
+```typescript
+uiState?: PersistedState;
+```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.md
index cbaffa04bae8f..ccf6271f712b9 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.md
@@ -18,5 +18,6 @@ export interface IInterpreterRenderHandlers
| [event](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.event.md) | (event: any) => void
| |
| [onDestroy](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.ondestroy.md) | (fn: () => void) => void
| |
| [reload](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.reload.md) | () => void
| |
+| [uiState](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.uistate.md) | PersistedState
| |
| [update](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.update.md) | (params: any) => void
| |
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.uistate.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.uistate.md
new file mode 100644
index 0000000000000..b09433c6454ad
--- /dev/null
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.uistate.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [IInterpreterRenderHandlers](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.md) > [uiState](./kibana-plugin-plugins-expressions-server.iinterpreterrenderhandlers.uistate.md)
+
+## IInterpreterRenderHandlers.uiState property
+
+Signature:
+
+```typescript
+uiState?: PersistedState;
+```
diff --git a/src/plugins/expressions/common/expression_renderers/types.ts b/src/plugins/expressions/common/expression_renderers/types.ts
index b760e7b32a7d2..0ea3d72e75609 100644
--- a/src/plugins/expressions/common/expression_renderers/types.ts
+++ b/src/plugins/expressions/common/expression_renderers/types.ts
@@ -17,6 +17,8 @@
* under the License.
*/
+import { PersistedState } from 'src/plugins/visualizations/public';
+
export interface ExpressionRenderDefinition
+
+
+ Input
+
+
+ |
+
+
+
+ Output
+
+
+ |
+
---|---|
+
+ Input
+
+
+ john
+
+ |
+
+
+ Output
+
+
+
+
+ converted url for john
+
+ |
+
+
+ Input
+
+
+ /some/pathname/asset.png
+
+ |
+
+
+ Output
+
+
+
+
+ converted url for /some/pathname/asset.png
+
+ |
+
+
+ Input
+
+
+ 1234
+
+ |
+
+
+ Output
+
+
+
+
+ converted url for 1234
+
+ |
+
string
| |
+| showSaveModal | (saveModal: React.ReactElement, I18nContext: I18nStart['Context']) => void
| |
+| i18nContext | I18nStart['Context']
| |
+| toasts | NotificationsStart['toasts']
| |
+| options | AttributeServiceOptions<SavedObjectAttributes>
| |
+| getEmbeddableFactory | (embeddableFactoryId: string) => EmbeddableFactory
| |
+
diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md
new file mode 100644
index 0000000000000..e3f27723e1a70
--- /dev/null
+++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) > [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) > [getExplicitInputFromEmbeddable](./kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md)
+
+## AttributeService.getExplicitInputFromEmbeddable() method
+
+Signature:
+
+```typescript
+getExplicitInputFromEmbeddable(embeddable: IEmbeddable): ValType | RefType;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| embeddable | IEmbeddable
| |
+
+Returns:
+
+`ValType | RefType`
+
diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md
new file mode 100644
index 0000000000000..7908327c594d8
--- /dev/null
+++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md
@@ -0,0 +1,16 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) > [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) > [getInputAsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md)
+
+## AttributeService.getInputAsRefType property
+
+Signature:
+
+```typescript
+getInputAsRefType: (input: ValType | RefType, saveOptions?: {
+ showSaveModal: boolean;
+ saveModalTitle?: string | undefined;
+ } | {
+ title: string;
+ } | undefined) => PromiseAttributeService
class |
+
+## Properties
+
+| Property | Modifiers | Type | Description |
+| --- | --- | --- | --- |
+| [getInputAsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasreftype.md) | | (input: ValType | RefType, saveOptions?: {
showSaveModal: boolean;
saveModalTitle?: string | undefined;
} | {
title: string;
} | undefined) => Promise<RefType>
| |
+| [getInputAsValueType](./kibana-plugin-plugins-embeddable-public.attributeservice.getinputasvaluetype.md) | | (input: ValType | RefType) => Promise<ValType>
| |
+| [inputIsRefType](./kibana-plugin-plugins-embeddable-public.attributeservice.inputisreftype.md) | | (input: ValType | RefType) => input is RefType
| |
+
+## Methods
+
+| Method | Modifiers | Description |
+| --- | --- | --- |
+| [getExplicitInputFromEmbeddable(embeddable)](./kibana-plugin-plugins-embeddable-public.attributeservice.getexplicitinputfromembeddable.md) | | |
+| [unwrapAttributes(input)](./kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md) | | |
+| [wrapAttributes(newAttributes, useRefType, input)](./kibana-plugin-plugins-embeddable-public.attributeservice.wrapattributes.md) | | |
+
diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md
new file mode 100644
index 0000000000000..f08736a2240a3
--- /dev/null
+++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md
@@ -0,0 +1,22 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-embeddable-public](./kibana-plugin-plugins-embeddable-public.md) > [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) > [unwrapAttributes](./kibana-plugin-plugins-embeddable-public.attributeservice.unwrapattributes.md)
+
+## AttributeService.unwrapAttributes() method
+
+Signature:
+
+```typescript
+unwrapAttributes(input: RefType | ValType): PromiseRefType | ValType
| |
+
+Returns:
+
+`PromiseSavedObjectAttributes
| |
+| useRefType | boolean
| |
+| input | ValType | RefType
| |
+
+Returns:
+
+`PromiseEmbeddablePanelHOC
| |
+| [getAttributeService](./kibana-plugin-plugins-embeddable-public.embeddablestart.getattributeservice.md) | <A extends {
title: string;
}, V extends EmbeddableInput & {
[ATTRIBUTE_SERVICE_KEY]: A;
} = EmbeddableInput & {
[ATTRIBUTE_SERVICE_KEY]: A;
}, R extends SavedObjectEmbeddableInput = SavedObjectEmbeddableInput>(type: string, options: AttributeServiceOptions<A>) => AttributeService<A, V, R>
| |
| [getEmbeddableFactories](./kibana-plugin-plugins-embeddable-public.embeddablestart.getembeddablefactories.md) | () => IterableIterator<EmbeddableFactory>
| |
| [getEmbeddableFactory](./kibana-plugin-plugins-embeddable-public.embeddablestart.getembeddablefactory.md) | <I extends EmbeddableInput = EmbeddableInput, O extends EmbeddableOutput = EmbeddableOutput, E extends IEmbeddable<I, O> = IEmbeddable<I, O>>(embeddableFactoryId: string) => EmbeddableFactory<I, O, E> | undefined
| |
| [getEmbeddablePanel](./kibana-plugin-plugins-embeddable-public.embeddablestart.getembeddablepanel.md) | (stateTransfer?: EmbeddableStateTransfer) => EmbeddablePanelHOC
| |
diff --git a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.md b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.md
index 64dfdd1c6dc22..df67eda5074b9 100644
--- a/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.md
+++ b/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.md
@@ -9,6 +9,7 @@
| Class | Description |
| --- | --- |
| [AddPanelAction](./kibana-plugin-plugins-embeddable-public.addpanelaction.md) | |
+| [AttributeService](./kibana-plugin-plugins-embeddable-public.attributeservice.md) | |
| [Container](./kibana-plugin-plugins-embeddable-public.container.md) | |
| [EditPanelAction](./kibana-plugin-plugins-embeddable-public.editpanelaction.md) | |
| [Embeddable](./kibana-plugin-plugins-embeddable-public.embeddable.md) | |
@@ -71,6 +72,7 @@
| --- | --- |
| [ACTION\_ADD\_PANEL](./kibana-plugin-plugins-embeddable-public.action_add_panel.md) | |
| [ACTION\_EDIT\_PANEL](./kibana-plugin-plugins-embeddable-public.action_edit_panel.md) | |
+| [ATTRIBUTE\_SERVICE\_KEY](./kibana-plugin-plugins-embeddable-public.attribute_service_key.md) | The attribute service is a shared, generic service that embeddables can use to provide the functionality required to fulfill the requirements of the ReferenceOrValueEmbeddable interface. The attribute\_service can also be used as a higher level wrapper to transform an embeddable input shape that references a saved object into an embeddable input shape that contains that saved object's attributes by value. |
| [CONTEXT\_MENU\_TRIGGER](./kibana-plugin-plugins-embeddable-public.context_menu_trigger.md) | |
| [contextMenuTrigger](./kibana-plugin-plugins-embeddable-public.contextmenutrigger.md) | |
| [defaultEmbeddableFactoryProvider](./kibana-plugin-plugins-embeddable-public.defaultembeddablefactoryprovider.md) | |
diff --git a/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.getattributeservice.md b/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.getattributeservice.md
new file mode 100644
index 0000000000000..9cd77ca6e3a36
--- /dev/null
+++ b/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.getattributeservice.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-embeddable-server](./kibana-plugin-plugins-embeddable-server.md) > [EmbeddableSetup](./kibana-plugin-plugins-embeddable-server.embeddablesetup.md) > [getAttributeService](./kibana-plugin-plugins-embeddable-server.embeddablesetup.getattributeservice.md)
+
+## EmbeddableSetup.getAttributeService property
+
+Signature:
+
+```typescript
+getAttributeService: any;
+```
diff --git a/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md b/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md
index 59ca4a2bbca75..bd024095e80be 100644
--- a/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md
+++ b/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md
@@ -14,6 +14,7 @@ export interface EmbeddableSetup
| Property | Type | Description |
| --- | --- | --- |
+| [getAttributeService](./kibana-plugin-plugins-embeddable-server.embeddablesetup.getattributeservice.md) | any
| |
| [registerEmbeddableFactory](./kibana-plugin-plugins-embeddable-server.embeddablesetup.registerembeddablefactory.md) | (factory: EmbeddableRegistryDefinition) => void
| |
| [registerEnhancement](./kibana-plugin-plugins-embeddable-server.embeddablesetup.registerenhancement.md) | (enhancement: EnhancementRegistryDefinition) => void
| |
diff --git a/examples/embeddable_examples/kibana.json b/examples/embeddable_examples/kibana.json
index 223b8c55a5fde..6025d24665901 100644
--- a/examples/embeddable_examples/kibana.json
+++ b/examples/embeddable_examples/kibana.json
@@ -4,7 +4,7 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
- "requiredPlugins": ["embeddable", "uiActions", "dashboard", "savedObjects"],
+ "requiredPlugins": ["embeddable", "uiActions", "savedObjects", "dashboard"],
"optionalPlugins": [],
"extraPublicDirs": ["public/todo", "public/hello_world", "public/todo/todo_ref_embeddable"],
"requiredBundles": ["kibanaReact"]
diff --git a/examples/embeddable_examples/public/book/book_embeddable.tsx b/examples/embeddable_examples/public/book/book_embeddable.tsx
index 65ec22a2759e2..8d633a892ec6d 100644
--- a/examples/embeddable_examples/public/book/book_embeddable.tsx
+++ b/examples/embeddable_examples/public/book/book_embeddable.tsx
@@ -26,10 +26,10 @@ import {
EmbeddableOutput,
SavedObjectEmbeddableInput,
ReferenceOrValueEmbeddable,
+ AttributeService,
} from '../../../../src/plugins/embeddable/public';
import { BookSavedObjectAttributes } from '../../common';
import { BookEmbeddableComponent } from './book_component';
-import { AttributeService } from '../../../../src/plugins/dashboard/public';
export const BOOK_EMBEDDABLE = 'book';
export type BookEmbeddableInput = BookByValueInput | BookByReferenceInput;
diff --git a/examples/embeddable_examples/public/book/book_embeddable_factory.tsx b/examples/embeddable_examples/public/book/book_embeddable_factory.tsx
index a535552282150..f569e2e8d154d 100644
--- a/examples/embeddable_examples/public/book/book_embeddable_factory.tsx
+++ b/examples/embeddable_examples/public/book/book_embeddable_factory.tsx
@@ -25,6 +25,8 @@ import {
EmbeddableFactoryDefinition,
IContainer,
EmbeddableFactory,
+ EmbeddableStart,
+ AttributeService,
} from '../../../../src/plugins/embeddable/public';
import {
BookEmbeddable,
@@ -38,11 +40,10 @@ import {
SavedObjectsClientContract,
SimpleSavedObject,
} from '../../../../src/core/public';
-import { DashboardStart, AttributeService } from '../../../../src/plugins/dashboard/public';
import { checkForDuplicateTitle, OnSaveProps } from '../../../../src/plugins/saved_objects/public';
interface StartServices {
- getAttributeService: DashboardStart['getAttributeService'];
+ getAttributeService: EmbeddableStart['getAttributeService'];
openModal: OverlayStart['openModal'];
savedObjectsClient: SavedObjectsClientContract;
overlays: OverlayStart;
diff --git a/examples/embeddable_examples/public/book/edit_book_action.tsx b/examples/embeddable_examples/public/book/edit_book_action.tsx
index 77035b6887734..e2133a8d51ea2 100644
--- a/examples/embeddable_examples/public/book/edit_book_action.tsx
+++ b/examples/embeddable_examples/public/book/edit_book_action.tsx
@@ -22,7 +22,11 @@ import { i18n } from '@kbn/i18n';
import { BookSavedObjectAttributes, BOOK_SAVED_OBJECT } from '../../common';
import { createAction } from '../../../../src/plugins/ui_actions/public';
import { toMountPoint } from '../../../../src/plugins/kibana_react/public';
-import { ViewMode, SavedObjectEmbeddableInput } from '../../../../src/plugins/embeddable/public';
+import {
+ ViewMode,
+ SavedObjectEmbeddableInput,
+ EmbeddableStart,
+} from '../../../../src/plugins/embeddable/public';
import {
BookEmbeddable,
BOOK_EMBEDDABLE,
@@ -30,13 +34,12 @@ import {
BookByValueInput,
} from './book_embeddable';
import { CreateEditBookComponent } from './create_edit_book_component';
-import { DashboardStart } from '../../../../src/plugins/dashboard/public';
import { OnSaveProps } from '../../../../src/plugins/saved_objects/public';
import { SavedObjectsClientContract } from '../../../../src/core/target/types/public/saved_objects';
interface StartServices {
openModal: OverlayStart['openModal'];
- getAttributeService: DashboardStart['getAttributeService'];
+ getAttributeService: EmbeddableStart['getAttributeService'];
savedObjectsClient: SavedObjectsClientContract;
}
diff --git a/examples/embeddable_examples/public/plugin.ts b/examples/embeddable_examples/public/plugin.ts
index 6d1b119e741bd..9b9770e40611e 100644
--- a/examples/embeddable_examples/public/plugin.ts
+++ b/examples/embeddable_examples/public/plugin.ts
@@ -62,7 +62,6 @@ import {
ACTION_ADD_BOOK_TO_LIBRARY,
createAddBookToLibraryAction,
} from './book/add_book_to_library_action';
-import { DashboardStart } from '../../../src/plugins/dashboard/public';
import {
ACTION_UNLINK_BOOK_FROM_LIBRARY,
createUnlinkBookFromLibraryAction,
@@ -75,7 +74,6 @@ export interface EmbeddableExamplesSetupDependencies {
export interface EmbeddableExamplesStartDependencies {
embeddable: EmbeddableStart;
- dashboard: DashboardStart;
savedObjectsClient: SavedObjectsClient;
}
@@ -157,7 +155,7 @@ export class EmbeddableExamplesPlugin
this.exampleEmbeddableFactories.getBookEmbeddableFactory = deps.embeddable.registerEmbeddableFactory(
BOOK_EMBEDDABLE,
new BookEmbeddableFactoryDefinition(async () => ({
- getAttributeService: (await core.getStartServices())[1].dashboard.getAttributeService,
+ getAttributeService: (await core.getStartServices())[1].embeddable.getAttributeService,
openModal: (await core.getStartServices())[0].overlays.openModal,
savedObjectsClient: (await core.getStartServices())[0].savedObjects.client,
overlays: (await core.getStartServices())[0].overlays,
@@ -165,7 +163,7 @@ export class EmbeddableExamplesPlugin
);
const editBookAction = createEditBookAction(async () => ({
- getAttributeService: (await core.getStartServices())[1].dashboard.getAttributeService,
+ getAttributeService: (await core.getStartServices())[1].embeddable.getAttributeService,
openModal: (await core.getStartServices())[0].overlays.openModal,
savedObjectsClient: (await core.getStartServices())[0].savedObjects.client,
}));
diff --git a/src/plugins/dashboard/public/index.ts b/src/plugins/dashboard/public/index.ts
index bf9a3b2b8a217..004b1a901bca9 100644
--- a/src/plugins/dashboard/public/index.ts
+++ b/src/plugins/dashboard/public/index.ts
@@ -45,7 +45,6 @@ export {
export { addEmbeddableToDashboardUrl } from './url_utils/url_helper';
export { SavedObjectDashboard } from './saved_dashboards';
export { SavedDashboardPanel } from './types';
-export { AttributeService, ATTRIBUTE_SERVICE_KEY } from './attribute_service';
export function plugin(initializerContext: PluginInitializerContext) {
return new DashboardPlugin(initializerContext);
diff --git a/src/plugins/dashboard/public/mocks.tsx b/src/plugins/dashboard/public/mocks.tsx
index 07f29eca53042..be7460f3110a5 100644
--- a/src/plugins/dashboard/public/mocks.tsx
+++ b/src/plugins/dashboard/public/mocks.tsx
@@ -20,13 +20,10 @@
import { DashboardStart } from './plugin';
export type Start = jest.Mocked void;
// (undocumented)
diff --git a/src/plugins/visualizations/kibana.json b/src/plugins/visualizations/kibana.json
index bf36bb35d0563..688987b1104a1 100644
--- a/src/plugins/visualizations/kibana.json
+++ b/src/plugins/visualizations/kibana.json
@@ -3,7 +3,7 @@
"version": "kibana",
"server": true,
"ui": true,
- "requiredPlugins": ["data", "expressions", "uiActions", "embeddable", "inspector", "dashboard"],
+ "requiredPlugins": ["data", "expressions", "uiActions", "embeddable", "inspector" ],
"optionalPlugins": ["usageCollection"],
"requiredBundles": ["kibanaUtils", "discover", "savedObjects"]
}
diff --git a/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts b/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts
index b27d24d980e8d..36f3f7d6ed22e 100644
--- a/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts
+++ b/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts
@@ -25,7 +25,11 @@ import {
VisualizeByReferenceInput,
VisualizeSavedObjectAttributes,
} from './visualize_embeddable';
-import { IContainer, ErrorEmbeddable } from '../../../../plugins/embeddable/public';
+import {
+ IContainer,
+ ErrorEmbeddable,
+ AttributeService,
+} from '../../../../plugins/embeddable/public';
import { DisabledLabEmbeddable } from './disabled_lab_embeddable';
import {
getSavedVisualizationsLoader,
@@ -37,7 +41,6 @@ import {
import { VisualizeEmbeddableFactoryDeps } from './visualize_embeddable_factory';
import { VISUALIZE_ENABLE_LABS_SETTING } from '../../common/constants';
import { SavedVisualizationsLoader } from '../saved_visualizations';
-import { AttributeService } from '../../../dashboard/public';
export const createVisEmbeddableFromObject = (deps: VisualizeEmbeddableFactoryDeps) => async (
vis: Vis,
diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
index fe8a9adff4052..a810b4b65528f 100644
--- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
+++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts
@@ -38,6 +38,7 @@ import {
Adapters,
SavedObjectEmbeddableInput,
ReferenceOrValueEmbeddable,
+ AttributeService,
} from '../../../../plugins/embeddable/public';
import {
IExpressionLoaderParams,
@@ -51,7 +52,6 @@ import { VIS_EVENT_TO_TRIGGER } from './events';
import { VisualizeEmbeddableFactoryDeps } from './visualize_embeddable_factory';
import { TriggerId } from '../../../ui_actions/public';
import { SavedObjectAttributes } from '../../../../core/types';
-import { AttributeService } from '../../../dashboard/public';
import { SavedVisualizationsLoader } from '../saved_visualizations';
import { VisSavedObject } from '../types';
diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx
index 87f78f5639ff0..4b851da6be70e 100644
--- a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx
+++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx
@@ -26,6 +26,7 @@ import {
EmbeddableOutput,
ErrorEmbeddable,
IContainer,
+ AttributeService,
} from '../../../embeddable/public';
import { DisabledLabEmbeddable } from './disabled_lab_embeddable';
import {
@@ -50,7 +51,6 @@ import { createVisEmbeddableFromObject } from './create_vis_embeddable_from_obje
import { StartServicesGetter } from '../../../kibana_utils/public';
import { VisualizationsStartDeps } from '../plugin';
import { VISUALIZE_ENABLE_LABS_SETTING } from '../../common/constants';
-import { AttributeService } from '../../../dashboard/public';
import { checkForDuplicateTitle } from '../../../saved_objects/public';
interface VisualizationAttributes extends SavedObjectAttributes {
@@ -126,7 +126,7 @@ export class VisualizeEmbeddableFactory
if (!this.attributeService) {
this.attributeService = await this.deps
.start()
- .plugins.dashboard.getAttributeService<
+ .plugins.embeddable.getAttributeService<
VisualizeSavedObjectAttributes,
VisualizeByValueInput,
VisualizeByReferenceInput
diff --git a/src/plugins/visualizations/public/plugin.ts b/src/plugins/visualizations/public/plugin.ts
index 37a9972983421..be7629ef41145 100644
--- a/src/plugins/visualizations/public/plugin.ts
+++ b/src/plugins/visualizations/public/plugin.ts
@@ -112,7 +112,7 @@ export interface VisualizationsStartDeps {
uiActions: UiActionsStart;
application: ApplicationStart;
dashboard: DashboardStart;
- getAttributeService: DashboardStart['getAttributeService'];
+ getAttributeService: EmbeddableStart['getAttributeService'];
savedObjectsClient: SavedObjectsClientContract;
}
diff --git a/x-pack/plugins/lens/kibana.json b/x-pack/plugins/lens/kibana.json
index 46a0b56a03ec5..100527accd1b9 100644
--- a/x-pack/plugins/lens/kibana.json
+++ b/x-pack/plugins/lens/kibana.json
@@ -12,9 +12,10 @@
"visualizations",
"dashboard",
"charts",
- "uiActions"
+ "uiActions",
+ "embeddable"
],
- "optionalPlugins": ["embeddable", "usageCollection", "taskManager", "globalSearch"],
+ "optionalPlugins": ["usageCollection", "taskManager", "globalSearch"],
"configPath": ["xpack", "lens"],
"extraPublicDirs": ["common/constants"],
"requiredBundles": ["savedObjects", "kibanaUtils", "kibanaReact", "embeddable"]
diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx
index 70f3f767930ec..e9e6bf43d9f1b 100644
--- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx
+++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx
@@ -36,7 +36,7 @@ import {
LensByReferenceInput,
} from '../editor_frame_service/embeddable/embeddable';
import { SavedObjectReference } from '../../../../../src/core/types';
-import { mockAttributeService } from '../../../../../src/plugins/dashboard/public/mocks';
+import { mockAttributeService } from '../../../../../src/plugins/embeddable/public/mocks';
import { LensAttributeService } from '../lens_attribute_service';
import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.test.tsx
index 4966fce590542..d91865c21a2a6 100644
--- a/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.test.tsx
+++ b/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.test.tsx
@@ -25,7 +25,7 @@ import { dataPluginMock } from '../../../../../../src/plugins/data/public/mocks'
import { VIS_EVENT_TO_TRIGGER } from '../../../../../../src/plugins/visualizations/public/embeddable';
import { coreMock, httpServiceMock } from '../../../../../../src/core/public/mocks';
import { IBasePath } from '../../../../../../src/core/public';
-import { AttributeService } from '../../../../../../src/plugins/dashboard/public';
+import { AttributeService } from '../../../../../../src/plugins/embeddable/public';
import { LensAttributeService } from '../../lens_attribute_service';
import { OnSaveProps } from '../../../../../../src/plugins/saved_objects/public/save_modal';
diff --git a/x-pack/plugins/lens/public/lens_attribute_service.ts b/x-pack/plugins/lens/public/lens_attribute_service.ts
index 9e1ce535d6675..9f6feee2877a8 100644
--- a/x-pack/plugins/lens/public/lens_attribute_service.ts
+++ b/x-pack/plugins/lens/public/lens_attribute_service.ts
@@ -6,7 +6,7 @@
import { CoreStart } from '../../../../src/core/public';
import { LensPluginStartDependencies } from './plugin';
-import { AttributeService } from '../../../../src/plugins/dashboard/public';
+import { AttributeService } from '../../../../src/plugins/embeddable/public';
import {
LensSavedObjectAttributes,
LensByValueInput,
@@ -26,7 +26,7 @@ export function getLensAttributeService(
startDependencies: LensPluginStartDependencies
): LensAttributeService {
const savedObjectStore = new SavedObjectIndexStore(core.savedObjects.client);
- return startDependencies.dashboard.getAttributeService<
+ return startDependencies.embeddable.getAttributeService<
LensSavedObjectAttributes,
LensByValueInput,
LensByReferenceInput
diff --git a/x-pack/plugins/lens/public/plugin.ts b/x-pack/plugins/lens/public/plugin.ts
index 90b0f0a2bde84..ef84ca2698ee6 100644
--- a/x-pack/plugins/lens/public/plugin.ts
+++ b/x-pack/plugins/lens/public/plugin.ts
@@ -58,7 +58,7 @@ export interface LensPluginStartDependencies {
navigation: NavigationPublicPluginStart;
uiActions: UiActionsStart;
dashboard: DashboardStart;
- embeddable?: EmbeddableStart;
+ embeddable: EmbeddableStart;
}
export class LensPlugin {
private datatableVisualization: DatatableVisualization;
From 3bd95d42e83962eea776b3415a8d14404f69515a Mon Sep 17 00:00:00 2001
From: Gidi Meir Morris
- {i18n.translate( - 'xpack.idxMgmt.mappingsEditor.aliasType.noFieldsAddedWarningMessage', - { - defaultMessage: - 'You need to add at least one field before creating an alias.', - } - )} -
-
- {i18n.translate('xpack.idxMgmt.mappingsEditor.termVectorFieldWarningMessage', {
+
+
ExpressionAstExpression
| |
+
+Returns:
+
+`{
+ state: ExpressionAstExpression;
+ references: SavedObjectReference[];
+ }`
+
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.inject.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.inject.md
new file mode 100644
index 0000000000000..8f5a8a3e06724
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.inject.md
@@ -0,0 +1,23 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [Executor](./kibana-plugin-plugins-expressions-public.executor.md) > [inject](./kibana-plugin-plugins-expressions-public.executor.inject.md)
+
+## Executor.inject() method
+
+Signature:
+
+```typescript
+inject(ast: ExpressionAstExpression, references: SavedObjectReference[]): ExpressionAstExpression;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| ast | ExpressionAstExpression
| |
+| references | SavedObjectReference[]
| |
+
+Returns:
+
+`ExpressionAstExpression`
+
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.md
index b71c8c79c068f..2f96ad6e040bd 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.md
@@ -7,7 +7,7 @@
Signature:
```typescript
-export declare class ExecutorExpressionAstExpression
| |
+| telemetryData | Record<string, any>
| |
+
+Returns:
+
+`RecordExpressionAstFunction[]
| |
-| [type](./kibana-plugin-plugins-expressions-public.expressionastexpression.type.md) | 'expression'
| |
-
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastexpression.type.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastexpression.type.md
deleted file mode 100644
index 34a86e235a911..0000000000000
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastexpression.type.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionAstExpression](./kibana-plugin-plugins-expressions-public.expressionastexpression.md) > [type](./kibana-plugin-plugins-expressions-public.expressionastexpression.type.md)
-
-## ExpressionAstExpression.type property
-
-Signature:
-
-```typescript
-type: 'expression';
-```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastfunction.arguments.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastfunction.arguments.md
deleted file mode 100644
index 72b44e8319542..0000000000000
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastfunction.arguments.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md) > [arguments](./kibana-plugin-plugins-expressions-public.expressionastfunction.arguments.md)
-
-## ExpressionAstFunction.arguments property
-
-Signature:
-
-```typescript
-arguments: RecordRecord<string, ExpressionAstArgument[]>
| |
-| [debug](./kibana-plugin-plugins-expressions-public.expressionastfunction.debug.md) | ExpressionAstFunctionDebug
| Debug information added to each function when expression is executed in \*debug mode\*. |
-| [function](./kibana-plugin-plugins-expressions-public.expressionastfunction.function.md) | string
| |
-| [type](./kibana-plugin-plugins-expressions-public.expressionastfunction.type.md) | 'function'
| |
-
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastfunction.type.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md
similarity index 52%
rename from docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastfunction.type.md
rename to docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md
index f7f8786430191..f07d5b3b36d04 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionastfunction.type.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md
@@ -1,11 +1,11 @@
-[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md) > [type](./kibana-plugin-plugins-expressions-public.expressionastfunction.type.md)
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) > [disabled](./kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md)
-## ExpressionAstFunction.type property
+## ExpressionFunction.disabled property
Signature:
```typescript
-type: 'function';
+disabled: boolean;
```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.extract.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.extract.md
new file mode 100644
index 0000000000000..c5d726849cdc2
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.extract.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) > [extract](./kibana-plugin-plugins-expressions-public.expressionfunction.extract.md)
+
+## ExpressionFunction.extract property
+
+Signature:
+
+```typescript
+extract: (state: ExpressionAstFunction['arguments']) => {
+ state: ExpressionAstFunction['arguments'];
+ references: SavedObjectReference[];
+ };
+```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.inject.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.inject.md
new file mode 100644
index 0000000000000..6f27a6fbab96a
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.inject.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) > [inject](./kibana-plugin-plugins-expressions-public.expressionfunction.inject.md)
+
+## ExpressionFunction.inject property
+
+Signature:
+
+```typescript
+inject: (state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) => ExpressionAstFunction['arguments'];
+```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.md
index 5ca67e40c93ec..1815d63d804b1 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.md
@@ -7,7 +7,7 @@
Signature:
```typescript
-export declare class ExpressionFunction
+export declare class ExpressionFunction implements PersistableState(type: string) => boolean
| |
| [aliases](./kibana-plugin-plugins-expressions-public.expressionfunction.aliases.md) | | string[]
| Aliases that can be used instead of name
. |
| [args](./kibana-plugin-plugins-expressions-public.expressionfunction.args.md) | | Record<string, ExpressionFunctionParameter>
| Specification of expression function parameters. |
+| [disabled](./kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md) | | boolean
| |
+| [extract](./kibana-plugin-plugins-expressions-public.expressionfunction.extract.md) | | (state: ExpressionAstFunction['arguments']) => {
state: ExpressionAstFunction['arguments'];
references: SavedObjectReference[];
}
| |
| [fn](./kibana-plugin-plugins-expressions-public.expressionfunction.fn.md) | | (input: ExpressionValue, params: Record<string, any>, handlers: object) => ExpressionValue
| Function to run function (context, args) |
| [help](./kibana-plugin-plugins-expressions-public.expressionfunction.help.md) | | string
| A short help text. |
+| [inject](./kibana-plugin-plugins-expressions-public.expressionfunction.inject.md) | | (state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) => ExpressionAstFunction['arguments']
| |
| [inputTypes](./kibana-plugin-plugins-expressions-public.expressionfunction.inputtypes.md) | | string[] | undefined
| Type of inputs that this function supports. |
| [name](./kibana-plugin-plugins-expressions-public.expressionfunction.name.md) | | string
| Name of function |
+| [telemetry](./kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md) | | (state: ExpressionAstFunction['arguments'], telemetryData: Record<string, any>) => Record<string, any>
| |
| [type](./kibana-plugin-plugins-expressions-public.expressionfunction.type.md) | | string
| Return type of function. This SHOULD be supplied. We use it for UI and autocomplete hinting. We may also use it for optimizations in the future. |
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md
new file mode 100644
index 0000000000000..249c99f50fc7b
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) > [telemetry](./kibana-plugin-plugins-expressions-public.expressionfunction.telemetry.md)
+
+## ExpressionFunction.telemetry property
+
+Signature:
+
+```typescript
+telemetry: (state: ExpressionAstFunction['arguments'], telemetryData: Record{
[key in keyof Arguments]: ArgumentType<Arguments[key]>;
}
| Specification of arguments that function supports. This list will also be used for autocomplete functionality when your function is being edited. |
| [context](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.context.md) | {
types: AnyExpressionFunctionDefinition['inputTypes'];
}
| |
+| [disabled](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.disabled.md) | boolean
| if set to true function will be disabled (but its migrate function will still be available) |
| [help](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.help.md) | string
| Help text displayed in the Expression editor. This text should be internationalized. |
| [inputTypes](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.inputtypes.md) | Array<TypeToString<Input>>
| List of allowed type names for input value of this function. If this property is set the input of function will be cast to the first possible type in this list. If this property is missing the input will be provided to the function as-is. |
| [name](./kibana-plugin-plugins-expressions-public.expressionfunctiondefinition.name.md) | Name
| The name of the function, as will be used in expression. |
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.extract.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.extract.md
new file mode 100644
index 0000000000000..90f1f59c90dea
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.extract.md
@@ -0,0 +1,16 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [extract](./kibana-plugin-plugins-expressions-public.expressionsservice.extract.md)
+
+## ExpressionsService.extract property
+
+Extracts saved object references from expression AST
+
+Signature:
+
+```typescript
+readonly extract: (state: ExpressionAstExpression) => {
+ state: ExpressionAstExpression;
+ references: SavedObjectReference[];
+ };
+```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.inject.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.inject.md
new file mode 100644
index 0000000000000..8ccc673ef24db
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.inject.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [inject](./kibana-plugin-plugins-expressions-public.expressionsservice.inject.md)
+
+## ExpressionsService.inject property
+
+Injects saved object references into expression AST
+
+Signature:
+
+```typescript
+readonly inject: (state: ExpressionAstExpression, references: SavedObjectReference[]) => ExpressionAstExpression;
+```
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.md
index fa93435bffc38..041d66b22dd50 100644
--- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.md
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.md
@@ -15,7 +15,7 @@ so that JSDoc appears in developers IDE when they use those `plugins.expressions
Signature:
```typescript
-export declare class ExpressionsService
+export declare class ExpressionsService implements PersistableStateExpressionsServiceStart['execute']
| |
| [executor](./kibana-plugin-plugins-expressions-public.expressionsservice.executor.md) | | Executor
| |
+| [extract](./kibana-plugin-plugins-expressions-public.expressionsservice.extract.md) | | (state: ExpressionAstExpression) => {
state: ExpressionAstExpression;
references: SavedObjectReference[];
}
| Extracts saved object references from expression AST |
| [fork](./kibana-plugin-plugins-expressions-public.expressionsservice.fork.md) | | () => ExpressionsService
| |
| [getFunction](./kibana-plugin-plugins-expressions-public.expressionsservice.getfunction.md) | | ExpressionsServiceStart['getFunction']
| |
| [getFunctions](./kibana-plugin-plugins-expressions-public.expressionsservice.getfunctions.md) | | () => ReturnType<Executor['getFunctions']>
| Returns POJO map of all registered expression functions, where keys are names of the functions and values are ExpressionFunction
instances. |
@@ -37,6 +38,7 @@ export declare class ExpressionsService
| [getRenderers](./kibana-plugin-plugins-expressions-public.expressionsservice.getrenderers.md) | | () => ReturnType<ExpressionRendererRegistry['toJS']>
| Returns POJO map of all registered expression renderers, where keys are names of the renderers and values are ExpressionRenderer
instances. |
| [getType](./kibana-plugin-plugins-expressions-public.expressionsservice.gettype.md) | | ExpressionsServiceStart['getType']
| |
| [getTypes](./kibana-plugin-plugins-expressions-public.expressionsservice.gettypes.md) | | () => ReturnType<Executor['getTypes']>
| Returns POJO map of all registered expression types, where keys are names of the types and values are ExpressionType
instances. |
+| [inject](./kibana-plugin-plugins-expressions-public.expressionsservice.inject.md) | | (state: ExpressionAstExpression, references: SavedObjectReference[]) => ExpressionAstExpression
| Injects saved object references into expression AST |
| [registerFunction](./kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md) | | (functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)) => void
| Register an expression function, which will be possible to execute as part of the expression pipeline.Below we register a function which simply sleeps for given number of milliseconds to delay the execution and outputs its input as-is.
```ts
expressions.registerFunction({
@@ -61,6 +63,7 @@ The actual function is defined in the fn
key. The function can be \
| [registerType](./kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md) | | (typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)) => void
| |
| [renderers](./kibana-plugin-plugins-expressions-public.expressionsservice.renderers.md) | | ExpressionRendererRegistry
| |
| [run](./kibana-plugin-plugins-expressions-public.expressionsservice.run.md) | | ExpressionsServiceStart['run']
| |
+| [telemetry](./kibana-plugin-plugins-expressions-public.expressionsservice.telemetry.md) | | (state: ExpressionAstExpression, telemetryData?: Record<string, any>) => Record<string, any>
| Extracts telemetry from expression AST |
## Methods
diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.telemetry.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.telemetry.md
new file mode 100644
index 0000000000000..5f28eb732e389
--- /dev/null
+++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.telemetry.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [telemetry](./kibana-plugin-plugins-expressions-public.expressionsservice.telemetry.md)
+
+## ExpressionsService.telemetry property
+
+Extracts telemetry from expression AST
+
+Signature:
+
+```typescript
+readonly telemetry: (state: ExpressionAstExpression, telemetryData?: RecordExpressionFunctionDefinition
is the interface plugins have to implement to register a function in expressions
plugin. |
@@ -102,6 +100,8 @@
| [ExecutionContainer](./kibana-plugin-plugins-expressions-public.executioncontainer.md) | |
| [ExecutorContainer](./kibana-plugin-plugins-expressions-public.executorcontainer.md) | |
| [ExpressionAstArgument](./kibana-plugin-plugins-expressions-public.expressionastargument.md) | |
+| [ExpressionAstExpression](./kibana-plugin-plugins-expressions-public.expressionastexpression.md) | |
+| [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md) | |
| [ExpressionAstNode](./kibana-plugin-plugins-expressions-public.expressionastnode.md) | |
| [ExpressionFunctionKibana](./kibana-plugin-plugins-expressions-public.expressionfunctionkibana.md) | |
| [ExpressionRendererComponent](./kibana-plugin-plugins-expressions-public.expressionrenderercomponent.md) | |
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.extract.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.extract.md
new file mode 100644
index 0000000000000..0829824732e74
--- /dev/null
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.extract.md
@@ -0,0 +1,28 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [Executor](./kibana-plugin-plugins-expressions-server.executor.md) > [extract](./kibana-plugin-plugins-expressions-server.executor.extract.md)
+
+## Executor.extract() method
+
+Signature:
+
+```typescript
+extract(ast: ExpressionAstExpression): {
+ state: ExpressionAstExpression;
+ references: SavedObjectReference[];
+ };
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| ast | ExpressionAstExpression
| |
+
+Returns:
+
+`{
+ state: ExpressionAstExpression;
+ references: SavedObjectReference[];
+ }`
+
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.inject.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.inject.md
new file mode 100644
index 0000000000000..bbc5f7a3cece7
--- /dev/null
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.inject.md
@@ -0,0 +1,23 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [Executor](./kibana-plugin-plugins-expressions-server.executor.md) > [inject](./kibana-plugin-plugins-expressions-server.executor.inject.md)
+
+## Executor.inject() method
+
+Signature:
+
+```typescript
+inject(ast: ExpressionAstExpression, references: SavedObjectReference[]): ExpressionAstExpression;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| ast | ExpressionAstExpression
| |
+| references | SavedObjectReference[]
| |
+
+Returns:
+
+`ExpressionAstExpression`
+
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.md
index 7e6bb8c7ded5e..ec4e0bdcc4569 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.md
@@ -7,7 +7,7 @@
Signature:
```typescript
-export declare class ExecutorExpressionAstExpression
| |
+| telemetryData | Record<string, any>
| |
+
+Returns:
+
+`RecordExpressionAstFunction[]
| |
-| [type](./kibana-plugin-plugins-expressions-server.expressionastexpression.type.md) | 'expression'
| |
-
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastexpression.type.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastexpression.type.md
deleted file mode 100644
index 46cd60cecaa84..0000000000000
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastexpression.type.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionAstExpression](./kibana-plugin-plugins-expressions-server.expressionastexpression.md) > [type](./kibana-plugin-plugins-expressions-server.expressionastexpression.type.md)
-
-## ExpressionAstExpression.type property
-
-Signature:
-
-```typescript
-type: 'expression';
-```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunction.arguments.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunction.arguments.md
deleted file mode 100644
index 052cadffb9bdb..0000000000000
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunction.arguments.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionAstFunction](./kibana-plugin-plugins-expressions-server.expressionastfunction.md) > [arguments](./kibana-plugin-plugins-expressions-server.expressionastfunction.arguments.md)
-
-## ExpressionAstFunction.arguments property
-
-Signature:
-
-```typescript
-arguments: RecordRecord<string, ExpressionAstArgument[]>
| |
-| [debug](./kibana-plugin-plugins-expressions-server.expressionastfunction.debug.md) | ExpressionAstFunctionDebug
| Debug information added to each function when expression is executed in \*debug mode\*. |
-| [function](./kibana-plugin-plugins-expressions-server.expressionastfunction.function.md) | string
| |
-| [type](./kibana-plugin-plugins-expressions-server.expressionastfunction.type.md) | 'function'
| |
-
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunction.type.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.disabled.md
similarity index 52%
rename from docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunction.type.md
rename to docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.disabled.md
index 3fd10524c1599..8ae51645f5df9 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionastfunction.type.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.disabled.md
@@ -1,11 +1,11 @@
-[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionAstFunction](./kibana-plugin-plugins-expressions-server.expressionastfunction.md) > [type](./kibana-plugin-plugins-expressions-server.expressionastfunction.type.md)
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-server.expressionfunction.md) > [disabled](./kibana-plugin-plugins-expressions-server.expressionfunction.disabled.md)
-## ExpressionAstFunction.type property
+## ExpressionFunction.disabled property
Signature:
```typescript
-type: 'function';
+disabled: boolean;
```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.extract.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.extract.md
new file mode 100644
index 0000000000000..e7ecad4a6c9e4
--- /dev/null
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.extract.md
@@ -0,0 +1,14 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-server.expressionfunction.md) > [extract](./kibana-plugin-plugins-expressions-server.expressionfunction.extract.md)
+
+## ExpressionFunction.extract property
+
+Signature:
+
+```typescript
+extract: (state: ExpressionAstFunction['arguments']) => {
+ state: ExpressionAstFunction['arguments'];
+ references: SavedObjectReference[];
+ };
+```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.inject.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.inject.md
new file mode 100644
index 0000000000000..85c98ef9193da
--- /dev/null
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.inject.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-server.expressionfunction.md) > [inject](./kibana-plugin-plugins-expressions-server.expressionfunction.inject.md)
+
+## ExpressionFunction.inject property
+
+Signature:
+
+```typescript
+inject: (state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) => ExpressionAstFunction['arguments'];
+```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.md
index aac3878b8c859..7fcda94968d13 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.md
@@ -7,7 +7,7 @@
Signature:
```typescript
-export declare class ExpressionFunction
+export declare class ExpressionFunction implements PersistableState(type: string) => boolean
| |
| [aliases](./kibana-plugin-plugins-expressions-server.expressionfunction.aliases.md) | | string[]
| Aliases that can be used instead of name
. |
| [args](./kibana-plugin-plugins-expressions-server.expressionfunction.args.md) | | Record<string, ExpressionFunctionParameter>
| Specification of expression function parameters. |
+| [disabled](./kibana-plugin-plugins-expressions-server.expressionfunction.disabled.md) | | boolean
| |
+| [extract](./kibana-plugin-plugins-expressions-server.expressionfunction.extract.md) | | (state: ExpressionAstFunction['arguments']) => {
state: ExpressionAstFunction['arguments'];
references: SavedObjectReference[];
}
| |
| [fn](./kibana-plugin-plugins-expressions-server.expressionfunction.fn.md) | | (input: ExpressionValue, params: Record<string, any>, handlers: object) => ExpressionValue
| Function to run function (context, args) |
| [help](./kibana-plugin-plugins-expressions-server.expressionfunction.help.md) | | string
| A short help text. |
+| [inject](./kibana-plugin-plugins-expressions-server.expressionfunction.inject.md) | | (state: ExpressionAstFunction['arguments'], references: SavedObjectReference[]) => ExpressionAstFunction['arguments']
| |
| [inputTypes](./kibana-plugin-plugins-expressions-server.expressionfunction.inputtypes.md) | | string[] | undefined
| Type of inputs that this function supports. |
| [name](./kibana-plugin-plugins-expressions-server.expressionfunction.name.md) | | string
| Name of function |
+| [telemetry](./kibana-plugin-plugins-expressions-server.expressionfunction.telemetry.md) | | (state: ExpressionAstFunction['arguments'], telemetryData: Record<string, any>) => Record<string, any>
| |
| [type](./kibana-plugin-plugins-expressions-server.expressionfunction.type.md) | | string
| Return type of function. This SHOULD be supplied. We use it for UI and autocomplete hinting. We may also use it for optimizations in the future. |
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.telemetry.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.telemetry.md
new file mode 100644
index 0000000000000..2894486847b27
--- /dev/null
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionfunction.telemetry.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionFunction](./kibana-plugin-plugins-expressions-server.expressionfunction.md) > [telemetry](./kibana-plugin-plugins-expressions-server.expressionfunction.telemetry.md)
+
+## ExpressionFunction.telemetry property
+
+Signature:
+
+```typescript
+telemetry: (state: ExpressionAstFunction['arguments'], telemetryData: Record{
[key in keyof Arguments]: ArgumentType<Arguments[key]>;
}
| Specification of arguments that function supports. This list will also be used for autocomplete functionality when your function is being edited. |
| [context](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.context.md) | {
types: AnyExpressionFunctionDefinition['inputTypes'];
}
| |
+| [disabled](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.disabled.md) | boolean
| if set to true function will be disabled (but its migrate function will still be available) |
| [help](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.help.md) | string
| Help text displayed in the Expression editor. This text should be internationalized. |
| [inputTypes](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.inputtypes.md) | Array<TypeToString<Input>>
| List of allowed type names for input value of this function. If this property is set the input of function will be cast to the first possible type in this list. If this property is missing the input will be provided to the function as-is. |
| [name](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.name.md) | Name
| The name of the function, as will be used in expression. |
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvalueerror.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvalueerror.md
index b90e4360e055a..c8132948a8993 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvalueerror.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionvalueerror.md
@@ -8,13 +8,7 @@
```typescript
export declare type ExpressionValueError = ExpressionValueBoxed<'error', {
- error: {
- message: string;
- type?: string;
- name?: string;
- stack?: string;
- original?: Error;
- };
- info?: unknown;
+ error: ErrorLike;
+ info?: SerializableState;
}>;
```
diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md
index c9fed2e00c66c..dd7c7af466bd0 100644
--- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md
+++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.md
@@ -52,9 +52,7 @@
| [ExecutionParams](./kibana-plugin-plugins-expressions-server.executionparams.md) | |
| [ExecutionState](./kibana-plugin-plugins-expressions-server.executionstate.md) | |
| [ExecutorState](./kibana-plugin-plugins-expressions-server.executorstate.md) | |
-| [ExpressionAstExpression](./kibana-plugin-plugins-expressions-server.expressionastexpression.md) | |
| [ExpressionAstExpressionBuilder](./kibana-plugin-plugins-expressions-server.expressionastexpressionbuilder.md) | |
-| [ExpressionAstFunction](./kibana-plugin-plugins-expressions-server.expressionastfunction.md) | |
| [ExpressionAstFunctionBuilder](./kibana-plugin-plugins-expressions-server.expressionastfunctionbuilder.md) | |
| [ExpressionFunctionDefinition](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinition.md) | ExpressionFunctionDefinition
is the interface plugins have to implement to register a function in expressions
plugin. |
| [ExpressionFunctionDefinitions](./kibana-plugin-plugins-expressions-server.expressionfunctiondefinitions.md) | A mapping of ExpressionFunctionDefinition
s for functions which the Expressions services provides out-of-the-box. Any new functions registered by the Expressions plugin should have their types added here. |
@@ -86,6 +84,8 @@
| [ExecutionContainer](./kibana-plugin-plugins-expressions-server.executioncontainer.md) | |
| [ExecutorContainer](./kibana-plugin-plugins-expressions-server.executorcontainer.md) | |
| [ExpressionAstArgument](./kibana-plugin-plugins-expressions-server.expressionastargument.md) | |
+| [ExpressionAstExpression](./kibana-plugin-plugins-expressions-server.expressionastexpression.md) | |
+| [ExpressionAstFunction](./kibana-plugin-plugins-expressions-server.expressionastfunction.md) | |
| [ExpressionAstNode](./kibana-plugin-plugins-expressions-server.expressionastnode.md) | |
| [ExpressionFunctionKibana](./kibana-plugin-plugins-expressions-server.expressionfunctionkibana.md) | |
| [ExpressionsServerSetup](./kibana-plugin-plugins-expressions-server.expressionsserversetup.md) | |
diff --git a/src/plugins/expressions/.eslintrc.json b/src/plugins/expressions/.eslintrc.json
new file mode 100644
index 0000000000000..2aab6c2d9093b
--- /dev/null
+++ b/src/plugins/expressions/.eslintrc.json
@@ -0,0 +1,5 @@
+{
+ "rules": {
+ "@typescript-eslint/consistent-type-definitions": 0
+ }
+}
diff --git a/src/plugins/expressions/common/ast/types.ts b/src/plugins/expressions/common/ast/types.ts
index 09fb4fae3f201..e8cf497774569 100644
--- a/src/plugins/expressions/common/ast/types.ts
+++ b/src/plugins/expressions/common/ast/types.ts
@@ -24,12 +24,12 @@ export type ExpressionAstNode =
| ExpressionAstFunction
| ExpressionAstArgument;
-export interface ExpressionAstExpression {
+export type ExpressionAstExpression = {
type: 'expression';
chain: ExpressionAstFunction[];
-}
+};
-export interface ExpressionAstFunction {
+export type ExpressionAstFunction = {
type: 'function';
function: string;
arguments: Record