Skip to content

Commit

Permalink
Merge branch 'master' into enhancement/optimize-filter-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 13, 2020
2 parents 3813935 + b5c5bf7 commit 2c549f0
Show file tree
Hide file tree
Showing 374 changed files with 19,331 additions and 14,827 deletions.
5 changes: 3 additions & 2 deletions docs/developer/best-practices/typescript.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ More details are available in the https://www.typescriptlang.org/docs/handbook/p
==== Caveats
This architecture imposes several limitations to which we must comply:

- Projects cannot have circular dependencies. Even though the Kibana platform doesn't support circular dependencies between Kibana plugins, TypeScript (and ES6 modules) does allow circular imports between files. So in theory, you may face a problem when migrating to the TS project references and you will have to resolve this circular dependency.
- Projects cannot have circular dependencies. Even though the Kibana platform doesn't support circular dependencies between Kibana plugins, TypeScript (and ES6 modules) does allow circular imports between files. So in theory, you may face a problem when migrating to the TS project references and you will have to resolve this circular dependency. https://github.com/elastic/kibana/issues/78162 is going to provide a tool to find such problem places.
- A project must emit its type declaration. It's not always possible to generate a type declaration if the compiler cannot infer a type. There are two basic cases:

1. Your plugin exports a type inferring an internal type declared in Kibana codebase. In this case, you'll have to either export an internal type or to declare an exported type explicitly.
2. Your plugin exports something inferring a type from a 3rd party library that doesn't export this type. To fix the problem, you have to declare the exported type manually.

[discrete]
==== Prerequisites
Since `tsc` doesn't support circular project references, the migration order does matter. You can migrate your plugin only when all the plugin dependencies already have migrated. It creates a situation where commonly used plugins (such as `data` or `kibana_react`) have to migrate first.
Since project refs rely on generated `d.ts` files, the migration order does matter. You can migrate your plugin only when all the plugin dependencies already have migrated. It creates a situation where commonly used plugins (such as `data` or `kibana_react`) have to migrate first.
https://github.com/elastic/kibana/issues/79343 is going to provide a tool for identifying a plugin dependency tree.

[discrete]
==== Implementation
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
| [DataPublicPluginStartUi](./kibana-plugin-plugins-data-public.datapublicpluginstartui.md) | Data plugin prewired UI components |
| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | |
| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | |
| [FieldMappingSpec](./kibana-plugin-plugins-data-public.fieldmappingspec.md) | |
| [IDataPluginServices](./kibana-plugin-plugins-data-public.idatapluginservices.md) | |
| [IEsSearchRequest](./kibana-plugin-plugins-data-public.iessearchrequest.md) | |
| [IFieldSubType](./kibana-plugin-plugins-data-public.ifieldsubtype.md) | |
Expand Down Expand Up @@ -108,7 +107,6 @@
| [esFilters](./kibana-plugin-plugins-data-public.esfilters.md) | |
| [esKuery](./kibana-plugin-plugins-data-public.eskuery.md) | |
| [esQuery](./kibana-plugin-plugins-data-public.esquery.md) | |
| [expandShorthand](./kibana-plugin-plugins-data-public.expandshorthand.md) | |
| [extractSearchSourceReferences](./kibana-plugin-plugins-data-public.extractsearchsourcereferences.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) | |
| [fieldList](./kibana-plugin-plugins-data-public.fieldlist.md) | |
Expand Down Expand Up @@ -163,7 +161,6 @@
| [ISearch](./kibana-plugin-plugins-data-public.isearch.md) | |
| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) | |
| [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) | search source interface |
| [MappingObject](./kibana-plugin-plugins-data-public.mappingobject.md) | |
| [MatchAllFilter](./kibana-plugin-plugins-data-public.matchallfilter.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-public.parsedinterval.md) | |
| [PhraseFilter](./kibana-plugin-plugins-data-public.phrasefilter.md) | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export interface ISearchStart<SearchStrategyRequest extends IKibanaSearchRequest
| --- | --- | --- |
| [aggs](./kibana-plugin-plugins-data-server.isearchstart.aggs.md) | <code>AggsStart</code> | |
| [getSearchStrategy](./kibana-plugin-plugins-data-server.isearchstart.getsearchstrategy.md) | <code>(name: string) =&gt; ISearchStrategy&lt;SearchStrategyRequest, SearchStrategyResponse&gt;</code> | Get other registered search strategies. For example, if a new strategy needs to use the already-registered ES search strategy, it can use this function to accomplish that. |
| [search](./kibana-plugin-plugins-data-server.isearchstart.search.md) | <code>(context: RequestHandlerContext, request: SearchStrategyRequest, options: ISearchOptions) =&gt; Promise&lt;SearchStrategyResponse&gt;</code> | |
| [search](./kibana-plugin-plugins-data-server.isearchstart.search.md) | <code>ISearchStrategy['search']</code> | |
| [searchSource](./kibana-plugin-plugins-data-server.isearchstart.searchsource.md) | <code>{</code><br/><code> asScoped: (request: KibanaRequest) =&gt; Promise&lt;ISearchStartSearchSource&gt;;</code><br/><code> }</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
search: (context: RequestHandlerContext, request: SearchStrategyRequest, options: ISearchOptions) => Promise<SearchStrategyResponse>;
search: ISearchStrategy['search'];
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export interface ISearchStrategy<SearchStrategyRequest extends IKibanaSearchRequ
| Property | Type | Description |
| --- | --- | --- |
| [cancel](./kibana-plugin-plugins-data-server.isearchstrategy.cancel.md) | <code>(context: RequestHandlerContext, id: string) =&gt; Promise&lt;void&gt;</code> | |
| [search](./kibana-plugin-plugins-data-server.isearchstrategy.search.md) | <code>(context: RequestHandlerContext, request: SearchStrategyRequest, options?: ISearchOptions) =&gt; Promise&lt;SearchStrategyResponse&gt;</code> | |
| [search](./kibana-plugin-plugins-data-server.isearchstrategy.search.md) | <code>(request: SearchStrategyRequest, options: ISearchOptions, context: RequestHandlerContext) =&gt; Observable&lt;SearchStrategyResponse&gt;</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
search: (context: RequestHandlerContext, request: SearchStrategyRequest, options?: ISearchOptions) => Promise<SearchStrategyResponse>;
search: (request: SearchStrategyRequest, options: ISearchOptions, context: RequestHandlerContext) => Observable<SearchStrategyResponse>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [extract](./kibana-plugin-plugins-expressions-public.executor.extract.md)

## Executor.extract() method

<b>Signature:</b>

```typescript
extract(ast: ExpressionAstExpression): {
state: ExpressionAstExpression;
references: SavedObjectReference[];
};
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>ExpressionAstExpression</code> | |

<b>Returns:</b>

`{
state: ExpressionAstExpression;
references: SavedObjectReference[];
}`

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [inject](./kibana-plugin-plugins-expressions-public.executor.inject.md)

## Executor.inject() method

<b>Signature:</b>

```typescript
inject(ast: ExpressionAstExpression, references: SavedObjectReference[]): ExpressionAstExpression;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>ExpressionAstExpression</code> | |
| references | <code>SavedObjectReference[]</code> | |

<b>Returns:</b>

`ExpressionAstExpression`

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
export declare class Executor<Context extends Record<string, unknown> = Record<string, unknown>>
export declare class Executor<Context extends Record<string, unknown> = Record<string, unknown>> implements PersistableState<ExpressionAstExpression>
```
## Constructors
Expand All @@ -32,12 +32,15 @@ export declare class Executor<Context extends Record<string, unknown> = Record<s
| [createExecution(ast, context, { debug })](./kibana-plugin-plugins-expressions-public.executor.createexecution.md) | | |
| [createWithDefaults(state)](./kibana-plugin-plugins-expressions-public.executor.createwithdefaults.md) | <code>static</code> | |
| [extendContext(extraContext)](./kibana-plugin-plugins-expressions-public.executor.extendcontext.md) | | |
| [extract(ast)](./kibana-plugin-plugins-expressions-public.executor.extract.md) | | |
| [fork()](./kibana-plugin-plugins-expressions-public.executor.fork.md) | | |
| [getFunction(name)](./kibana-plugin-plugins-expressions-public.executor.getfunction.md) | | |
| [getFunctions()](./kibana-plugin-plugins-expressions-public.executor.getfunctions.md) | | |
| [getType(name)](./kibana-plugin-plugins-expressions-public.executor.gettype.md) | | |
| [getTypes()](./kibana-plugin-plugins-expressions-public.executor.gettypes.md) | | |
| [inject(ast, references)](./kibana-plugin-plugins-expressions-public.executor.inject.md) | | |
| [registerFunction(functionDefinition)](./kibana-plugin-plugins-expressions-public.executor.registerfunction.md) | | |
| [registerType(typeDefinition)](./kibana-plugin-plugins-expressions-public.executor.registertype.md) | | |
| [run(ast, input, context)](./kibana-plugin-plugins-expressions-public.executor.run.md) | | Execute expression and return result. |
| [telemetry(ast, telemetryData)](./kibana-plugin-plugins-expressions-public.executor.telemetry.md) | | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [telemetry](./kibana-plugin-plugins-expressions-public.executor.telemetry.md)

## Executor.telemetry() method

<b>Signature:</b>

```typescript
telemetry(ast: ExpressionAstExpression, telemetryData: Record<string, any>): Record<string, any>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>ExpressionAstExpression</code> | |
| telemetryData | <code>Record&lt;string, any&gt;</code> | |

<b>Returns:</b>

`Record<string, any>`

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionAstExpression](./kibana-plugin-plugins-expressions-public.expressionastexpression.md)

## ExpressionAstExpression interface
## ExpressionAstExpression type

<b>Signature:</b>

```typescript
export interface ExpressionAstExpression
export declare type ExpressionAstExpression = {
type: 'expression';
chain: ExpressionAstFunction[];
};
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [chain](./kibana-plugin-plugins-expressions-public.expressionastexpression.chain.md) | <code>ExpressionAstFunction[]</code> | |
| [type](./kibana-plugin-plugins-expressions-public.expressionastexpression.type.md) | <code>'expression'</code> | |

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md)

## ExpressionAstFunction interface
## ExpressionAstFunction type

<b>Signature:</b>

```typescript
export interface ExpressionAstFunction
export declare type ExpressionAstFunction = {
type: 'function';
function: string;
arguments: Record<string, ExpressionAstArgument[]>;
debug?: ExpressionAstFunctionDebug;
};
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [arguments](./kibana-plugin-plugins-expressions-public.expressionastfunction.arguments.md) | <code>Record&lt;string, ExpressionAstArgument[]&gt;</code> | |
| [debug](./kibana-plugin-plugins-expressions-public.expressionastfunction.debug.md) | <code>ExpressionAstFunctionDebug</code> | Debug information added to each function when expression is executed in \*debug mode\*. |
| [function](./kibana-plugin-plugins-expressions-public.expressionastfunction.function.md) | <code>string</code> | |
| [type](./kibana-plugin-plugins-expressions-public.expressionastfunction.type.md) | <code>'function'</code> | |

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionAstFunction](./kibana-plugin-plugins-expressions-public.expressionastfunction.md) &gt; [type](./kibana-plugin-plugins-expressions-public.expressionastfunction.type.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) &gt; [disabled](./kibana-plugin-plugins-expressions-public.expressionfunction.disabled.md)

## ExpressionAstFunction.type property
## ExpressionFunction.disabled property

<b>Signature:</b>

```typescript
type: 'function';
disabled: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionFunction](./kibana-plugin-plugins-expressions-public.expressionfunction.md) &gt; [extract](./kibana-plugin-plugins-expressions-public.expressionfunction.extract.md)

## ExpressionFunction.extract property

<b>Signature:</b>

```typescript
extract: (state: ExpressionAstFunction['arguments']) => {
state: ExpressionAstFunction['arguments'];
references: SavedObjectReference[];
};
```
Loading

0 comments on commit 2c549f0

Please sign in to comment.