Improved exports of expressions plugin (#45538)
* Improved exports of expressions plugin * typo * Remove unused interfaces
This commit is contained in:
parent
b5fc70e013
commit
090a4073cf
|
@ -19,3 +19,4 @@
|
|||
|
||||
export { ExpressionsService, ExpressionsSetup, ExpressionsStart } from './expressions_service';
|
||||
export { ExpressionRenderer, ExpressionRendererProps } from './expression_renderer';
|
||||
export { IInterpreterRenderFunction } from './lib/_types';
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
*/
|
||||
|
||||
// /// Define plugin function
|
||||
import {
|
||||
DataExpressionsPlugin as Plugin,
|
||||
DataExpressionsSetup,
|
||||
DataExpressionsStart,
|
||||
} from './plugin';
|
||||
import { ExpressionsPlugin as Plugin } from './plugin';
|
||||
|
||||
export function plugin() {
|
||||
return new Plugin();
|
||||
|
@ -31,7 +27,4 @@ export function plugin() {
|
|||
// /// Export types & static code
|
||||
|
||||
/** @public types */
|
||||
export type DataExpressionsSetup = DataExpressionsSetup;
|
||||
export type DataExpressionsStart = DataExpressionsStart;
|
||||
|
||||
export { ExpressionRenderer, ExpressionRendererProps } from './expressions';
|
||||
export * from './expressions';
|
||||
|
|
|
@ -17,19 +17,21 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { DataExpressionsSetup } from '.';
|
||||
import { ExpressionsSetup, ExpressionsStart } from '.';
|
||||
|
||||
function createExpressionsSetupMock() {
|
||||
const mock: MockedKeys<Partial<DataExpressionsSetup>> = {};
|
||||
const mock: MockedKeys<Partial<ExpressionsSetup>> = {};
|
||||
|
||||
return mock;
|
||||
}
|
||||
|
||||
function createExpressionsStartMock() {
|
||||
return {};
|
||||
const mock: MockedKeys<Partial<ExpressionsStart>> = {};
|
||||
|
||||
return mock;
|
||||
}
|
||||
|
||||
export const dataPluginMock = {
|
||||
export const expressionsPluginMock = {
|
||||
createSetup: createExpressionsSetupMock,
|
||||
createStart: createExpressionsStartMock,
|
||||
};
|
||||
|
|
|
@ -29,11 +29,11 @@ import {
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface DataExpressionsPluginSetupDependencies {
|
||||
export interface ExpressionsPluginSetupDependencies {
|
||||
inspector: InspectorSetup;
|
||||
}
|
||||
|
||||
export interface DataExpressionsPluginStartDependencies {
|
||||
export interface ExpressionsPluginStartDependencies {
|
||||
inspector: InspectorStart;
|
||||
}
|
||||
|
||||
|
@ -42,32 +42,27 @@ export interface DataExpressionsPluginStartDependencies {
|
|||
*
|
||||
* @public
|
||||
*/
|
||||
export interface DataExpressionsSetup {
|
||||
expressions: ExpressionsSetup;
|
||||
}
|
||||
|
||||
export interface DataExpressionsStart {
|
||||
expressions: ExpressionsStart;
|
||||
}
|
||||
|
||||
export class DataExpressionsPlugin
|
||||
export class ExpressionsPlugin
|
||||
implements
|
||||
Plugin<DataExpressionsSetup, DataExpressionsStart, DataExpressionsPluginSetupDependencies> {
|
||||
Plugin<
|
||||
ExpressionsSetup,
|
||||
ExpressionsStart,
|
||||
ExpressionsPluginSetupDependencies,
|
||||
ExpressionsPluginStartDependencies
|
||||
> {
|
||||
// Exposed services, sorted alphabetically
|
||||
private readonly expressions: ExpressionsService = new ExpressionsService();
|
||||
|
||||
public setup(core: CoreSetup): DataExpressionsSetup {
|
||||
public setup(core: CoreSetup): ExpressionsSetup {
|
||||
return {
|
||||
expressions: this.expressions.setup(),
|
||||
...this.expressions.setup(),
|
||||
};
|
||||
}
|
||||
|
||||
public start(
|
||||
core: CoreStart,
|
||||
plugins: DataExpressionsPluginStartDependencies
|
||||
): DataExpressionsStart {
|
||||
public start(core: CoreStart, plugins: ExpressionsPluginStartDependencies): ExpressionsStart {
|
||||
return {
|
||||
expressions: this.expressions.start({ inspector: plugins.inspector }),
|
||||
...this.expressions.start({ inspector: plugins.inspector }),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue