Skip to content

Commit

Permalink
[expressions] AST Builder (elastic#64395) (elastic#71778)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
lukeelmers and elasticmachine authored Jul 18, 2020
1 parent 0ddc7f7 commit 1e49c68
Show file tree
Hide file tree
Showing 31 changed files with 1,478 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esaggsexpressionfunctiondefinition.md)

## EsaggsExpressionFunctionDefinition type

<b>Signature:</b>

```typescript
export declare type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'esaggs', Input, Arguments, Output>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
| [AggGroupName](./kibana-plugin-plugins-data-public.agggroupname.md) | |
| [AggParam](./kibana-plugin-plugins-data-public.aggparam.md) | |
| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | |
| [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-public.esaggsexpressionfunctiondefinition.md) | |
| [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | |
| [ExistsFilter](./kibana-plugin-plugins-data-public.existsfilter.md) | |
| [FieldFormatId](./kibana-plugin-plugins-data-public.fieldformatid.md) | id type is needed for creating custom converters. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) &gt; [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-server.esaggsexpressionfunctiondefinition.md)

## EsaggsExpressionFunctionDefinition type

<b>Signature:</b>

```typescript
export declare type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'esaggs', Input, Arguments, Output>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

| Type Alias | Description |
| --- | --- |
| [EsaggsExpressionFunctionDefinition](./kibana-plugin-plugins-data-server.esaggsexpressionfunctiondefinition.md) | |
| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-server.fieldformatsgetconfigfn.md) | |
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | |
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ export * from './kbn_field_types';
export * from './query';
export * from './search';
export * from './search/aggs';
export * from './search/expressions';
export * from './types';
export * from './utils';
43 changes: 43 additions & 0 deletions src/plugins/data/common/search/expressions/esaggs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import {
KibanaContext,
KibanaDatatable,
ExpressionFunctionDefinition,
} from '../../../../../plugins/expressions/common';

type Input = KibanaContext | null;
type Output = Promise<KibanaDatatable>;

interface Arguments {
index: string;
metricsAtAllLevels: boolean;
partialRows: boolean;
includeFormatHints: boolean;
aggConfigs: string;
timeFields?: string[];
}

export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<
'esaggs',
Input,
Arguments,
Output
>;
20 changes: 20 additions & 0 deletions src/plugins/data/common/search/expressions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export * from './esaggs';
2 changes: 1 addition & 1 deletion src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ import {
toAbsoluteDates,
} from '../common';

export { ParsedInterval } from '../common';
export { EsaggsExpressionFunctionDefinition, ParsedInterval } from '../common';

export {
// aggs
Expand Down
13 changes: 12 additions & 1 deletion src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { EuiButtonEmptyProps } from '@elastic/eui';
import { EuiComboBoxProps } from '@elastic/eui';
import { EuiConfirmModalProps } from '@elastic/eui';
import { EuiGlobalToastListToast } from '@elastic/eui';
import { EventEmitter } from 'events';
import { ExclusiveUnion } from '@elastic/eui';
import { ExistsParams } from 'elasticsearch';
import { ExplainParams } from 'elasticsearch';
Expand Down Expand Up @@ -147,7 +148,7 @@ import { ReindexRethrottleParams } from 'elasticsearch';
import { RenderSearchTemplateParams } from 'elasticsearch';
import { Reporter } from '@kbn/analytics';
import { RequestAdapter } from 'src/plugins/inspector/common';
import { RequestStatistics } from 'src/plugins/inspector/common';
import { RequestStatistics as RequestStatistics_2 } from 'src/plugins/inspector/common';
import { Required } from '@kbn/utility-types';
import * as Rx from 'rxjs';
import { SavedObject } from 'src/core/server';
Expand Down Expand Up @@ -182,6 +183,7 @@ import { UiActionsSetup } from 'src/plugins/ui_actions/public';
import { UiActionsStart } from 'src/plugins/ui_actions/public';
import { Unit } from '@elastic/datemath';
import { UnregisterCallback } from 'history';
import { UnwrapPromiseOrReturn } from '@kbn/utility-types';
import { UpdateDocumentByQueryParams } from 'elasticsearch';
import { UpdateDocumentParams } from 'elasticsearch';
import { UserProvidedValues } from 'src/core/server/types';
Expand Down Expand Up @@ -441,6 +443,15 @@ export enum ES_FIELD_TYPES {
// @public (undocumented)
export const ES_SEARCH_STRATEGY = "es";

// Warning: (ae-forgotten-export) The symbol "ExpressionFunctionDefinition" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Input" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Output" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EsaggsExpressionFunctionDefinition" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'esaggs', Input, Arguments, Output>;

// Warning: (ae-missing-release-tag) "esFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down
23 changes: 4 additions & 19 deletions src/plugins/data/public/search/expressions/esaggs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@

import { get, hasIn } from 'lodash';
import { i18n } from '@kbn/i18n';
import {
KibanaContext,
KibanaDatatable,
ExpressionFunctionDefinition,
KibanaDatatableColumn,
} from 'src/plugins/expressions/public';

import { KibanaDatatable, KibanaDatatableColumn } from 'src/plugins/expressions/public';
import { calculateObjectHash } from '../../../../../plugins/kibana_utils/public';
import { PersistedState } from '../../../../../plugins/visualizations/public';
import { Adapters } from '../../../../../plugins/inspector/public';
Expand All @@ -34,6 +30,7 @@ import { ISearchSource } from '../search_source';
import { tabifyAggResponse } from '../tabify';
import {
calculateBounds,
EsaggsExpressionFunctionDefinition,
Filter,
getTime,
IIndexPattern,
Expand Down Expand Up @@ -71,18 +68,6 @@ export interface RequestHandlerParams {

const name = 'esaggs';

type Input = KibanaContext | null;
type Output = Promise<KibanaDatatable>;

interface Arguments {
index: string;
metricsAtAllLevels: boolean;
partialRows: boolean;
includeFormatHints: boolean;
aggConfigs: string;
timeFields?: string[];
}

const handleCourierRequest = async ({
searchSource,
aggs,
Expand Down Expand Up @@ -244,7 +229,7 @@ const handleCourierRequest = async ({
return (searchSource as any).tabifiedResponse;
};

export const esaggs = (): ExpressionFunctionDefinition<typeof name, Input, Arguments, Output> => ({
export const esaggs = (): EsaggsExpressionFunctionDefinition => ({
name,
type: 'kibana_datatable',
inputTypes: ['kibana_context', 'null'],
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ import {
toAbsoluteDates,
} from '../common';

export { ParsedInterval } from '../common';
export { EsaggsExpressionFunctionDefinition, ParsedInterval } from '../common';

export {
ISearchStrategy,
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/data/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { DeleteTemplateParams } from 'elasticsearch';
import { DetailedPeerCertificate } from 'tls';
import { Duration } from 'moment';
import { ErrorToastOptions } from 'src/core/public/notifications';
import { EventEmitter } from 'events';
import { ExistsParams } from 'elasticsearch';
import { ExplainParams } from 'elasticsearch';
import { FieldStatsParams } from 'elasticsearch';
Expand Down Expand Up @@ -146,6 +147,7 @@ import { ToastInputFields } from 'src/core/public/notifications';
import { Type } from '@kbn/config-schema';
import { TypeOf } from '@kbn/config-schema';
import { Unit } from '@elastic/datemath';
import { UnwrapPromiseOrReturn } from '@kbn/utility-types';
import { UpdateDocumentByQueryParams } from 'elasticsearch';
import { UpdateDocumentParams } from 'elasticsearch';
import { Url } from 'url';
Expand Down Expand Up @@ -220,6 +222,15 @@ export enum ES_FIELD_TYPES {
_TYPE = "_type"
}

// Warning: (ae-forgotten-export) The symbol "ExpressionFunctionDefinition" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Input" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Arguments" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Output" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EsaggsExpressionFunctionDefinition" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type EsaggsExpressionFunctionDefinition = ExpressionFunctionDefinition<'esaggs', Input, Arguments, Output>;

// Warning: (ae-missing-release-tag) "esFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down
Loading

0 comments on commit 1e49c68

Please sign in to comment.