Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

「AppArch」Interpreter 👉 New Platform #39329

Merged
merged 45 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6945097
feat: 🎸 set-up NP data plugin
streamich Jun 18, 2019
a3d6d24
refactor: 💡 move interpreter functions registry to NP
streamich Jun 18, 2019
d0df7ed
refactor: 💡 move interpreter renderer registry to NP plugin
streamich Jun 18, 2019
411e598
refactor: 💡 move interpreter typesRegistry to NP
streamich Jun 18, 2019
843fadc
refactor: 💡 move interpreter types to NP
streamich Jun 18, 2019
b1c81ef
chore: 🤖 import typeRegistry from NP and change TS type folder
streamich Jun 18, 2019
cfe9a3d
refactor: 💡 move interpreter expression types to NP
streamich Jun 18, 2019
fd3b0af
refactor: 💡 move rest of interpreter common folder to NP plugin
streamich Jun 18, 2019
521fa8a
fix: 🐛 fix TypeScript errors
streamich Jun 19, 2019
276c712
test: 💍 improve typings and test mocks
streamich Jun 20, 2019
f0f052c
refactor: 💡 make Interpreter internal registry impl private
streamich Jun 20, 2019
c7ad473
test: 💍 inline NP backdoor mock creation in test suites
streamich Jun 20, 2019
d923cf1
chore: 🤖 change @kbn/interpreter import paths to try fix errors
streamich Jun 21, 2019
ae6d23c
Merge branch 'master' of github.com:elastic/kibana into np-interpreter
streamich Jun 21, 2019
1885809
fix: 🐛 improve core Plugin interfaces
streamich Jun 24, 2019
df9ec24
feat: 🎸 add stop() lifecycle to NP data plugins
streamich Jun 24, 2019
d0dc76f
refactor: 💡 move interpreter into expressions service data NP
streamich Jun 24, 2019
9681c1d
refactor: 💡 inline Registry @kbn/interpreter class
streamich Jun 24, 2019
d6ab499
refactor: 💡 remove dependency on @kbn/interpreter in data pub
streamich Jun 24, 2019
24092bf
refactor: 💡 move interpreter common dir into expressions dir
streamich Jun 24, 2019
b744582
fix: 🐛 use TS types in kibana_context
streamich Jun 24, 2019
da5669c
feat: 🎸 add types suggested in PR review
streamich Jun 24, 2019
0127e73
feat: 🎸 add semantic interpreter registration functions
streamich Jun 24, 2019
d7d5eb6
refactor: 💡 use require for all @kbn/interpreter imports
streamich Jun 24, 2019
4f08a6b
Merge branch 'master' of github.com:elastic/kibana into np-interpreter
streamich Jun 24, 2019
6135155
test: 💍 add Karma test mocks, thx @spalger 🙏
streamich Jun 25, 2019
2abb329
docs: ✏️ update Core docs
streamich Jun 25, 2019
f387392
test: 💍 add Sinon stubs for registries
streamich Jun 25, 2019
f246f75
chore: 🤖 change import syntax in hopes CI will work
streamich Jun 26, 2019
678aa59
chore: 🤖 set App Architecture as owners of data plugin
streamich Jun 26, 2019
42db35e
docs: ✏️ add README
streamich Jun 26, 2019
1d1a5a5
chore: 🤖 change import in hopes to fix optimizer
streamich Jun 26, 2019
f8d56d3
Merge branch 'master' of github.com:elastic/kibana into np-interpreter
streamich Jun 26, 2019
e62261c
fix: 🐛 make stop() plugin life-cycle optional
streamich Jun 26, 2019
3b575a1
docs: ✏️ update Core API docs
streamich Jun 26, 2019
2a185bc
Merge branch 'master' of github.com:elastic/kibana into np-interpreter
streamich Jun 27, 2019
82fa012
test: 💍 remove unnecessary Jest mock
streamich Jun 27, 2019
e091557
chore: 🤖 don't import from deeply inside a plugin
streamich Jun 27, 2019
6f2c8d0
Merge remote-tracking branch 'upstream/master' into np-interpreter
streamich Jun 27, 2019
8451af5
refactor: 💡 try different interpreter import
streamich Jun 27, 2019
06dbcfb
fix: 🐛 fix Karma mocking
streamich Jun 27, 2019
b7fbbee
chore: 🤖 resolve merge conflict with master
streamich Jun 28, 2019
3299129
Merge branch 'master' of github.com:elastic/kibana into np-interpreter
streamich Jul 1, 2019
61033e9
fix: 🐛 fix TypeScript type imports
streamich Jul 1, 2019
62b0115
test: 💍 fix broken test
streamich Jul 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# For more info, see https://help.github.com/articles/about-codeowners/

# App Architecture
/src/plugins/data/ @elastic/kibana-app-arch
/src/plugins/kibana_utils/ @elastic/kibana-app-arch

# APM
Expand Down
14 changes: 7 additions & 7 deletions docs/development/core/public/kibana-plugin-public.plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ The interface that should be returned by a `PluginInitializer`<!-- -->.
<b>Signature:</b>

```typescript
export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<string, unknown> = {}, TPluginsStart extends Record<string, unknown> = {}>
export interface Plugin<TSetup = void, TStart = void, TPluginsSetup extends {} = {}, TPluginsStart extends {} = {}>
```

## Properties
## Methods

| Property | Type | Description |
| --- | --- | --- |
| [setup](./kibana-plugin-public.plugin.setup.md) | <code>(core: CoreSetup, plugins: TPluginsSetup) =&gt; TSetup &#124; Promise&lt;TSetup&gt;</code> | |
| [start](./kibana-plugin-public.plugin.start.md) | <code>(core: CoreStart, plugins: TPluginsStart) =&gt; TStart &#124; Promise&lt;TStart&gt;</code> | |
| [stop](./kibana-plugin-public.plugin.stop.md) | <code>() =&gt; void</code> | |
| Method | Description |
| --- | --- |
| [setup(core, plugins)](./kibana-plugin-public.plugin.setup.md) | |
| [start(core, plugins)](./kibana-plugin-public.plugin.start.md) | |
| [stop()](./kibana-plugin-public.plugin.stop.md) | |

16 changes: 14 additions & 2 deletions docs/development/core/public/kibana-plugin-public.plugin.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [Plugin](./kibana-plugin-public.plugin.md) &gt; [setup](./kibana-plugin-public.plugin.setup.md)

## Plugin.setup property
## Plugin.setup() method

<b>Signature:</b>

```typescript
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise<TSetup>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| core | <code>CoreSetup</code> | |
| plugins | <code>TPluginsSetup</code> | |

<b>Returns:</b>

`TSetup | Promise<TSetup>`

16 changes: 14 additions & 2 deletions docs/development/core/public/kibana-plugin-public.plugin.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [Plugin](./kibana-plugin-public.plugin.md) &gt; [start](./kibana-plugin-public.plugin.start.md)

## Plugin.start property
## Plugin.start() method

<b>Signature:</b>

```typescript
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
start(core: CoreStart, plugins: TPluginsStart): TStart | Promise<TStart>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| core | <code>CoreStart</code> | |
| plugins | <code>TPluginsStart</code> | |

<b>Returns:</b>

`TStart | Promise<TStart>`

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [Plugin](./kibana-plugin-public.plugin.md) &gt; [stop](./kibana-plugin-public.plugin.stop.md)

## Plugin.stop property
## Plugin.stop() method

<b>Signature:</b>

```typescript
stop?: () => void;
stop?(): void;
```
<b>Returns:</b>

`void`

14 changes: 7 additions & 7 deletions docs/development/core/server/kibana-plugin-server.plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ The interface that should be returned by a `PluginInitializer`<!-- -->.
<b>Signature:</b>

```typescript
export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<PluginName, unknown> = {}, TPluginsStart extends Record<PluginName, unknown> = {}>
export interface Plugin<TSetup = void, TStart = void, TPluginsSetup extends {} = {}, TPluginsStart extends {} = {}>
```

## Properties
## Methods

| Property | Type | Description |
| --- | --- | --- |
| [setup](./kibana-plugin-server.plugin.setup.md) | <code>(core: CoreSetup, plugins: TPluginsSetup) =&gt; TSetup &#124; Promise&lt;TSetup&gt;</code> | |
| [start](./kibana-plugin-server.plugin.start.md) | <code>(core: CoreStart, plugins: TPluginsStart) =&gt; TStart &#124; Promise&lt;TStart&gt;</code> | |
| [stop](./kibana-plugin-server.plugin.stop.md) | <code>() =&gt; void</code> | |
| Method | Description |
| --- | --- |
| [setup(core, plugins)](./kibana-plugin-server.plugin.setup.md) | |
| [start(core, plugins)](./kibana-plugin-server.plugin.start.md) | |
| [stop()](./kibana-plugin-server.plugin.stop.md) | |

16 changes: 14 additions & 2 deletions docs/development/core/server/kibana-plugin-server.plugin.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Plugin](./kibana-plugin-server.plugin.md) &gt; [setup](./kibana-plugin-server.plugin.setup.md)

## Plugin.setup property
## Plugin.setup() method

<b>Signature:</b>

```typescript
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise<TSetup>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| core | <code>CoreSetup</code> | |
| plugins | <code>TPluginsSetup</code> | |

<b>Returns:</b>

`TSetup | Promise<TSetup>`

16 changes: 14 additions & 2 deletions docs/development/core/server/kibana-plugin-server.plugin.start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Plugin](./kibana-plugin-server.plugin.md) &gt; [start](./kibana-plugin-server.plugin.start.md)

## Plugin.start property
## Plugin.start() method

<b>Signature:</b>

```typescript
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
start(core: CoreStart, plugins: TPluginsStart): TStart | Promise<TStart>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| core | <code>CoreStart</code> | |
| plugins | <code>TPluginsStart</code> | |

<b>Returns:</b>

`TStart | Promise<TStart>`

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Plugin](./kibana-plugin-server.plugin.md) &gt; [stop](./kibana-plugin-server.plugin.stop.md)

## Plugin.stop property
## Plugin.stop() method

<b>Signature:</b>

```typescript
stop?: () => void;
stop?(): void;
```
<b>Returns:</b>

`void`

14 changes: 7 additions & 7 deletions src/core/public/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import { CoreStart, CoreSetup } from '..';
* @public
*/
export interface Plugin<
TSetup,
TStart,
TPluginsSetup extends Record<string, unknown> = {},
TPluginsStart extends Record<string, unknown> = {}
TSetup = void,
TStart = void,
TPluginsSetup extends {} = {},
TPluginsStart extends {} = {}
> {
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
stop?: () => void;
setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise<TSetup>;
start(core: CoreStart, plugins: TPluginsStart): TStart | Promise<TStart>;
stop?(): void;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,13 @@ export interface OverlayStart {
}

// @public
export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<string, unknown> = {}, TPluginsStart extends Record<string, unknown> = {}> {
export interface Plugin<TSetup = void, TStart = void, TPluginsSetup extends {} = {}, TPluginsStart extends {} = {}> {
// (undocumented)
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise<TSetup>;
// (undocumented)
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
start(core: CoreStart, plugins: TPluginsStart): TStart | Promise<TStart>;
// (undocumented)
stop?: () => void;
stop?(): void;
}

// @public
Expand Down
14 changes: 7 additions & 7 deletions src/core/server/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ export interface DiscoveredPluginInternal extends DiscoveredPlugin {
* @public
*/
export interface Plugin<
TSetup,
TStart,
TPluginsSetup extends Record<PluginName, unknown> = {},
TPluginsStart extends Record<PluginName, unknown> = {}
Copy link
Contributor

@joshdover joshdover Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Record<PluginName, unknown> is more explicit that the keys will be strings and forces you to construct your own type to deal with unknown.

Copy link
Contributor Author

@streamich streamich Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... explicit that the keys will be strings ...

Exactly, but Record does not just say that keys can be strings, but that any string is a valid key. Whereas if you extend {} you must specify the exact valid properties (not strings).

image

So basically in the screenshot above you can see TypeScript allowing to give "non-existing" a.foo to some JavaScript function (which I believe should be an error, if that a was a plugin contract). But it shows an error if you try the same with b.foo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there is no PluginName alias in ./public.

Is PlaginName always intended to just be an alias for string?

/**
 * Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays
 * that use it as a key or value more obvious.
 *
 * @public
 */
export type PluginName = string;

If it was somehow possible to narrow it down.

export type PluginName = 'apm' | 'data' | 'canvas' | ... ;

Although there could be 3rd party plugins. And this would need to be auto-generated somehow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, but Record does not just say that keys can be strings, but that any string is a valid key. Whereas if you extend {} you must specify the exact valid properties (not strings).

So basically in the screenshot above you can see TypeScript allowing to give "non-existing" a.foo to some JavaScript function (which I believe should be an error, if that a was a plugin contract). But it shows an error if you try the same with b.foo.

This is true but it's also true that you can't do anything useful with unknown. You can't pass it to a function or access any of it's properties without getting an error. The only thing this change does is remove information that the keys of the plugins argument will be PluginName. I prefer that this information be retained.

Is PluginName always intended to just be an alias for string?
If it was somehow possible to narrow it down.

We can't do this currently because we can't mix x-pack and OSS code. Maybe we could find a way to generate this, but I don't think it's particularly useful right now.

One way we could make this more useful is with an interface of default types that can be re-opened / merged by plugins.

interface PluginsStart {
  [pluginName: PluginName]: unknown;
}

// Each plugin can "reopen" this interface
declare module '../../src/core/public' {
  interface PluginsStart {
    timepicker?: TimepickerStart;
  }
}

// Dependent plugins could then declare which dependencies are available
// This would have to be manually kept in sync with the plugin's kibana.json
type RequiredDeps = 'data' | 'timepicker';
type OptionalDeps = 'telemetry';
type MyPluginsStart =
  Required<Pick<PluginsStart, RequiredDeps>> &
  Partial<Pick<PluginsStart, OptionalDeps>>;
// => { data: DataStart, timepicker: TimepickerStart, telemetry?: TelemetryStart }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could even provide a generic type for generating this:

type AvailablePluginsStart<Req extends keyof PluginsStart = never, Opt extends keyof PluginsStart = never>
  = Required<Pick<PluginsStart, Req>> & Partial<Pick<PluginsStart, Opt>>;

type MyPluginsStart = AvailablePluginsStart<'data' | 'timepicker', 'telemetry'>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[..] You can't pass it to a function or access any of it's properties without getting an error. [..]

I was trying to show in my example above that you can pass it to a function.

Here is another concrete example from Core's source code. If you use Record, you can pass anything to a function, because Record<string, ...> means any property is valid:

image

Whereas, if you restrict the TPluginSetup type, you get an error when you want to access property that does not exist:

image

Note, this change still allows the rest of code work as before. Is there anything you cannot achieve with {} which you can with Recrod<string, ...>?

Copy link
Contributor

@mshustov mshustov Jul 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use Record, you can pass anything to a function, because Record<string, ...> means any property is valid:

Not really. that works due to lax of type signature alert(message?: any). A function with strict arguments will have TS error.
2019-07-01_15-52-45

I don't see any harm to add your changes to Plugin type definitions. Could you update other related files to unify Setup/Start signatures?
1
2
3

Copy link
Contributor Author

@streamich streamich Jul 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. that works due to lax of type signature alert(message?: any).

That's the whole point, you rely on the fact that the other function will "type check" the property. But plugins object itself allows to access any property. If the other function, for example, is a JavaScript function without a type signature, it happily accepts that property.

Could you update other related files to unify Setup/Start signatures?

Yes. Do you mean all TPluginsSetup and TPluginsStart types in those files?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Do you mean all TPluginsSetup and TPluginsStart types in those files?

correct

TSetup = void,
TStart = void,
TPluginsSetup extends {} = {},
TPluginsStart extends {} = {}
> {
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
stop?: () => void;
setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise<TSetup>;
start(core: CoreStart, plugins: TPluginsStart): TStart | Promise<TStart>;
stop?(): void;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ export interface OnPreAuthToolkit {
}

// @public
export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<PluginName, unknown> = {}, TPluginsStart extends Record<PluginName, unknown> = {}> {
export interface Plugin<TSetup = void, TStart = void, TPluginsSetup extends {} = {}, TPluginsStart extends {} = {}> {
// (undocumented)
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup(core: CoreSetup, plugins: TPluginsSetup): TSetup | Promise<TSetup>;
// (undocumented)
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
start(core: CoreStart, plugins: TPluginsStart): TStart | Promise<TStart>;
// (undocumented)
stop?: () => void;
stop?(): void;
}

// @public
Expand Down
5 changes: 1 addition & 4 deletions src/legacy/core_plugins/data/public/query/query_bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,4 @@ export { getQueryLog } from './lib/get_query_log';
// @ts-ignore
export { setupDirective } from './directive';

export interface Query {
query: string | { [key: string]: any };
language: string;
}
export { Query } from '../../../../../../plugins/data/common/query/types';
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import { functionWrapper } from '../../interpreter/test_helpers';
import { inputControlVis } from './input_control_fn';

jest.mock('ui/new_platform', () => require('../../../ui/public/new_platform/index.test.mocks').mockNewPlatformBackdoor());

describe('interpreter/functions#input_control_vis', () => {
const fn = functionWrapper(inputControlVis);
const visConfig = {
Expand Down
8 changes: 7 additions & 1 deletion src/legacy/core_plugins/interpreter/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ export {
PointSeriesColumnName,
Render,
Style,
} from './types';
} from '../../../../plugins/data/common/expressions/expression_types';
export const API_ROUTE = '/api/interpreter';
export * from '../../../../plugins/data/common/expressions/serialize_provider';
export { Type } from '../../../../plugins/data/common/expressions/interpreter';
export {
interpreterProvider,
} from '../../../../plugins/data/common/expressions/interpreter_provider';
25 changes: 18 additions & 7 deletions src/legacy/core_plugins/interpreter/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,31 @@
* under the License.
*/

/* eslint-disable max-classes-per-file */

// @ts-ignore
import { register, registryFactory } from '@kbn/interpreter/common';
import { register, registryFactory, Registry, Fn } from '@kbn/interpreter/common';

// @ts-ignore
import { routes } from './server/routes';

// @ts-ignore
import { typeSpecs as types } from '../../../plugins/data/common/expressions/expression_types';

import { Type } from './common';
import { Legacy } from '../../../../kibana';

// @ts-ignore
import { FunctionsRegistry } from './common/functions_registry';
// @ts-ignore
import { typeSpecs as types } from './common/types';
// @ts-ignore
import { TypesRegistry } from './common/types_registry';
export class TypesRegistry extends Registry<any, any> {
wrapper(obj: any) {
return new (Type as any)(obj);
}
}

export class FunctionsRegistry extends Registry<any, any> {
streamich marked this conversation as resolved.
Show resolved Hide resolved
wrapper(obj: any) {
return new Fn(obj);
}
}

export const registries = {
types: new TypesRegistry(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const courierRequestHandlerProvider = CourierRequestHandlerProvider;
const courierRequestHandler = courierRequestHandlerProvider().handler;

import { ExpressionFunction } from '../../types';
import { KibanaContext, KibanaDatatable } from '../../common/types';
import { KibanaContext, KibanaDatatable } from '../../common';

const name = 'esaggs';

Expand Down
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/interpreter/public/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { kfetch } from 'ui/kfetch';
import { ajaxStream } from 'ui/ajax_stream';
import { functions } from './functions';
import { visualization } from './renderers/visualization';
import { typeSpecs } from '../common/types';
import { typeSpecs } from '../../../../plugins/data/common/expressions/expression_types';

// Expose kbnInterpreter.register(specs) and kbnInterpreter.registries() globally so that plugins
// can register without a transpile step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* under the License.
*/

import { interpreterProvider } from '../../common/interpreter/interpret';
import { serializeProvider } from '../../common/serialize';
import { interpreterProvider, serializeProvider } from '../../common';
import { createHandlers } from './create_handlers';
import { batchedFetch } from './batched_fetch';
import { FUNCTIONS_URL } from './consts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
import { FUNCTIONS_URL } from './consts';
import { initializeInterpreter } from './interpreter';

jest.mock('../../common/interpreter/interpret', () => ({
interpreterProvider: () => () => ({}),
}));

jest.mock('../../common/serialize', () => ({
jest.mock('../../common', () => ({
streamich marked this conversation as resolved.
Show resolved Hide resolved
serializeProvider: () => ({ serialize: () => ({}) }),
}));

Expand Down
Loading