diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.leasefunctions.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.leasefunctions.md new file mode 100644 index 0000000000000..cec77b44bdb3a --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.leasefunctions.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [Executor](./kibana-plugin-plugins-expressions-public.executor.md) > [leaseFunctions](./kibana-plugin-plugins-expressions-public.executor.leasefunctions.md) + +## Executor.leaseFunctions() method + +Register a collection of functions meant to be deregegistered by the registering context, when they are no longer to be used, which can be done with the callback returned. + +Signature: + +```typescript +leaseFunctions(functionDefinitions: FunctionDefinition[]): () => ExecutorState>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| functionDefinitions | FunctionDefinition[] | | + +Returns: + +`() => ExecutorState>` + diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.leasetypes.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.leasetypes.md new file mode 100644 index 0000000000000..63fb70f37a1d9 --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.leasetypes.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [Executor](./kibana-plugin-plugins-expressions-public.executor.md) > [leaseTypes](./kibana-plugin-plugins-expressions-public.executor.leasetypes.md) + +## Executor.leaseTypes() method + +Register a collection of types meant to be deregegistered by the registering context when they are no longer to be used, which can be done with the callback returned. + +Signature: + +```typescript +leaseTypes(typeDefinitions: TypeDefinition[]): () => ExecutorState>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| typeDefinitions | TypeDefinition[] | | + +Returns: + +`() => ExecutorState>` + 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 6835188c2fb04..bceedc81ca838 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 @@ -39,9 +39,13 @@ export declare class Executor = RecordSignature: ```typescript -registerFunction(functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)): void; +registerFunction(functionDefinition: FunctionDefinition): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| functionDefinition | AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition) | | +| functionDefinition | FunctionDefinition | | Returns: diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registerfunctions.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registerfunctions.md new file mode 100644 index 0000000000000..4b64b2702578d --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registerfunctions.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [Executor](./kibana-plugin-plugins-expressions-public.executor.md) > [registerFunctions](./kibana-plugin-plugins-expressions-public.executor.registerfunctions.md) + +## Executor.registerFunctions() method + +Register a collection of functions with the executor. + +Signature: + +```typescript +registerFunctions(functionDefinitions: FunctionDefinition[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| functionDefinitions | FunctionDefinition[] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertype.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertype.md index f56e5ffcfb9ee..426b9cdbbd821 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertype.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertype.md @@ -4,17 +4,19 @@ ## Executor.registerType() method +Register a single type with the executor. + Signature: ```typescript -registerType(typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)): void; +registerType(typeDefinition: TypeDefinition): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| typeDefinition | AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition) | | +| typeDefinition | TypeDefinition | | Returns: diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertypes.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertypes.md new file mode 100644 index 0000000000000..5df009c9a6f7d --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executor.registertypes.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [Executor](./kibana-plugin-plugins-expressions-public.executor.md) > [registerTypes](./kibana-plugin-plugins-expressions-public.executor.registertypes.md) + +## Executor.registerTypes() method + +Register a collection of types with the executor. + +Signature: + +```typescript +registerTypes(typeDefinitions: TypeDefinition[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| typeDefinitions | TypeDefinition[] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrendererregistry.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrendererregistry.md index e53f2a7970723..f0d0253795f08 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrendererregistry.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrendererregistry.md @@ -16,6 +16,7 @@ export declare class ExpressionRendererRegistry implements IRegistry + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionRendererRegistry](./kibana-plugin-plugins-expressions-public.expressionrendererregistry.md) > [remove](./kibana-plugin-plugins-expressions-public.expressionrendererregistry.remove.md) + +## ExpressionRendererRegistry.remove() method + +Signature: + +```typescript +remove(name: string): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| name | string | | + +Returns: + +`void` + diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leasefunctions.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leasefunctions.md new file mode 100644 index 0000000000000..988215abca163 --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leasefunctions.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) > [leaseFunctions](./kibana-plugin-plugins-expressions-public.expressionsservice.leasefunctions.md) + +## ExpressionsService.leaseFunctions property + +Register a collection of expression functions that are meant to be deregistered by the registering context, (e.g. a plugin leases on mount and deregisters on unmount). This call returns a simple callback to make registering easier. + +Signature: + +```typescript +readonly leaseFunctions: Executor['leaseFunctions']; +``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leaserenderers.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leaserenderers.md new file mode 100644 index 0000000000000..0abfaaa1f4ecc --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leaserenderers.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [leaseRenderers](./kibana-plugin-plugins-expressions-public.expressionsservice.leaserenderers.md) + +## ExpressionsService.leaseRenderers property + +Signature: + +```typescript +readonly leaseRenderers: (definitions: Array AnyExpressionRenderDefinition)>) => () => void; +``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leasetypes.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leasetypes.md new file mode 100644 index 0000000000000..bd165bd7b871f --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.leasetypes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [leaseTypes](./kibana-plugin-plugins-expressions-public.expressionsservice.leasetypes.md) + +## ExpressionsService.leaseTypes property + +Signature: + +```typescript +readonly leaseTypes: Executor['leaseTypes']; +``` 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 9afd603bc4869..d5e5c820ad79a 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 @@ -39,8 +39,11 @@ export declare class ExpressionsService implements PersistableStateServiceExpressionsServiceStart['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 | +| [leaseFunctions](./kibana-plugin-plugins-expressions-public.expressionsservice.leasefunctions.md) | | Executor['leaseFunctions'] | Register a collection of expression functions that are meant to be deregistered by the registering context, (e.g. a plugin leases on mount and deregisters on unmount). This call returns a simple callback to make registering easier. | +| [leaseRenderers](./kibana-plugin-plugins-expressions-public.expressionsservice.leaserenderers.md) | | (definitions: Array<AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)>) => () => void | | +| [leaseTypes](./kibana-plugin-plugins-expressions-public.expressionsservice.leasetypes.md) | | Executor['leaseTypes'] | | | [migrate](./kibana-plugin-plugins-expressions-public.expressionsservice.migrate.md) | | (state: SerializableState, version: string) => ExpressionAstExpression | Runs the migration (if it exists) for specified version. This will run a single migration step (ie from 7.10.0 to 7.10.1) | -| [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. +| [registerFunction](./kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md) | | Executor['registerFunction'] | 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({ name: 'sleep', @@ -60,8 +63,11 @@ expressions.registerFunction({ ``` The actual function is defined in the fn key. The function can be \*async\*. It receives three arguments: (1) input is the output of the previous function or the initial input of the expression if the function is first in chain; (2) args are function arguments as defined in expression string, that can be edited by user (e.g in case of Canvas); (3) context is a shared object passed to all functions that can be used for side-effects. | -| [registerRenderer](./kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderer.md) | | (definition: AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)) => void | | -| [registerType](./kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md) | | (typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)) => void | | +| [registerFunctions](./kibana-plugin-plugins-expressions-public.expressionsservice.registerfunctions.md) | | Executor['registerFunctions'] | Register a collection of expression functions. See registerFunction for details. | +| [registerRenderer](./kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderer.md) | | ExpressionRendererRegistry['register'] | | +| [registerRenderers](./kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderers.md) | | (definitions: Array<AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)>) => void | | +| [registerType](./kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md) | | Executor['registerType'] | | +| [registerTypes](./kibana-plugin-plugins-expressions-public.expressionsservice.registertypes.md) | | Executor['registerTypes'] | | | [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 | diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md index 0653e68bb4837..8c37d24cc6f2b 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md @@ -31,5 +31,5 @@ The actual function is defined in the `fn` key. The function can be \*async\*. I Signature: ```typescript -readonly registerFunction: (functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)) => void; +readonly registerFunction: Executor['registerFunction']; ``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunctions.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunctions.md new file mode 100644 index 0000000000000..87231f29b4892 --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerfunctions.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) > [registerFunctions](./kibana-plugin-plugins-expressions-public.expressionsservice.registerfunctions.md) + +## ExpressionsService.registerFunctions property + +Register a collection of expression functions. See `registerFunction` for details. + +Signature: + +```typescript +readonly registerFunctions: Executor['registerFunctions']; +``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderer.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderer.md index 7aff36e7fd817..60b8c5887b138 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderer.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderer.md @@ -7,5 +7,5 @@ Signature: ```typescript -readonly registerRenderer: (definition: AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)) => void; +readonly registerRenderer: ExpressionRendererRegistry['register']; ``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderers.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderers.md new file mode 100644 index 0000000000000..0d6880a78c54c --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderers.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [registerRenderers](./kibana-plugin-plugins-expressions-public.expressionsservice.registerrenderers.md) + +## ExpressionsService.registerRenderers property + +Signature: + +```typescript +readonly registerRenderers: (definitions: Array AnyExpressionRenderDefinition)>) => void; +``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md index e6e71e5e7e7e9..7bbfb1256e1ab 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertype.md @@ -7,5 +7,5 @@ Signature: ```typescript -readonly registerType: (typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)) => void; +readonly registerType: Executor['registerType']; ``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertypes.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertypes.md new file mode 100644 index 0000000000000..0d647d811ff71 --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.registertypes.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) > [registerTypes](./kibana-plugin-plugins-expressions-public.expressionsservice.registertypes.md) + +## ExpressionsService.registerTypes property + +Signature: + +```typescript +readonly registerTypes: Executor['registerTypes']; +``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservicesetup.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservicesetup.md index 4cf3fb9b53978..909fc68edbc1a 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservicesetup.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservicesetup.md @@ -9,5 +9,5 @@ The public contract that `ExpressionsService` provides to other plugins in Kiban Signature: ```typescript -export declare type ExpressionsServiceSetup = Pick; +export declare type ExpressionsServiceSetup = Pick; ``` diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.leasefunctions.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.leasefunctions.md new file mode 100644 index 0000000000000..a50c8cec2bac6 --- /dev/null +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.leasefunctions.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [Executor](./kibana-plugin-plugins-expressions-server.executor.md) > [leaseFunctions](./kibana-plugin-plugins-expressions-server.executor.leasefunctions.md) + +## Executor.leaseFunctions() method + +Register a collection of functions meant to be deregegistered by the registering context, when they are no longer to be used, which can be done with the callback returned. + +Signature: + +```typescript +leaseFunctions(functionDefinitions: FunctionDefinition[]): () => ExecutorState>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| functionDefinitions | FunctionDefinition[] | | + +Returns: + +`() => ExecutorState>` + diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.leasetypes.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.leasetypes.md new file mode 100644 index 0000000000000..0a078d61cd766 --- /dev/null +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.leasetypes.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [Executor](./kibana-plugin-plugins-expressions-server.executor.md) > [leaseTypes](./kibana-plugin-plugins-expressions-server.executor.leasetypes.md) + +## Executor.leaseTypes() method + +Register a collection of types meant to be deregegistered by the registering context when they are no longer to be used, which can be done with the callback returned. + +Signature: + +```typescript +leaseTypes(typeDefinitions: TypeDefinition[]): () => ExecutorState>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| typeDefinitions | TypeDefinition[] | | + +Returns: + +`() => ExecutorState>` + 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 48002a9f986df..dab4558606b88 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 @@ -39,9 +39,13 @@ export declare class Executor = RecordSignature: ```typescript -registerFunction(functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)): void; +registerFunction(functionDefinition: FunctionDefinition): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| functionDefinition | AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition) | | +| functionDefinition | FunctionDefinition | | Returns: diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registerfunctions.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registerfunctions.md new file mode 100644 index 0000000000000..d79bbcc30da2f --- /dev/null +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registerfunctions.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [Executor](./kibana-plugin-plugins-expressions-server.executor.md) > [registerFunctions](./kibana-plugin-plugins-expressions-server.executor.registerfunctions.md) + +## Executor.registerFunctions() method + +Register a collection of functions with the executor. + +Signature: + +```typescript +registerFunctions(functionDefinitions: FunctionDefinition[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| functionDefinitions | FunctionDefinition[] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertype.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertype.md index 355ff92921f10..7220dc7ad3a4d 100644 --- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertype.md +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertype.md @@ -4,17 +4,19 @@ ## Executor.registerType() method +Register a single type with the executor. + Signature: ```typescript -registerType(typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)): void; +registerType(typeDefinition: TypeDefinition): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| typeDefinition | AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition) | | +| typeDefinition | TypeDefinition | | Returns: diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertypes.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertypes.md new file mode 100644 index 0000000000000..7a04b95b32463 --- /dev/null +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executor.registertypes.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [Executor](./kibana-plugin-plugins-expressions-server.executor.md) > [registerTypes](./kibana-plugin-plugins-expressions-server.executor.registertypes.md) + +## Executor.registerTypes() method + +Register a collection of types with the executor. + +Signature: + +```typescript +registerTypes(typeDefinitions: TypeDefinition[]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| typeDefinitions | TypeDefinition[] | | + +Returns: + +`void` + diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrendererregistry.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrendererregistry.md index d4a34ab140854..c216b8c691d91 100644 --- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrendererregistry.md +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrendererregistry.md @@ -16,6 +16,7 @@ export declare class ExpressionRendererRegistry implements IRegistry + +[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExpressionRendererRegistry](./kibana-plugin-plugins-expressions-server.expressionrendererregistry.md) > [remove](./kibana-plugin-plugins-expressions-server.expressionrendererregistry.remove.md) + +## ExpressionRendererRegistry.remove() method + +Signature: + +```typescript +remove(name: string): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| name | string | | + +Returns: + +`void` + diff --git a/src/plugins/expressions/common/executor/executor.ts b/src/plugins/expressions/common/executor/executor.ts index 1fba3b28a0ed5..5de0061ed7bbe 100644 --- a/src/plugins/expressions/common/executor/executor.ts +++ b/src/plugins/expressions/common/executor/executor.ts @@ -108,10 +108,16 @@ export class Executor = Record new ExpressionFunction(typeof fn === 'object' ? fn : fn()) @@ -120,6 +126,10 @@ export class Executor = Record new ExpressionFunction(typeof fn === 'object' ? fn : fn()) @@ -139,10 +149,16 @@ export class Executor = Record @@ -152,6 +168,10 @@ export class Executor = Record diff --git a/src/plugins/expressions/common/service/expressions_services.ts b/src/plugins/expressions/common/service/expressions_services.ts index f505b316178e6..7a0c7a5919a45 100644 --- a/src/plugins/expressions/common/service/expressions_services.ts +++ b/src/plugins/expressions/common/service/expressions_services.ts @@ -239,9 +239,17 @@ export class ExpressionsService implements PersistableStateService this.executor.registerFunction(functionDefinition); + /** + * Register a collection of expression functions. See `registerFunction` for details. + */ public readonly registerFunctions: Executor['registerFunctions'] = (functionDefinitions) => this.executor.registerFunctions(functionDefinitions); + /** + * Register a collection of expression functions that are meant to be deregistered by the + * registering context, (e.g. a plugin leases on mount and deregisters on unmount). This + * call returns a simple callback to make registering easier. + */ public readonly leaseFunctions: Executor['leaseFunctions'] = (fns) => this.executor.leaseFunctions(fns); diff --git a/src/plugins/expressions/public/mocks.tsx b/src/plugins/expressions/public/mocks.tsx index 84287aefe046b..ed010f8d0071a 100644 --- a/src/plugins/expressions/public/mocks.tsx +++ b/src/plugins/expressions/public/mocks.tsx @@ -27,6 +27,12 @@ const createSetupContract = (): Setup => { registerRenderer: jest.fn(), registerType: jest.fn(), run: jest.fn(), + leaseFunctions: jest.fn(), + leaseRenderers: jest.fn(), + leaseTypes: jest.fn(), + registerFunctions: jest.fn(), + registerRenderers: jest.fn(), + registerTypes: jest.fn(), }; return setupContract; }; diff --git a/src/plugins/expressions/public/public.api.md b/src/plugins/expressions/public/public.api.md index 2d9c6d94cfa6d..54a96deaa854b 100644 --- a/src/plugins/expressions/public/public.api.md +++ b/src/plugins/expressions/public/public.api.md @@ -223,14 +223,18 @@ export class Executor = Record ExecutorState>; + leaseTypes(typeDefinitions: TypeDefinition[]): () => ExecutorState>; // Warning: (ae-forgotten-export) The symbol "SerializableState" needs to be exported by the entry point index.d.ts // // (undocumented) migrate(ast: SerializableState, version: string): ExpressionAstExpression; - // (undocumented) - registerFunction(functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)): void; - // (undocumented) - registerType(typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)): void; + // Warning: (ae-forgotten-export) The symbol "FunctionDefinition" needs to be exported by the entry point index.d.ts + registerFunction(functionDefinition: FunctionDefinition): void; + registerFunctions(functionDefinitions: FunctionDefinition[]): void; + // Warning: (ae-forgotten-export) The symbol "TypeDefinition" needs to be exported by the entry point index.d.ts + registerType(typeDefinition: TypeDefinition): void; + registerTypes(typeDefinitions: TypeDefinition[]): void; run(ast: string | ExpressionAstExpression, input: Input, params?: ExpressionExecutionParams): Observable>; // (undocumented) readonly state: ExecutorContainer; @@ -515,6 +519,8 @@ export class ExpressionRendererRegistry implements IRegistry // (undocumented) register(definition: AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)): void; // (undocumented) + remove(name: string): void; + // (undocumented) toArray(): ExpressionRenderer[]; // (undocumented) toJS(): Record; @@ -607,12 +613,22 @@ export class ExpressionsService implements PersistableStateService ReturnType; readonly inject: (state: ExpressionAstExpression, references: SavedObjectReference[]) => ExpressionAstExpression; + readonly leaseFunctions: Executor['leaseFunctions']; + // (undocumented) + readonly leaseRenderers: (definitions: Array AnyExpressionRenderDefinition)>) => () => void; + // (undocumented) + readonly leaseTypes: Executor['leaseTypes']; readonly migrate: (state: SerializableState, version: string) => ExpressionAstExpression; - readonly registerFunction: (functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)) => void; + readonly registerFunction: Executor['registerFunction']; + readonly registerFunctions: Executor['registerFunctions']; + // (undocumented) + readonly registerRenderer: ExpressionRendererRegistry['register']; + // (undocumented) + readonly registerRenderers: (definitions: Array AnyExpressionRenderDefinition)>) => void; // (undocumented) - readonly registerRenderer: (definition: AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)) => void; + readonly registerType: Executor['registerType']; // (undocumented) - readonly registerType: (typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)) => void; + readonly registerTypes: Executor['registerTypes']; // (undocumented) readonly renderers: ExpressionRendererRegistry; // (undocumented) @@ -627,7 +643,7 @@ export class ExpressionsService implements PersistableStateService; +export type ExpressionsServiceSetup = Pick; // Warning: (ae-missing-release-tag) "ExpressionsServiceStart" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // diff --git a/src/plugins/expressions/server/mocks.ts b/src/plugins/expressions/server/mocks.ts index 9bc25d89a04ca..1c93627c7b61b 100644 --- a/src/plugins/expressions/server/mocks.ts +++ b/src/plugins/expressions/server/mocks.ts @@ -26,6 +26,12 @@ const createSetupContract = (): Setup => { registerRenderer: jest.fn(), registerType: jest.fn(), run: jest.fn(), + leaseFunctions: jest.fn(), + leaseRenderers: jest.fn(), + leaseTypes: jest.fn(), + registerFunctions: jest.fn(), + registerRenderers: jest.fn(), + registerTypes: jest.fn(), }; return setupContract; }; diff --git a/src/plugins/expressions/server/server.api.md b/src/plugins/expressions/server/server.api.md index ec16d95ea8a3f..e2c714ad1493f 100644 --- a/src/plugins/expressions/server/server.api.md +++ b/src/plugins/expressions/server/server.api.md @@ -205,14 +205,18 @@ export class Executor = Record ExecutorState>; + leaseTypes(typeDefinitions: TypeDefinition[]): () => ExecutorState>; // Warning: (ae-forgotten-export) The symbol "SerializableState" needs to be exported by the entry point index.d.ts // // (undocumented) migrate(ast: SerializableState, version: string): ExpressionAstExpression; - // (undocumented) - registerFunction(functionDefinition: AnyExpressionFunctionDefinition | (() => AnyExpressionFunctionDefinition)): void; - // (undocumented) - registerType(typeDefinition: AnyExpressionTypeDefinition | (() => AnyExpressionTypeDefinition)): void; + // Warning: (ae-forgotten-export) The symbol "FunctionDefinition" needs to be exported by the entry point index.d.ts + registerFunction(functionDefinition: FunctionDefinition): void; + registerFunctions(functionDefinitions: FunctionDefinition[]): void; + // Warning: (ae-forgotten-export) The symbol "TypeDefinition" needs to be exported by the entry point index.d.ts + registerType(typeDefinition: TypeDefinition): void; + registerTypes(typeDefinitions: TypeDefinition[]): void; run(ast: string | ExpressionAstExpression, input: Input, params?: ExpressionExecutionParams): Observable>; // (undocumented) readonly state: ExecutorContainer; @@ -472,6 +476,8 @@ export class ExpressionRendererRegistry implements IRegistry // (undocumented) register(definition: AnyExpressionRenderDefinition | (() => AnyExpressionRenderDefinition)): void; // (undocumented) + remove(name: string): void; + // (undocumented) toArray(): ExpressionRenderer[]; // (undocumented) toJS(): Record;