[7.x] Consolidate Plugin{Setup,Start}Context and Core{Setup,Start} (#36732) (#36917)

This commit is contained in:
Josh Dover 2019-05-22 16:55:59 -05:00 committed by GitHub
parent 7e7cde0ac2
commit ba94f72bde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
87 changed files with 312 additions and 897 deletions

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [application](./kibana-plugin-public.coresetup.application.md)
## CoreSetup.application property
[ApplicationSetup](./kibana-plugin-public.applicationsetup.md)
<b>Signature:</b>
```typescript
application: ApplicationSetup;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [injectedMetadata](./kibana-plugin-public.coresetup.injectedmetadata.md)
## CoreSetup.injectedMetadata property
[InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md)
<b>Signature:</b>
```typescript
injectedMetadata: InjectedMetadataSetup;
```

View file

@ -4,7 +4,7 @@
## CoreSetup interface
Core services exposed to the setup lifecycle
Core services exposed to the `Plugin` setup lifecycle
<b>Signature:</b>
@ -16,13 +16,11 @@ export interface CoreSetup
| Property | Type | Description |
| --- | --- | --- |
| [application](./kibana-plugin-public.coresetup.application.md) | <code>ApplicationSetup</code> | [ApplicationSetup](./kibana-plugin-public.applicationsetup.md) |
| [basePath](./kibana-plugin-public.coresetup.basepath.md) | <code>BasePathSetup</code> | [BasePathSetup](./kibana-plugin-public.basepathsetup.md) |
| [chrome](./kibana-plugin-public.coresetup.chrome.md) | <code>ChromeSetup</code> | [ChromeSetup](./kibana-plugin-public.chromesetup.md) |
| [fatalErrors](./kibana-plugin-public.coresetup.fatalerrors.md) | <code>FatalErrorsSetup</code> | [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) |
| [http](./kibana-plugin-public.coresetup.http.md) | <code>HttpSetup</code> | [HttpSetup](./kibana-plugin-public.httpsetup.md) |
| [i18n](./kibana-plugin-public.coresetup.i18n.md) | <code>I18nSetup</code> | [I18nSetup](./kibana-plugin-public.i18nsetup.md) |
| [injectedMetadata](./kibana-plugin-public.coresetup.injectedmetadata.md) | <code>InjectedMetadataSetup</code> | [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) |
| [notifications](./kibana-plugin-public.coresetup.notifications.md) | <code>NotificationsSetup</code> | [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) |
| [uiSettings](./kibana-plugin-public.coresetup.uisettings.md) | <code>UiSettingsSetup</code> | [UiSettingsSetup](./kibana-plugin-public.uisettingssetup.md) |

View file

@ -9,5 +9,5 @@
<b>Signature:</b>
```typescript
application: ApplicationStart;
application: Pick<ApplicationStart, 'capabilities'>;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreStart](./kibana-plugin-public.corestart.md) &gt; [injectedMetadata](./kibana-plugin-public.corestart.injectedmetadata.md)
## CoreStart.injectedMetadata property
[InjectedMetadataStart](./kibana-plugin-public.injectedmetadatastart.md)
<b>Signature:</b>
```typescript
injectedMetadata: InjectedMetadataStart;
```

View file

@ -4,7 +4,7 @@
## CoreStart interface
Core services exposed to the start lifecycle
Core services exposed to the `Plugin` start lifecycle
<b>Signature:</b>
@ -16,12 +16,11 @@ export interface CoreStart
| Property | Type | Description |
| --- | --- | --- |
| [application](./kibana-plugin-public.corestart.application.md) | <code>ApplicationStart</code> | [ApplicationStart](./kibana-plugin-public.applicationstart.md) |
| [application](./kibana-plugin-public.corestart.application.md) | <code>Pick&lt;ApplicationStart, 'capabilities'&gt;</code> | [ApplicationStart](./kibana-plugin-public.applicationstart.md) |
| [basePath](./kibana-plugin-public.corestart.basepath.md) | <code>BasePathStart</code> | [BasePathStart](./kibana-plugin-public.basepathstart.md) |
| [chrome](./kibana-plugin-public.corestart.chrome.md) | <code>ChromeStart</code> | [ChromeStart](./kibana-plugin-public.chromestart.md) |
| [http](./kibana-plugin-public.corestart.http.md) | <code>HttpStart</code> | [HttpStart](./kibana-plugin-public.httpstart.md) |
| [i18n](./kibana-plugin-public.corestart.i18n.md) | <code>I18nStart</code> | [I18nStart](./kibana-plugin-public.i18nstart.md) |
| [injectedMetadata](./kibana-plugin-public.corestart.injectedmetadata.md) | <code>InjectedMetadataStart</code> | [InjectedMetadataStart](./kibana-plugin-public.injectedmetadatastart.md) |
| [notifications](./kibana-plugin-public.corestart.notifications.md) | <code>NotificationsStart</code> | [NotificationsStart](./kibana-plugin-public.notificationsstart.md) |
| [overlays](./kibana-plugin-public.corestart.overlays.md) | <code>OverlayStart</code> | [OverlayStart](./kibana-plugin-public.overlaystart.md) |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getBasePath](./kibana-plugin-public.injectedmetadatasetup.getbasepath.md)
## InjectedMetadataSetup.getBasePath property
<b>Signature:</b>
```typescript
getBasePath: () => string;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getCapabilities](./kibana-plugin-public.injectedmetadatasetup.getcapabilities.md)
## InjectedMetadataSetup.getCapabilities property
<b>Signature:</b>
```typescript
getCapabilities: () => Capabilities;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getCspConfig](./kibana-plugin-public.injectedmetadatasetup.getcspconfig.md)
## InjectedMetadataSetup.getCspConfig property
<b>Signature:</b>
```typescript
getCspConfig: () => {
warnLegacyBrowsers: boolean;
};
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getInjectedVar](./kibana-plugin-public.injectedmetadatasetup.getinjectedvar.md)
## InjectedMetadataSetup.getInjectedVar property
<b>Signature:</b>
```typescript
getInjectedVar: (name: string, defaultValue?: any) => unknown;
```

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getInjectedVars](./kibana-plugin-public.injectedmetadatasetup.getinjectedvars.md)
## InjectedMetadataSetup.getInjectedVars property
<b>Signature:</b>
```typescript
getInjectedVars: () => {
[key: string]: unknown;
};
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getKibanaBuildNumber](./kibana-plugin-public.injectedmetadatasetup.getkibanabuildnumber.md)
## InjectedMetadataSetup.getKibanaBuildNumber property
<b>Signature:</b>
```typescript
getKibanaBuildNumber: () => number;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getKibanaVersion](./kibana-plugin-public.injectedmetadatasetup.getkibanaversion.md)
## InjectedMetadataSetup.getKibanaVersion property
<b>Signature:</b>
```typescript
getKibanaVersion: () => string;
```

View file

@ -1,27 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getLegacyMetadata](./kibana-plugin-public.injectedmetadatasetup.getlegacymetadata.md)
## InjectedMetadataSetup.getLegacyMetadata property
<b>Signature:</b>
```typescript
getLegacyMetadata: () => {
app: unknown;
translations: unknown;
bundleId: string;
nav: LegacyNavLink[];
version: string;
branch: string;
buildNum: number;
buildSha: string;
basePath: string;
serverName: string;
devMode: boolean;
uiSettings: {
defaults: UiSettingsState;
user?: UiSettingsState | undefined;
};
};
```

View file

@ -1,16 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) &gt; [getPlugins](./kibana-plugin-public.injectedmetadatasetup.getplugins.md)
## InjectedMetadataSetup.getPlugins property
An array of frontend plugins in topological order.
<b>Signature:</b>
```typescript
getPlugins: () => Array<{
id: string;
plugin: DiscoveredPlugin;
}>;
```

View file

@ -1,28 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md)
## InjectedMetadataSetup interface
Provides access to the metadata injected by the server into the page
<b>Signature:</b>
```typescript
export interface InjectedMetadataSetup
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [getBasePath](./kibana-plugin-public.injectedmetadatasetup.getbasepath.md) | <code>() =&gt; string</code> | |
| [getCapabilities](./kibana-plugin-public.injectedmetadatasetup.getcapabilities.md) | <code>() =&gt; Capabilities</code> | |
| [getCspConfig](./kibana-plugin-public.injectedmetadatasetup.getcspconfig.md) | <code>() =&gt; {`<p/>` warnLegacyBrowsers: boolean;`<p/>` }</code> | |
| [getInjectedVar](./kibana-plugin-public.injectedmetadatasetup.getinjectedvar.md) | <code>(name: string, defaultValue?: any) =&gt; unknown</code> | |
| [getInjectedVars](./kibana-plugin-public.injectedmetadatasetup.getinjectedvars.md) | <code>() =&gt; {`<p/>` [key: string]: unknown;`<p/>` }</code> | |
| [getKibanaBuildNumber](./kibana-plugin-public.injectedmetadatasetup.getkibanabuildnumber.md) | <code>() =&gt; number</code> | |
| [getKibanaVersion](./kibana-plugin-public.injectedmetadatasetup.getkibanaversion.md) | <code>() =&gt; string</code> | |
| [getLegacyMetadata](./kibana-plugin-public.injectedmetadatasetup.getlegacymetadata.md) | <code>() =&gt; {`<p/>` app: unknown;`<p/>` translations: unknown;`<p/>` bundleId: string;`<p/>` nav: LegacyNavLink[];`<p/>` version: string;`<p/>` branch: string;`<p/>` buildNum: number;`<p/>` buildSha: string;`<p/>` basePath: string;`<p/>` serverName: string;`<p/>` devMode: boolean;`<p/>` uiSettings: {`<p/>` defaults: UiSettingsState;`<p/>` user?: UiSettingsState &#124; undefined;`<p/>` };`<p/>` }</code> | |
| [getPlugins](./kibana-plugin-public.injectedmetadatasetup.getplugins.md) | <code>() =&gt; Array&lt;{`<p/>` id: string;`<p/>` plugin: DiscoveredPlugin;`<p/>` }&gt;</code> | An array of frontend plugins in topological order. |

View file

@ -1,12 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataStart](./kibana-plugin-public.injectedmetadatastart.md)
## InjectedMetadataStart type
<b>Signature:</b>
```typescript
export declare type InjectedMetadataStart = InjectedMetadataSetup;
```

View file

@ -4,6 +4,12 @@
## kibana-plugin-public package
The Kibana Core APIs for client-side plugins.
A plugin's `public/index` file must contain a named import, `plugin`<!-- -->, that implements [PluginInitializer](./kibana-plugin-public.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-public.plugin.md)<!-- -->.
The plugin integrates with the core system via lifecycle events: `setup`<!-- -->, `start`<!-- -->, and `stop`<!-- -->. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-public.coresetup.md) or [CoreStart](./kibana-plugin-public.corestart.md)<!-- -->) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked.
## Classes
| Class | Description |
@ -23,20 +29,17 @@
| [ChromeBrand](./kibana-plugin-public.chromebrand.md) | |
| [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) | |
| [ChromeNavLink](./kibana-plugin-public.chromenavlink.md) | |
| [CoreSetup](./kibana-plugin-public.coresetup.md) | Core services exposed to the setup lifecycle |
| [CoreStart](./kibana-plugin-public.corestart.md) | Core services exposed to the start lifecycle |
| [CoreSetup](./kibana-plugin-public.coresetup.md) | Core services exposed to the <code>Plugin</code> setup lifecycle |
| [CoreStart](./kibana-plugin-public.corestart.md) | Core services exposed to the <code>Plugin</code> start lifecycle |
| [FatalErrorInfo](./kibana-plugin-public.fatalerrorinfo.md) | Represents the <code>message</code> and <code>stack</code> of a fatal Error |
| [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
| [I18nSetup](./kibana-plugin-public.i18nsetup.md) | I18nSetup.Context is required by any localizable React component from @<!-- -->kbn/i18n and @<!-- -->elastic/eui packages and is supposed to be used as the topmost component for any i18n-compatible React tree. |
| [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) | Provides access to the metadata injected by the server into the page |
| [LegacyNavLink](./kibana-plugin-public.legacynavlink.md) | |
| [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) | |
| [OverlayRef](./kibana-plugin-public.overlayref.md) | |
| [OverlayStart](./kibana-plugin-public.overlaystart.md) | |
| [Plugin](./kibana-plugin-public.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
| [PluginInitializerContext](./kibana-plugin-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
| [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) | The available core services passed to a plugin's <code>Plugin#setup</code> method. |
| [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) | The available core services passed to a plugin's <code>Plugin#start</code> method. |
| [UiSettingsState](./kibana-plugin-public.uisettingsstate.md) | |
## Type Aliases
@ -50,7 +53,6 @@
| [HttpSetup](./kibana-plugin-public.httpsetup.md) | |
| [HttpStart](./kibana-plugin-public.httpstart.md) | |
| [I18nStart](./kibana-plugin-public.i18nstart.md) | |
| [InjectedMetadataStart](./kibana-plugin-public.injectedmetadatastart.md) | |
| [NotificationsStart](./kibana-plugin-public.notificationsstart.md) | |
| [PluginInitializer](./kibana-plugin-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
| [ToastInput](./kibana-plugin-public.toastinput.md) | |

View file

@ -16,7 +16,7 @@ export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<string, unk
| Property | Type | Description |
| --- | --- | --- |
| [setup](./kibana-plugin-public.plugin.setup.md) | <code>(core: PluginSetupContext, plugins: TPluginsSetup) =&gt; TSetup &#124; Promise&lt;TSetup&gt;</code> | |
| [start](./kibana-plugin-public.plugin.start.md) | <code>(core: PluginStartContext, plugins: TPluginsStart) =&gt; TStart &#124; Promise&lt;TStart&gt;</code> | |
| [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> | |

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
setup: (core: PluginSetupContext, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
```

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
start: (core: PluginStartContext, plugins: TPluginsStart) => TStart | Promise<TStart>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [basePath](./kibana-plugin-public.pluginsetupcontext.basepath.md)
## PluginSetupContext.basePath property
<b>Signature:</b>
```typescript
basePath: BasePathSetup;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [chrome](./kibana-plugin-public.pluginsetupcontext.chrome.md)
## PluginSetupContext.chrome property
<b>Signature:</b>
```typescript
chrome: ChromeSetup;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [fatalErrors](./kibana-plugin-public.pluginsetupcontext.fatalerrors.md)
## PluginSetupContext.fatalErrors property
<b>Signature:</b>
```typescript
fatalErrors: FatalErrorsSetup;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [http](./kibana-plugin-public.pluginsetupcontext.http.md)
## PluginSetupContext.http property
<b>Signature:</b>
```typescript
http: HttpSetup;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [i18n](./kibana-plugin-public.pluginsetupcontext.i18n.md)
## PluginSetupContext.i18n property
<b>Signature:</b>
```typescript
i18n: I18nSetup;
```

View file

@ -1,26 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md)
## PluginSetupContext interface
The available core services passed to a plugin's `Plugin#setup` method.
<b>Signature:</b>
```typescript
export interface PluginSetupContext
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [basePath](./kibana-plugin-public.pluginsetupcontext.basepath.md) | <code>BasePathSetup</code> | |
| [chrome](./kibana-plugin-public.pluginsetupcontext.chrome.md) | <code>ChromeSetup</code> | |
| [fatalErrors](./kibana-plugin-public.pluginsetupcontext.fatalerrors.md) | <code>FatalErrorsSetup</code> | |
| [http](./kibana-plugin-public.pluginsetupcontext.http.md) | <code>HttpSetup</code> | |
| [i18n](./kibana-plugin-public.pluginsetupcontext.i18n.md) | <code>I18nSetup</code> | |
| [notifications](./kibana-plugin-public.pluginsetupcontext.notifications.md) | <code>NotificationsSetup</code> | |
| [uiSettings](./kibana-plugin-public.pluginsetupcontext.uisettings.md) | <code>UiSettingsSetup</code> | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [notifications](./kibana-plugin-public.pluginsetupcontext.notifications.md)
## PluginSetupContext.notifications property
<b>Signature:</b>
```typescript
notifications: NotificationsSetup;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [uiSettings](./kibana-plugin-public.pluginsetupcontext.uisettings.md)
## PluginSetupContext.uiSettings property
<b>Signature:</b>
```typescript
uiSettings: UiSettingsSetup;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [application](./kibana-plugin-public.pluginstartcontext.application.md)
## PluginStartContext.application property
<b>Signature:</b>
```typescript
application: Pick<ApplicationStart, 'capabilities'>;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [basePath](./kibana-plugin-public.pluginstartcontext.basepath.md)
## PluginStartContext.basePath property
<b>Signature:</b>
```typescript
basePath: BasePathStart;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [chrome](./kibana-plugin-public.pluginstartcontext.chrome.md)
## PluginStartContext.chrome property
<b>Signature:</b>
```typescript
chrome: ChromeStart;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [http](./kibana-plugin-public.pluginstartcontext.http.md)
## PluginStartContext.http property
<b>Signature:</b>
```typescript
http: HttpStart;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [i18n](./kibana-plugin-public.pluginstartcontext.i18n.md)
## PluginStartContext.i18n property
<b>Signature:</b>
```typescript
i18n: I18nStart;
```

View file

@ -1,26 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md)
## PluginStartContext interface
The available core services passed to a plugin's `Plugin#start` method.
<b>Signature:</b>
```typescript
export interface PluginStartContext
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [application](./kibana-plugin-public.pluginstartcontext.application.md) | <code>Pick&lt;ApplicationStart, 'capabilities'&gt;</code> | |
| [basePath](./kibana-plugin-public.pluginstartcontext.basepath.md) | <code>BasePathStart</code> | |
| [chrome](./kibana-plugin-public.pluginstartcontext.chrome.md) | <code>ChromeStart</code> | |
| [http](./kibana-plugin-public.pluginstartcontext.http.md) | <code>HttpStart</code> | |
| [i18n](./kibana-plugin-public.pluginstartcontext.i18n.md) | <code>I18nStart</code> | |
| [notifications](./kibana-plugin-public.pluginstartcontext.notifications.md) | <code>NotificationsStart</code> | |
| [overlays](./kibana-plugin-public.pluginstartcontext.overlays.md) | <code>OverlayStart</code> | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [notifications](./kibana-plugin-public.pluginstartcontext.notifications.md)
## PluginStartContext.notifications property
<b>Signature:</b>
```typescript
notifications: NotificationsStart;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginStartContext](./kibana-plugin-public.pluginstartcontext.md) &gt; [overlays](./kibana-plugin-public.pluginstartcontext.overlays.md)
## PluginStartContext.overlays property
<b>Signature:</b>
```typescript
overlays: OverlayStart;
```

View file

@ -7,5 +7,8 @@
<b>Signature:</b>
```typescript
elasticsearch: ElasticsearchServiceSetup;
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
};
```

View file

@ -7,5 +7,10 @@
<b>Signature:</b>
```typescript
http: HttpServiceSetup;
http: {
registerAuth: HttpServiceSetup['registerAuth'];
registerOnRequest: HttpServiceSetup['registerOnRequest'];
getBasePathFor: HttpServiceSetup['getBasePathFor'];
setBasePathFor: HttpServiceSetup['setBasePathFor'];
};
```

View file

@ -4,6 +4,7 @@
## CoreSetup interface
Context passed to the plugins `setup` method.
<b>Signature:</b>
@ -15,7 +16,6 @@ export interface CoreSetup
| Property | Type | Description |
| --- | --- | --- |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>ElasticsearchServiceSetup</code> | |
| [http](./kibana-plugin-server.coresetup.http.md) | <code>HttpServiceSetup</code> | |
| [plugins](./kibana-plugin-server.coresetup.plugins.md) | <code>PluginsServiceSetup</code> | |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>{`<p/>` adminClient$: Observable&lt;ClusterClient&gt;;`<p/>` dataClient$: Observable&lt;ClusterClient&gt;;`<p/>` }</code> | |
| [http](./kibana-plugin-server.coresetup.http.md) | <code>{`<p/>` registerAuth: HttpServiceSetup['registerAuth'];`<p/>` registerOnRequest: HttpServiceSetup['registerOnRequest'];`<p/>` getBasePathFor: HttpServiceSetup['getBasePathFor'];`<p/>` setBasePathFor: HttpServiceSetup['setBasePathFor'];`<p/>` }</code> | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreSetup](./kibana-plugin-server.coresetup.md) &gt; [plugins](./kibana-plugin-server.coresetup.plugins.md)
## CoreSetup.plugins property
<b>Signature:</b>
```typescript
plugins: PluginsServiceSetup;
```

View file

@ -4,17 +4,10 @@
## CoreStart interface
Context passed to the plugins `start` method.
<b>Signature:</b>
```typescript
export interface CoreStart
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [http](./kibana-plugin-server.corestart.http.md) | <code>HttpServiceStart</code> | |
| [plugins](./kibana-plugin-server.corestart.plugins.md) | <code>PluginsServiceStart</code> | |

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreStart](./kibana-plugin-server.corestart.md) &gt; [http](./kibana-plugin-server.corestart.http.md)
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [InternalCoreStart](./kibana-plugin-server.internalcorestart.md) &gt; [http](./kibana-plugin-server.internalcorestart.http.md)
## CoreStart.http property
## InternalCoreStart.http property
<b>Signature:</b>

View file

@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [InternalCoreStart](./kibana-plugin-server.internalcorestart.md)
## InternalCoreStart interface
<b>Signature:</b>
```typescript
export interface InternalCoreStart
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [http](./kibana-plugin-server.internalcorestart.http.md) | <code>HttpServiceStart</code> | |
| [plugins](./kibana-plugin-server.internalcorestart.plugins.md) | <code>PluginsServiceStart</code> | |

View file

@ -1,8 +1,8 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreStart](./kibana-plugin-server.corestart.md) &gt; [plugins](./kibana-plugin-server.corestart.plugins.md)
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [InternalCoreStart](./kibana-plugin-server.internalcorestart.md) &gt; [plugins](./kibana-plugin-server.internalcorestart.plugins.md)
## CoreStart.plugins property
## InternalCoreStart.plugins property
<b>Signature:</b>

View file

@ -4,6 +4,12 @@
## kibana-plugin-server package
The Kibana Core APIs for server-side plugins.
A plugin's `server/index` file must contain a named import, `plugin`<!-- -->, that implements [PluginInitializer](./kibana-plugin-server.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-server.plugin.md)<!-- -->.
The plugin integrates with the core system via lifecycle events: `setup`<!-- -->, `start`<!-- -->, and `stop`<!-- -->. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-server.coresetup.md) or [CoreStart](./kibana-plugin-server.corestart.md)<!-- -->) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked.
## Classes
| Class | Description |
@ -19,21 +25,20 @@
| --- | --- |
| [AuthToolkit](./kibana-plugin-server.authtoolkit.md) | A tool set defining an outcome of Auth interceptor for incoming request. |
| [CallAPIOptions](./kibana-plugin-server.callapioptions.md) | The set of options that defines how API call should be made and result be processed. |
| [CoreSetup](./kibana-plugin-server.coresetup.md) | |
| [CoreStart](./kibana-plugin-server.corestart.md) | |
| [CoreSetup](./kibana-plugin-server.coresetup.md) | Context passed to the plugins <code>setup</code> method. |
| [CoreStart](./kibana-plugin-server.corestart.md) | Context passed to the plugins <code>start</code> method. |
| [DiscoveredPlugin](./kibana-plugin-server.discoveredplugin.md) | Small container object used to expose information about discovered plugins that may or may not have been started. |
| [ElasticsearchServiceSetup](./kibana-plugin-server.elasticsearchservicesetup.md) | |
| [HttpServiceStart](./kibana-plugin-server.httpservicestart.md) | |
| [InternalCoreStart](./kibana-plugin-server.internalcorestart.md) | |
| [Logger](./kibana-plugin-server.logger.md) | Logger exposes all the necessary methods to log any type of information and this is the interface used by the logging consumers including plugins. |
| [LoggerFactory](./kibana-plugin-server.loggerfactory.md) | The single purpose of <code>LoggerFactory</code> interface is to define a way to retrieve a context-based logger instance. |
| [LogMeta](./kibana-plugin-server.logmeta.md) | Contextual metadata |
| [OnRequestToolkit](./kibana-plugin-server.onrequesttoolkit.md) | A tool set defining an outcome of OnRequest interceptor for incoming request. |
| [Plugin](./kibana-plugin-server.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
| [PluginInitializerContext](./kibana-plugin-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. |
| [PluginSetupContext](./kibana-plugin-server.pluginsetupcontext.md) | Context passed to the plugins <code>setup</code> method. |
| [PluginsServiceSetup](./kibana-plugin-server.pluginsservicesetup.md) | |
| [PluginsServiceStart](./kibana-plugin-server.pluginsservicestart.md) | |
| [PluginStartContext](./kibana-plugin-server.pluginstartcontext.md) | Context passed to the plugins <code>start</code> method. |
## Type Aliases

View file

@ -16,7 +16,7 @@ export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<PluginName,
| Property | Type | Description |
| --- | --- | --- |
| [setup](./kibana-plugin-server.plugin.setup.md) | <code>(core: PluginSetupContext, plugins: TPluginsSetup) =&gt; TSetup &#124; Promise&lt;TSetup&gt;</code> | |
| [start](./kibana-plugin-server.plugin.start.md) | <code>(core: PluginStartContext, plugins: TPluginsStart) =&gt; TStart &#124; Promise&lt;TStart&gt;</code> | |
| [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> | |

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
setup: (core: PluginSetupContext, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
```

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
start: (core: PluginStartContext, plugins: TPluginsStart) => TStart | Promise<TStart>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
```

View file

@ -1,14 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [PluginSetupContext](./kibana-plugin-server.pluginsetupcontext.md) &gt; [elasticsearch](./kibana-plugin-server.pluginsetupcontext.elasticsearch.md)
## PluginSetupContext.elasticsearch property
<b>Signature:</b>
```typescript
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
};
```

View file

@ -1,16 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [PluginSetupContext](./kibana-plugin-server.pluginsetupcontext.md) &gt; [http](./kibana-plugin-server.pluginsetupcontext.http.md)
## PluginSetupContext.http property
<b>Signature:</b>
```typescript
http: {
registerAuth: HttpServiceSetup['registerAuth'];
registerOnRequest: HttpServiceSetup['registerOnRequest'];
getBasePathFor: HttpServiceSetup['getBasePathFor'];
setBasePathFor: HttpServiceSetup['setBasePathFor'];
};
```

View file

@ -1,21 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [PluginSetupContext](./kibana-plugin-server.pluginsetupcontext.md)
## PluginSetupContext interface
Context passed to the plugins `setup` method.
<b>Signature:</b>
```typescript
export interface PluginSetupContext
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [elasticsearch](./kibana-plugin-server.pluginsetupcontext.elasticsearch.md) | <code>{`<p/>` adminClient$: Observable&lt;ClusterClient&gt;;`<p/>` dataClient$: Observable&lt;ClusterClient&gt;;`<p/>` }</code> | |
| [http](./kibana-plugin-server.pluginsetupcontext.http.md) | <code>{`<p/>` registerAuth: HttpServiceSetup['registerAuth'];`<p/>` registerOnRequest: HttpServiceSetup['registerOnRequest'];`<p/>` getBasePathFor: HttpServiceSetup['getBasePathFor'];`<p/>` setBasePathFor: HttpServiceSetup['setBasePathFor'];`<p/>` }</code> | |

View file

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [PluginStartContext](./kibana-plugin-server.pluginstartcontext.md)
## PluginStartContext interface
Context passed to the plugins `start` method.
<b>Signature:</b>
```typescript
export interface PluginStartContext
```

View file

@ -19,7 +19,7 @@
import './core.css';
import { CoreSetup, CoreStart } from '.';
import { InternalCoreSetup, InternalCoreStart } from '.';
import { BasePathService } from './base_path';
import { ChromeService } from './chrome';
import { FatalErrorsService, FatalErrorsSetup } from './fatal_errors';
@ -134,7 +134,7 @@ export class CoreSystem {
notifications,
});
const core: CoreSetup = {
const core: InternalCoreSetup = {
application,
basePath,
chrome,
@ -188,7 +188,7 @@ export class CoreSystem {
});
const overlays = this.overlay.start({ i18n, targetDomElement: overlayTargetDomElement });
const core: CoreStart = {
const core: InternalCoreStart = {
application,
basePath,
chrome,

View file

@ -23,7 +23,7 @@ import * as Rx from 'rxjs';
import { first, tap } from 'rxjs/operators';
import { I18nSetup } from '../i18n';
import { InjectedMetadataSetup } from '../';
import { InjectedMetadataSetup } from '../injected_metadata';
import { FatalErrorsScreen } from './fatal_errors_screen';
import { FatalErrorInfo, getErrorInfo } from './get_error_info';

View file

@ -17,6 +17,24 @@
* under the License.
*/
/**
* The Kibana Core APIs for client-side plugins.
*
* A plugin's `public/index` file must contain a named import, `plugin`, that
* implements {@link PluginInitializer} which returns an object that implements
* {@link Plugin}.
*
* The plugin integrates with the core system via lifecycle events: `setup`,
* `start`, and `stop`. In each lifecycle method, the plugin will receive the
* corresponding core services available (either {@link CoreSetup} or
* {@link CoreStart}) and any interfaces returned by dependency plugins'
* lifecycle method. Anything returned by the plugin's lifecycle method will be
* exposed to downstream dependencies when their corresponding lifecycle methods
* are invoked.
*
* @packageDocumentation
*/
import { BasePathSetup, BasePathStart } from './base_path';
import {
ChromeBadge,
@ -30,12 +48,7 @@ import {
import { FatalErrorsSetup, FatalErrorInfo } from './fatal_errors';
import { HttpSetup, HttpStart } from './http';
import { I18nSetup, I18nStart } from './i18n';
import {
InjectedMetadataParams,
InjectedMetadataSetup,
InjectedMetadataStart,
LegacyNavLink,
} from './injected_metadata';
import { InjectedMetadataSetup, InjectedMetadataStart, LegacyNavLink } from './injected_metadata';
import {
NotificationsSetup,
Toast,
@ -44,13 +57,7 @@ import {
NotificationsStart,
} from './notifications';
import { OverlayRef, OverlayStart } from './overlays';
import {
Plugin,
PluginInitializer,
PluginInitializerContext,
PluginSetupContext,
PluginStartContext,
} from './plugins';
import { Plugin, PluginInitializer, PluginInitializerContext } from './plugins';
import { UiSettingsClient, UiSettingsSetup, UiSettingsState } from './ui_settings';
import { ApplicationSetup, Capabilities, ApplicationStart } from './application';
@ -58,7 +65,7 @@ import { ApplicationSetup, Capabilities, ApplicationStart } from './application'
export { CoreContext, CoreSystem } from './core_system';
/**
* Core services exposed to the setup lifecycle
* Core services exposed to the `Plugin` setup lifecycle
*
* @public
*
@ -67,28 +74,24 @@ export { CoreContext, CoreSystem } from './core_system';
* https://github.com/Microsoft/web-build-tools/issues/1237
*/
export interface CoreSetup {
/** {@link ApplicationSetup} */
application: ApplicationSetup;
/** {@link I18nSetup} */
i18n: I18nSetup;
/** {@link InjectedMetadataSetup} */
injectedMetadata: InjectedMetadataSetup;
/** {@link FatalErrorsSetup} */
fatalErrors: FatalErrorsSetup;
/** {@link NotificationsSetup} */
notifications: NotificationsSetup;
/** {@link HttpSetup} */
http: HttpSetup;
/** {@link BasePathSetup} */
basePath: BasePathSetup;
/** {@link UiSettingsSetup} */
uiSettings: UiSettingsSetup;
/** {@link ChromeSetup} */
chrome: ChromeSetup;
/** {@link FatalErrorsSetup} */
fatalErrors: FatalErrorsSetup;
/** {@link HttpSetup} */
http: HttpSetup;
/** {@link I18nSetup} */
i18n: I18nSetup;
/** {@link NotificationsSetup} */
notifications: NotificationsSetup;
/** {@link UiSettingsSetup} */
uiSettings: UiSettingsSetup;
}
/**
* Core services exposed to the start lifecycle
* Core services exposed to the `Plugin` start lifecycle
*
* @public
*
@ -98,7 +101,7 @@ export interface CoreSetup {
*/
export interface CoreStart {
/** {@link ApplicationStart} */
application: ApplicationStart;
application: Pick<ApplicationStart, 'capabilities'>;
/** {@link BasePathStart} */
basePath: BasePathStart;
/** {@link ChromeStart} */
@ -107,14 +110,24 @@ export interface CoreStart {
http: HttpStart;
/** {@link I18nStart} */
i18n: I18nStart;
/** {@link InjectedMetadataStart} */
injectedMetadata: InjectedMetadataStart;
/** {@link NotificationsStart} */
notifications: NotificationsStart;
/** {@link OverlayStart} */
overlays: OverlayStart;
}
/** @internal */
export interface InternalCoreSetup extends CoreSetup {
application: ApplicationSetup;
injectedMetadata: InjectedMetadataSetup;
}
/** @internal */
export interface InternalCoreStart extends CoreStart {
application: ApplicationStart;
injectedMetadata: InjectedMetadataStart;
}
export {
ApplicationSetup,
ApplicationStart,
@ -134,15 +147,10 @@ export {
ChromeNavLink,
I18nSetup,
I18nStart,
InjectedMetadataSetup,
InjectedMetadataStart,
InjectedMetadataParams,
LegacyNavLink,
Plugin,
PluginInitializer,
PluginInitializerContext,
PluginSetupContext,
PluginStartContext,
NotificationsSetup,
NotificationsStart,
OverlayRef,

View file

@ -133,7 +133,7 @@ export class InjectedMetadataService {
/**
* Provides access to the metadata injected by the server into the page
*
* @public
* @internal
*/
export interface InjectedMetadataSetup {
getBasePath: () => string;
@ -173,5 +173,5 @@ export interface InjectedMetadataSetup {
};
}
/** @public */
/** @internal */
export type InjectedMetadataStart = InjectedMetadataSetup;

View file

@ -18,7 +18,7 @@
*/
import angular from 'angular';
import { CoreSetup, CoreStart } from '../';
import { InternalCoreSetup, InternalCoreStart } from '../';
/** @internal */
export interface LegacyPlatformParams {
@ -27,11 +27,11 @@ export interface LegacyPlatformParams {
}
interface SetupDeps {
core: CoreSetup;
core: InternalCoreSetup;
}
interface StartDeps {
core: CoreStart;
core: InternalCoreStart;
targetDomElement: HTMLElement;
}

View file

@ -19,4 +19,4 @@
export * from './plugins_service';
export { Plugin, PluginInitializer } from './plugin';
export { PluginInitializerContext, PluginSetupContext, PluginStartContext } from './plugin_context';
export { PluginInitializerContext } from './plugin_context';

View file

@ -18,8 +18,9 @@
*/
import { DiscoveredPlugin, PluginName } from '../../server';
import { PluginInitializerContext, PluginSetupContext, PluginStartContext } from './plugin_context';
import { PluginInitializerContext } from './plugin_context';
import { loadPluginBundle } from './plugin_loader';
import { CoreStart, CoreSetup } from '..';
/**
* The interface that should be returned by a `PluginInitializer`.
@ -32,8 +33,8 @@ export interface Plugin<
TPluginsSetup extends Record<string, unknown> = {},
TPluginsStart extends Record<string, unknown> = {}
> {
setup: (core: PluginSetupContext, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
start: (core: PluginStartContext, plugins: TPluginsStart) => TStart | Promise<TStart>;
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
stop?: () => void;
}
@ -98,7 +99,7 @@ export class PluginWrapper<
* @param plugins The dictionary where the key is the dependency name and the value
* is the contract returned by the dependency's `setup` function.
*/
public async setup(setupContext: PluginSetupContext, plugins: TPluginsSetup) {
public async setup(setupContext: CoreSetup, plugins: TPluginsSetup) {
this.instance = await this.createPluginInstance();
return await this.instance.setup(setupContext, plugins);
@ -111,7 +112,7 @@ export class PluginWrapper<
* @param plugins The dictionary where the key is the dependency name and the value
* is the contract returned by the dependency's `start` function.
*/
public async start(startContext: PluginStartContext, plugins: TPluginsStart) {
public async start(startContext: CoreStart, plugins: TPluginsStart) {
if (this.instance === undefined) {
throw new Error(`Plugin "${this.name}" can't be started since it isn't set up.`);
}

View file

@ -18,18 +18,10 @@
*/
import { DiscoveredPlugin } from '../../server';
import { BasePathSetup, BasePathStart } from '../base_path';
import { ChromeSetup, ChromeStart } from '../chrome';
import { CoreContext } from '../core_system';
import { FatalErrorsSetup } from '../fatal_errors';
import { I18nSetup, I18nStart } from '../i18n';
import { NotificationsSetup, NotificationsStart } from '../notifications';
import { UiSettingsSetup } from '../ui_settings';
import { PluginWrapper } from './plugin';
import { PluginsServiceSetupDeps, PluginsServiceStartDeps } from './plugins_service';
import { OverlayStart } from '../overlays';
import { ApplicationStart } from '../application';
import { HttpSetup, HttpStart } from '../http';
import { CoreSetup, CoreStart } from '../';
/**
* The available core services passed to a `PluginInitializer`
@ -39,36 +31,6 @@ import { HttpSetup, HttpStart } from '../http';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface PluginInitializerContext {}
/**
* The available core services passed to a plugin's `Plugin#setup` method.
*
* @public
*/
export interface PluginSetupContext {
basePath: BasePathSetup;
chrome: ChromeSetup;
fatalErrors: FatalErrorsSetup;
http: HttpSetup;
i18n: I18nSetup;
notifications: NotificationsSetup;
uiSettings: UiSettingsSetup;
}
/**
* The available core services passed to a plugin's `Plugin#start` method.
*
* @public
*/
export interface PluginStartContext {
application: Pick<ApplicationStart, 'capabilities'>;
chrome: ChromeStart;
basePath: BasePathStart;
http: HttpStart;
i18n: I18nStart;
notifications: NotificationsStart;
overlays: OverlayStart;
}
/**
* Provides a plugin-specific context passed to the plugin's construtor. This is currently
* empty but should provide static services in the future, such as config and logging.
@ -98,7 +60,7 @@ export function createPluginSetupContext<TSetup, TStart, TPluginsSetup, TPlugins
coreContext: CoreContext,
deps: PluginsServiceSetupDeps,
plugin: PluginWrapper<TSetup, TStart, TPluginsSetup, TPluginsStart>
): PluginSetupContext {
): CoreSetup {
return {
http: deps.http,
basePath: deps.basePath,
@ -124,7 +86,7 @@ export function createPluginStartContext<TSetup, TStart, TPluginsSetup, TPlugins
coreContext: CoreContext,
deps: PluginsServiceStartDeps,
plugin: PluginWrapper<TSetup, TStart, TPluginsSetup, TPluginsStart>
): PluginStartContext {
): CoreStart {
return {
application: {
capabilities: deps.application.capabilities,

View file

@ -36,7 +36,6 @@ import { notificationServiceMock } from '../notifications/notifications_service.
import { applicationServiceMock } from '../application/application_service.mock';
import { i18nServiceMock } from '../i18n/i18n_service.mock';
import { overlayServiceMock } from '../overlays/overlay_service.mock';
import { PluginStartContext, PluginSetupContext } from './plugin_context';
import { chromeServiceMock } from '../chrome/chrome_service.mock';
import { fatalErrorsServiceMock } from '../fatal_errors/fatal_errors_service.mock';
import { uiSettingsServiceMock } from '../ui_settings/ui_settings_service.mock';
@ -44,6 +43,7 @@ import { basePathServiceMock } from '../base_path/base_path_service.mock';
import { injectedMetadataServiceMock } from '../injected_metadata/injected_metadata_service.mock';
import { UiSettingsClient } from '../ui_settings';
import { httpServiceMock } from '../http/http_service.mock';
import { CoreSetup, CoreStart } from '..';
export let mockPluginInitializers: Map<PluginName, MockedPluginInitializer>;
@ -55,9 +55,9 @@ type DeeplyMocked<T> = { [P in keyof T]: jest.Mocked<T[P]> };
const mockCoreContext: CoreContext = {};
let mockSetupDeps: DeeplyMocked<PluginsServiceSetupDeps>;
let mockSetupContext: DeeplyMocked<PluginSetupContext>;
let mockSetupContext: DeeplyMocked<CoreSetup>;
let mockStartDeps: DeeplyMocked<PluginsServiceStartDeps>;
let mockStartContext: DeeplyMocked<PluginStartContext>;
let mockStartContext: DeeplyMocked<CoreStart>;
beforeEach(() => {
mockSetupDeps = {

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { CoreSetup, CoreStart } from '..';
import { InternalCoreSetup, InternalCoreStart } from '..';
import { PluginName } from '../../server';
import { CoreService } from '../../types';
import { CoreContext } from '../core_system';
@ -29,9 +29,9 @@ import {
} from './plugin_context';
/** @internal */
export type PluginsServiceSetupDeps = CoreSetup;
export type PluginsServiceSetupDeps = InternalCoreSetup;
/** @internal */
export type PluginsServiceStartDeps = CoreStart;
export type PluginsServiceStartDeps = InternalCoreStart;
/** @internal */
export interface PluginsServiceSetup {

View file

@ -118,8 +118,6 @@ export interface CoreContext {
// @public
export interface CoreSetup {
// (undocumented)
application: ApplicationSetup;
// (undocumented)
basePath: BasePathSetup;
// (undocumented)
@ -131,8 +129,6 @@ export interface CoreSetup {
// (undocumented)
i18n: I18nSetup;
// (undocumented)
injectedMetadata: InjectedMetadataSetup;
// (undocumented)
notifications: NotificationsSetup;
// (undocumented)
uiSettings: UiSettingsSetup;
@ -141,7 +137,7 @@ export interface CoreSetup {
// @public
export interface CoreStart {
// (undocumented)
application: ApplicationStart;
application: Pick<ApplicationStart, 'capabilities'>;
// (undocumented)
basePath: BasePathStart;
// (undocumented)
@ -151,8 +147,6 @@ export interface CoreStart {
// (undocumented)
i18n: I18nStart;
// (undocumented)
injectedMetadata: InjectedMetadataStart;
// (undocumented)
notifications: NotificationsStart;
// (undocumented)
overlays: OverlayStart;
@ -205,90 +199,25 @@ export interface I18nSetup {
export type I18nStart = I18nSetup;
// @internal (undocumented)
export interface InjectedMetadataParams {
export interface InternalCoreSetup extends CoreSetup {
// (undocumented)
injectedMetadata: {
version: string;
buildNumber: number;
basePath: string;
csp: {
warnLegacyBrowsers: boolean;
};
vars: {
[key: string]: unknown;
};
uiPlugins: Array<{
id: PluginName;
plugin: DiscoveredPlugin;
}>;
capabilities: Capabilities;
legacyMetadata: {
app: unknown;
translations: unknown;
bundleId: string;
nav: LegacyNavLink[];
version: string;
branch: string;
buildNum: number;
buildSha: string;
basePath: string;
serverName: string;
devMode: boolean;
uiSettings: {
defaults: UiSettingsState;
user?: UiSettingsState;
};
};
};
application: ApplicationSetup;
// Warning: (ae-forgotten-export) The symbol "InjectedMetadataSetup" needs to be exported by the entry point index.d.ts
//
// (undocumented)
injectedMetadata: InjectedMetadataSetup;
}
// @public
export interface InjectedMetadataSetup {
// @internal (undocumented)
export interface InternalCoreStart extends CoreStart {
// (undocumented)
getBasePath: () => string;
application: ApplicationStart;
// Warning: (ae-forgotten-export) The symbol "InjectedMetadataStart" needs to be exported by the entry point index.d.ts
//
// (undocumented)
getCapabilities: () => Capabilities;
// (undocumented)
getCspConfig: () => {
warnLegacyBrowsers: boolean;
};
// (undocumented)
getInjectedVar: (name: string, defaultValue?: any) => unknown;
// (undocumented)
getInjectedVars: () => {
[key: string]: unknown;
};
// (undocumented)
getKibanaBuildNumber: () => number;
// (undocumented)
getKibanaVersion: () => string;
// (undocumented)
getLegacyMetadata: () => {
app: unknown;
translations: unknown;
bundleId: string;
nav: LegacyNavLink[];
version: string;
branch: string;
buildNum: number;
buildSha: string;
basePath: string;
serverName: string;
devMode: boolean;
uiSettings: {
defaults: UiSettingsState;
user?: UiSettingsState | undefined;
};
};
getPlugins: () => Array<{
id: string;
plugin: DiscoveredPlugin;
}>;
injectedMetadata: InjectedMetadataStart;
}
// @public (undocumented)
export type InjectedMetadataStart = InjectedMetadataSetup;
// @public (undocumented)
export interface LegacyNavLink {
// (undocumented)
@ -341,9 +270,9 @@ export interface OverlayStart {
// @public
export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<string, unknown> = {}, TPluginsStart extends Record<string, unknown> = {}> {
// (undocumented)
setup: (core: PluginSetupContext, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
// (undocumented)
start: (core: PluginStartContext, plugins: TPluginsStart) => TStart | Promise<TStart>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
// (undocumented)
stop?: () => void;
}
@ -355,42 +284,6 @@ export type PluginInitializer<TSetup, TStart, TPluginsSetup extends Record<strin
export interface PluginInitializerContext {
}
// @public
export interface PluginSetupContext {
// (undocumented)
basePath: BasePathSetup;
// (undocumented)
chrome: ChromeSetup;
// (undocumented)
fatalErrors: FatalErrorsSetup;
// (undocumented)
http: HttpSetup;
// (undocumented)
i18n: I18nSetup;
// (undocumented)
notifications: NotificationsSetup;
// (undocumented)
uiSettings: UiSettingsSetup;
}
// @public
export interface PluginStartContext {
// (undocumented)
application: Pick<ApplicationStart, 'capabilities'>;
// (undocumented)
basePath: BasePathStart;
// (undocumented)
chrome: ChromeStart;
// (undocumented)
http: HttpStart;
// (undocumented)
i18n: I18nStart;
// (undocumented)
notifications: NotificationsStart;
// (undocumented)
overlays: OverlayStart;
}
export { Toast }
// @public (undocumented)
@ -453,11 +346,4 @@ export interface UiSettingsState {
}
// Warnings were encountered during analysis:
//
// src/core/public/injected_metadata/injected_metadata_service.ts:49:7 - (ae-forgotten-export) The symbol "PluginName" needs to be exported by the entry point index.d.ts
// src/core/public/injected_metadata/injected_metadata_service.ts:50:7 - (ae-forgotten-export) The symbol "DiscoveredPlugin" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)
```

View file

@ -16,7 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ElasticsearchServiceSetup } from './elasticsearch';
/**
* The Kibana Core APIs for server-side plugins.
*
* A plugin's `server/index` file must contain a named import, `plugin`, that
* implements {@link PluginInitializer} which returns an object that implements
* {@link Plugin}.
*
* The plugin integrates with the core system via lifecycle events: `setup`,
* `start`, and `stop`. In each lifecycle method, the plugin will receive the
* corresponding core services available (either {@link CoreSetup} or
* {@link CoreStart}) and any interfaces returned by dependency plugins'
* lifecycle method. Anything returned by the plugin's lifecycle method will be
* exposed to downstream dependencies when their corresponding lifecycle methods
* are invoked.
*
* @packageDocumentation
*/
import { Observable } from 'rxjs';
import { ClusterClient, ElasticsearchServiceSetup } from './elasticsearch';
import { HttpServiceSetup, HttpServiceStart } from './http';
import { PluginsServiceSetup, PluginsServiceStart } from './plugins';
@ -46,12 +66,35 @@ export {
PluginInitializer,
PluginInitializerContext,
PluginName,
PluginSetupContext,
PluginStartContext,
} from './plugins';
/** @public */
/**
* Context passed to the plugins `setup` method.
*
* @public
*/
export interface CoreSetup {
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
};
http: {
registerAuth: HttpServiceSetup['registerAuth'];
registerOnRequest: HttpServiceSetup['registerOnRequest'];
getBasePathFor: HttpServiceSetup['getBasePathFor'];
setBasePathFor: HttpServiceSetup['setBasePathFor'];
};
}
/**
* Context passed to the plugins `start` method.
*
* @public
*/
export interface CoreStart {} // eslint-disable-line @typescript-eslint/no-empty-interface
/** @internal */
export interface InternalCoreSetup {
http: HttpServiceSetup;
elasticsearch: ElasticsearchServiceSetup;
plugins: PluginsServiceSetup;
@ -60,7 +103,7 @@ export interface CoreSetup {
/**
* @public
*/
export interface CoreStart {
export interface InternalCoreStart {
http: HttpServiceStart;
plugins: PluginsServiceStart;
}

View file

@ -21,7 +21,7 @@ import { Server as HapiServer } from 'hapi';
import { combineLatest, ConnectableObservable, EMPTY, Observable, Subscription } from 'rxjs';
import { first, map, mergeMap, publishReplay, tap } from 'rxjs/operators';
import { CoreService } from '../../types';
import { CoreSetup, CoreStart } from '../../server';
import { InternalCoreSetup, InternalCoreStart } from '../../server';
import { Config } from '../config';
import { CoreContext } from '../core_context';
import { DevConfig, DevConfigType } from '../dev';
@ -55,7 +55,7 @@ export class LegacyService implements CoreService {
private readonly httpConfig$: Observable<HttpConfig>;
private kbnServer?: LegacyKbnServer;
private configSubscription?: Subscription;
private setupDeps?: CoreSetup;
private setupDeps?: InternalCoreSetup;
constructor(private readonly coreContext: CoreContext) {
this.log = coreContext.logger.get('legacy-service');
@ -66,10 +66,10 @@ export class LegacyService implements CoreService {
.atPath<HttpConfigType>('server')
.pipe(map(rawConfig => new HttpConfig(rawConfig, coreContext.env)));
}
public async setup(setupDeps: CoreSetup) {
public async setup(setupDeps: InternalCoreSetup) {
this.setupDeps = setupDeps;
}
public async start(startDeps: CoreStart) {
public async start(startDeps: InternalCoreStart) {
const { setupDeps } = this;
if (!setupDeps) {
throw new Error('Legacy service is not setup yet.');
@ -135,7 +135,11 @@ export class LegacyService implements CoreService {
);
}
private async createKbnServer(config: Config, setupDeps: CoreSetup, startDeps: CoreStart) {
private async createKbnServer(
config: Config,
setupDeps: InternalCoreSetup,
startDeps: InternalCoreStart
) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const KbnServer = require('../../../legacy/server/kbn_server');
const kbnServer: LegacyKbnServer = new KbnServer(getLegacyRawConfig(config), {

View file

@ -29,4 +29,4 @@ export {
PluginInitializer,
PluginName,
} from './plugin';
export { PluginInitializerContext, PluginSetupContext, PluginStartContext } from './plugin_context';
export { PluginInitializerContext } from './plugin_context';

View file

@ -24,7 +24,8 @@ import { Type } from '@kbn/config-schema';
import { ConfigPath } from '../config';
import { Logger } from '../logging';
import { PluginInitializerContext, PluginSetupContext, PluginStartContext } from './plugin_context';
import { PluginInitializerContext } from './plugin_context';
import { CoreSetup, CoreStart } from '..';
export type PluginConfigSchema = Type<unknown> | null;
@ -140,8 +141,8 @@ export interface Plugin<
TPluginsSetup extends Record<PluginName, unknown> = {},
TPluginsStart extends Record<PluginName, unknown> = {}
> {
setup: (core: PluginSetupContext, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
start: (core: PluginStartContext, plugins: TPluginsStart) => TStart | Promise<TStart>;
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
stop?: () => void;
}
@ -202,7 +203,7 @@ export class PluginWrapper<
* @param plugins The dictionary where the key is the dependency name and the value
* is the contract returned by the dependency's `setup` function.
*/
public async setup(setupContext: PluginSetupContext, plugins: TPluginsSetup) {
public async setup(setupContext: CoreSetup, plugins: TPluginsSetup) {
this.instance = this.createPluginInstance();
this.log.info('Setting up plugin');
@ -217,7 +218,7 @@ export class PluginWrapper<
* @param plugins The dictionary where the key is the dependency name and the value
* is the contract returned by the dependency's `start` function.
*/
public async start(startContext: PluginStartContext, plugins: TPluginsStart) {
public async start(startContext: CoreStart, plugins: TPluginsStart) {
if (this.instance === undefined) {
throw new Error(`Plugin "${this.name}" can't be started since it isn't set up.`);
}

View file

@ -20,11 +20,10 @@
import { Observable } from 'rxjs';
import { EnvironmentMode } from '../config';
import { CoreContext } from '../core_context';
import { ClusterClient } from '../elasticsearch';
import { HttpServiceSetup } from '../http';
import { LoggerFactory } from '../logging';
import { PluginWrapper, PluginManifest } from './plugin';
import { PluginsServiceSetupDeps, PluginsServiceStartDeps } from './plugins_service';
import { CoreSetup, CoreStart } from '..';
/**
* Context that's available to plugins during initialization stage.
@ -40,31 +39,6 @@ export interface PluginInitializerContext {
};
}
/**
* Context passed to the plugins `setup` method.
*
* @public
*/
export interface PluginSetupContext {
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
};
http: {
registerAuth: HttpServiceSetup['registerAuth'];
registerOnRequest: HttpServiceSetup['registerOnRequest'];
getBasePathFor: HttpServiceSetup['getBasePathFor'];
setBasePathFor: HttpServiceSetup['setBasePathFor'];
};
}
/**
* Context passed to the plugins `start` method.
*
* @public
*/
export interface PluginStartContext {} // eslint-disable-line @typescript-eslint/no-empty-interface
/**
* This returns a facade for `CoreContext` that will be exposed to the plugin initializer.
* This facade should be safe to use across entire plugin lifespan.
@ -136,7 +110,7 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
coreContext: CoreContext,
deps: PluginsServiceSetupDeps,
plugin: PluginWrapper<TPlugin, TPluginDependencies>
): PluginSetupContext {
): CoreSetup {
return {
elasticsearch: {
adminClient$: deps.elasticsearch.adminClient$,
@ -167,6 +141,6 @@ export function createPluginStartContext<TPlugin, TPluginDependencies>(
coreContext: CoreContext,
deps: PluginsServiceStartDeps,
plugin: PluginWrapper<TPlugin, TPluginDependencies>
): PluginStartContext {
): CoreStart {
return {};
}

View file

@ -74,22 +74,24 @@ export class ConfigService {
setSchema(path: ConfigPath, schema: Type<unknown>): Promise<void>;
}
// @public (undocumented)
// @public
export interface CoreSetup {
// (undocumented)
elasticsearch: ElasticsearchServiceSetup;
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
};
// (undocumented)
http: HttpServiceSetup;
// (undocumented)
plugins: PluginsServiceSetup;
http: {
registerAuth: HttpServiceSetup['registerAuth'];
registerOnRequest: HttpServiceSetup['registerOnRequest'];
getBasePathFor: HttpServiceSetup['getBasePathFor'];
setBasePathFor: HttpServiceSetup['setBasePathFor'];
};
}
// @public (undocumented)
// @public
export interface CoreStart {
// (undocumented)
http: HttpServiceStart;
// (undocumented)
plugins: PluginsServiceStart;
}
// @public
@ -137,6 +139,24 @@ export interface HttpServiceStart {
isListening: () => boolean;
}
// @internal (undocumented)
export interface InternalCoreSetup {
// (undocumented)
elasticsearch: ElasticsearchServiceSetup;
// (undocumented)
http: HttpServiceSetup;
// (undocumented)
plugins: PluginsServiceSetup;
}
// @public (undocumented)
export interface InternalCoreStart {
// (undocumented)
http: HttpServiceStart;
// (undocumented)
plugins: PluginsServiceStart;
}
// @public (undocumented)
export class KibanaRequest<Params = unknown, Query = unknown, Body = unknown> {
constructor(request: Request, params: Params, query: Query, body: Body);
@ -245,9 +265,9 @@ export interface OnRequestToolkit {
// @public
export interface Plugin<TSetup, TStart, TPluginsSetup extends Record<PluginName, unknown> = {}, TPluginsStart extends Record<PluginName, unknown> = {}> {
// (undocumented)
setup: (core: PluginSetupContext, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
setup: (core: CoreSetup, plugins: TPluginsSetup) => TSetup | Promise<TSetup>;
// (undocumented)
start: (core: PluginStartContext, plugins: TPluginsStart) => TStart | Promise<TStart>;
start: (core: CoreStart, plugins: TPluginsStart) => TStart | Promise<TStart>;
// (undocumented)
stop?: () => void;
}
@ -273,22 +293,6 @@ export interface PluginInitializerContext {
// @public
export type PluginName = string;
// @public
export interface PluginSetupContext {
// (undocumented)
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
};
// (undocumented)
http: {
registerAuth: HttpServiceSetup['registerAuth'];
registerOnRequest: HttpServiceSetup['registerOnRequest'];
getBasePathFor: HttpServiceSetup['getBasePathFor'];
setBasePathFor: HttpServiceSetup['setBasePathFor'];
};
}
// @public (undocumented)
export interface PluginsServiceSetup {
// (undocumented)
@ -306,10 +310,6 @@ export interface PluginsServiceStart {
contracts: Map<PluginName, unknown>;
}
// @public
export interface PluginStartContext {
}
// @public (undocumented)
export class Router {
constructor(path: string);
@ -338,9 +338,7 @@ export class ScopedClusterClient {
// Warnings were encountered during analysis:
//
// src/core/server/plugins/plugin_context.ts:35:10 - (ae-forgotten-export) The symbol "EnvironmentMode" needs to be exported by the entry point index.d.ts
// src/core/server/plugins/plugin_context.ts:34:10 - (ae-forgotten-export) The symbol "EnvironmentMode" needs to be exported by the entry point index.d.ts
// src/core/server/plugins/plugins_service.ts:37:5 - (ae-forgotten-export) The symbol "DiscoveredPluginInternal" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)
```

View file

@ -18,11 +18,11 @@
*/
import { cloneDeep } from 'lodash';
import { InjectedMetadataSetup } from '../../../../../core/public';
import { InternalCoreSetup } from '../../../../../core/public';
let newPlatformInjectedVars: InjectedMetadataSetup;
let newPlatformInjectedVars: InternalCoreSetup['injectedMetadata'];
export function __newPlatformSetup__(instance: InjectedMetadataSetup) {
export function __newPlatformSetup__(instance: InternalCoreSetup['injectedMetadata']) {
if (newPlatformInjectedVars) {
throw new Error('ui/chrome/api/injected_vars is already initialized');
}

View file

@ -33,7 +33,7 @@ import * as Rx from 'rxjs';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { CoreSetup } from 'kibana/public';
import { InternalCoreSetup } from 'kibana/public';
import { fatalError } from 'ui/notify';
import { capabilities } from 'ui/capabilities';
@ -77,7 +77,7 @@ export const configureAppAngularModule = (angularModule: IModule) => {
.run($setupUrlOverflowHandling(newPlatform));
};
const getEsUrl = (newPlatform: CoreSetup) => {
const getEsUrl = (newPlatform: InternalCoreSetup) => {
const a = document.createElement('a');
a.href = newPlatform.basePath.addToPath('/elasticsearch');
const protocolPort = /https/.test(a.protocol) ? 443 : 80;
@ -90,13 +90,15 @@ const getEsUrl = (newPlatform: CoreSetup) => {
};
};
const setupCompileProvider = (newPlatform: CoreSetup) => ($compileProvider: ICompileProvider) => {
const setupCompileProvider = (newPlatform: InternalCoreSetup) => (
$compileProvider: ICompileProvider
) => {
if (!newPlatform.injectedMetadata.getLegacyMetadata().devMode) {
$compileProvider.debugInfoEnabled(false);
}
};
const setupLocationProvider = (newPlatform: CoreSetup) => (
const setupLocationProvider = (newPlatform: InternalCoreSetup) => (
$locationProvider: ILocationProvider
) => {
$locationProvider.html5Mode({
@ -108,7 +110,7 @@ const setupLocationProvider = (newPlatform: CoreSetup) => (
$locationProvider.hashPrefix('');
};
export const $setupXsrfRequestInterceptor = (newPlatform: CoreSetup) => {
export const $setupXsrfRequestInterceptor = (newPlatform: InternalCoreSetup) => {
const version = newPlatform.injectedMetadata.getLegacyMetadata().version;
// Configure jQuery prefilter
@ -143,7 +145,7 @@ export const $setupXsrfRequestInterceptor = (newPlatform: CoreSetup) => {
* @param {HttpService} $http
* @return {undefined}
*/
const capture$httpLoadingCount = (newPlatform: CoreSetup) => (
const capture$httpLoadingCount = (newPlatform: InternalCoreSetup) => (
$rootScope: IRootScopeService,
$http: IHttpService
) => {
@ -164,7 +166,7 @@ const capture$httpLoadingCount = (newPlatform: CoreSetup) => (
* lets us integrate with the angular router so that we can automatically clear
* the breadcrumbs if we switch to a Kibana app that does not use breadcrumbs correctly
*/
const $setupBreadcrumbsAutoClear = (newPlatform: CoreSetup) => (
const $setupBreadcrumbsAutoClear = (newPlatform: InternalCoreSetup) => (
$rootScope: IRootScopeService,
$injector: any
) => {
@ -211,7 +213,7 @@ const $setupBreadcrumbsAutoClear = (newPlatform: CoreSetup) => (
* lets us integrate with the angular router so that we can automatically clear
* the badge if we switch to a Kibana app that does not use the badge correctly
*/
const $setupBadgeAutoClear = (newPlatform: CoreSetup) => (
const $setupBadgeAutoClear = (newPlatform: InternalCoreSetup) => (
$rootScope: IRootScopeService,
$injector: any
) => {
@ -251,7 +253,7 @@ const $setupBadgeAutoClear = (newPlatform: CoreSetup) => (
* the helpExtension if we switch to a Kibana app that does not set its own
* helpExtension
*/
const $setupHelpExtensionAutoClear = (newPlatform: CoreSetup) => (
const $setupHelpExtensionAutoClear = (newPlatform: InternalCoreSetup) => (
$rootScope: IRootScopeService,
$injector: any
) => {
@ -283,7 +285,7 @@ const $setupHelpExtensionAutoClear = (newPlatform: CoreSetup) => (
});
};
const $setupUrlOverflowHandling = (newPlatform: CoreSetup) => (
const $setupUrlOverflowHandling = (newPlatform: InternalCoreSetup) => (
$location: ILocationService,
$rootScope: IRootScopeService,
Private: any,

View file

@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
import { CoreSetup, CoreStart } from '../../../../core/public';
import { InternalCoreSetup, InternalCoreStart } from '../../../../core/public';
const runtimeContext = {
setup: {
core: (null as unknown) as CoreSetup,
core: (null as unknown) as InternalCoreSetup,
plugins: {},
},
start: {
core: (null as unknown) as CoreStart,
core: (null as unknown) as InternalCoreStart,
plugins: {},
},
};
@ -34,11 +34,11 @@ const runtimeContext = {
* @internal
*/
export function __reset__() {
runtimeContext.setup.core = (null as unknown) as CoreSetup;
runtimeContext.start.core = (null as unknown) as CoreStart;
runtimeContext.setup.core = (null as unknown) as InternalCoreSetup;
runtimeContext.start.core = (null as unknown) as InternalCoreStart;
}
export async function __newPlatformSetup__(core: CoreSetup) {
export async function __newPlatformSetup__(core: InternalCoreSetup) {
if (runtimeContext.setup.core) {
throw new Error('New platform core api was already set up');
}
@ -52,7 +52,7 @@ export async function __newPlatformSetup__(core: CoreSetup) {
}
}
export async function __newPlatformStart__(core: CoreStart) {
export async function __newPlatformStart__(core: InternalCoreStart) {
if (runtimeContext.start.core) {
throw new Error('New platform core api was already started');
}

View file

@ -17,10 +17,10 @@
* under the License.
*/
import { Plugin, PluginSetupContext } from 'kibana/public';
import { Plugin, CoreSetup } from 'kibana/public';
export class TestbedPlugin implements Plugin<TestbedPluginSetup, TestbedPluginStart> {
public setup(core: PluginSetupContext, deps: {}) {
public setup(core: CoreSetup, deps: {}) {
// eslint-disable-next-line no-console
console.log(`Testbed plugin set up`);
}

View file

@ -20,13 +20,7 @@
import { map, mergeMap } from 'rxjs/operators';
import { schema, TypeOf } from '@kbn/config-schema';
import {
Logger,
PluginInitializerContext,
PluginName,
PluginSetupContext,
PluginStartContext,
} from 'kibana/server';
import { CoreSetup, CoreStart, Logger, PluginInitializerContext, PluginName } from 'kibana/server';
export const config = {
schema: schema.object({
@ -43,11 +37,9 @@ class Plugin {
this.log = this.initializerContext.logger.get();
}
public setup(setupContext: PluginSetupContext, deps: Record<PluginName, unknown>) {
public setup(core: CoreSetup, deps: Record<PluginName, unknown>) {
this.log.debug(
`Setting up TestBed with core contract [${Object.keys(setupContext)}] and deps [${Object.keys(
deps
)}]`
`Setting up TestBed with core contract [${Object.keys(core)}] and deps [${Object.keys(deps)}]`
);
return {
@ -57,22 +49,22 @@ class Plugin {
return `Some exposed data derived from config: ${configValue.secret}`;
})
),
pingElasticsearch$: setupContext.elasticsearch.adminClient$.pipe(
pingElasticsearch$: core.elasticsearch.adminClient$.pipe(
mergeMap(client => client.callAsInternalUser('ping'))
),
};
}
public start(startContext: PluginStartContext, deps: Record<PluginName, unknown>) {
public start(core: CoreStart, deps: Record<PluginName, unknown>) {
this.log.debug(
`Starting up TestBed testbed with core contract [${Object.keys(
startContext
core
)}] and deps [${Object.keys(deps)}]`
);
return {
getStartContext() {
return startContext;
return core;
},
};
}

View file

@ -17,10 +17,10 @@
* under the License.
*/
import { Plugin, PluginSetupContext } from 'kibana/public';
import { Plugin, CoreSetup } from 'kibana/public';
export class CorePluginAPlugin implements Plugin<CorePluginAPluginSetup, CorePluginAPluginStart> {
public setup(core: PluginSetupContext, deps: {}) {
public setup(core: CoreSetup, deps: {}) {
return {
getGreeting() {
return 'Hello from Plugin A!';

View file

@ -17,7 +17,7 @@
* under the License.
*/
import { Plugin, PluginSetupContext } from 'kibana/public';
import { Plugin, CoreSetup } from 'kibana/public';
import { CorePluginAPluginSetup } from '../../core_plugin_a/public/plugin';
declare global {
@ -32,7 +32,7 @@ export interface CorePluginBDeps {
export class CorePluginBPlugin
implements Plugin<CorePluginBPluginSetup, CorePluginBPluginStart, CorePluginBDeps> {
public setup(core: PluginSetupContext, deps: CorePluginBDeps) {
public setup(core: CoreSetup, deps: CorePluginBDeps) {
window.corePluginB = `Plugin A said: ${deps.core_plugin_a.getGreeting()}`;
}

View file

@ -7,7 +7,10 @@
import { i18n } from '@kbn/i18n';
import { Server } from 'hapi';
import { resolve } from 'path';
import { CoreSetup, PluginInitializerContext } from 'src/core/server/index.js';
import {
InternalCoreSetup,
PluginInitializerContext
} from 'src/core/server/index.js';
import { LegacyPluginInitializer } from 'src/legacy/types';
import mappings from './mappings.json';
import { plugin } from './server/new-platform/index';
@ -106,7 +109,7 @@ export const apm: LegacyPluginInitializer = kibana => {
http: {
server
}
} as CoreSetup;
} as InternalCoreSetup;
plugin(initializerContext).setup(core);
}
});

View file

@ -4,12 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { getSavedObjectsClient } from '../helpers/saved_objects_client';
import { APM_TELEMETRY_DOC_ID, createApmTelementry } from './apm_telemetry';
export interface CoreSetupWithUsageCollector extends CoreSetup {
http: CoreSetup['http'] & {
export interface CoreSetupWithUsageCollector extends InternalCoreSetup {
http: InternalCoreSetup['http'] & {
server: {
usage: {
collectorSet: {

View file

@ -3,11 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { getSavedObjectsClient } from '../helpers/saved_objects_client';
import indexPattern from '../../../../../../src/legacy/core_plugins/kibana/server/tutorials/apm/index_pattern.json';
export async function ensureIndexPatternExists(core: CoreSetup) {
export async function ensureIndexPatternExists(core: InternalCoreSetup) {
const { server } = core.http;
const config = server.config();
const apmIndexPatternTitle = config.get('apm_oss.indexPattern');

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { makeApmUsageCollector } from '../lib/apm_telemetry';
import { ensureIndexPatternExists } from '../lib/index_pattern';
import { CoreSetupWithUsageCollector } from '../lib/apm_telemetry/make_apm_usage_collector';
@ -15,7 +15,7 @@ import { initTracesApi } from '../routes/traces';
import { initTransactionGroupsApi } from '../routes/transaction_groups';
export class Plugin {
public setup(core: CoreSetup) {
public setup(core: InternalCoreSetup) {
initTransactionGroupsApi(core);
initTracesApi(core);
initServicesApi(core);

View file

@ -5,7 +5,7 @@
*/
import { flatten } from 'lodash';
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { initErrorsApi } from '../errors';
import { initServicesApi } from '../services';
import { initTracesApi } from '../traces';
@ -13,13 +13,13 @@ import { initTracesApi } from '../traces';
describe('route handlers should fail with a Boom error', () => {
let consoleErrorSpy: any;
async function testRouteFailures(init: (core: CoreSetup) => void) {
async function testRouteFailures(init: (core: InternalCoreSetup) => void) {
const mockServer = { route: jest.fn() };
const mockCore = ({
http: {
server: mockServer
}
} as unknown) as CoreSetup;
} as unknown) as InternalCoreSetup;
init(mockCore);
expect(mockServer.route).toHaveBeenCalled();

View file

@ -7,7 +7,7 @@
import Boom from 'boom';
import Joi from 'joi';
import { Legacy } from 'kibana';
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { getDistribution } from '../lib/errors/distribution/get_distribution';
import { getErrorGroup } from '../lib/errors/get_error_group';
import { getErrorGroups } from '../lib/errors/get_error_groups';
@ -21,7 +21,7 @@ const defaultErrorHandler = (err: Error) => {
throw Boom.boomify(err, { statusCode: 400 });
};
export function initErrorsApi(core: CoreSetup) {
export function initErrorsApi(core: InternalCoreSetup) {
const { server } = core.http;
server.route({
method: 'GET',

View file

@ -6,7 +6,7 @@
import Boom from 'boom';
import Joi from 'joi';
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { withDefaultValidators } from '../lib/helpers/input_validation';
import { setupRequest } from '../lib/helpers/setup_request';
import { getMetricsChartDataByAgent } from '../lib/metrics/get_metrics_chart_data_by_agent';
@ -17,7 +17,7 @@ const defaultErrorHandler = (err: Error) => {
throw Boom.boomify(err, { statusCode: 400 });
};
export function initMetricsApi(core: CoreSetup) {
export function initMetricsApi(core: InternalCoreSetup) {
const { server } = core.http;
server.route({

View file

@ -6,7 +6,7 @@
import Boom from 'boom';
import Joi from 'joi';
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { AgentName } from '../../typings/es_schemas/ui/fields/Agent';
import { createApmTelementry, storeApmTelemetry } from '../lib/apm_telemetry';
import { withDefaultValidators } from '../lib/helpers/input_validation';
@ -22,7 +22,7 @@ const defaultErrorHandler = (err: Error) => {
throw Boom.boomify(err, { statusCode: 400 });
};
export function initServicesApi(core: CoreSetup) {
export function initServicesApi(core: InternalCoreSetup) {
const { server } = core.http;
server.route({
method: 'GET',

View file

@ -6,7 +6,7 @@
import Boom from 'boom';
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { withDefaultValidators } from '../lib/helpers/input_validation';
import { setupRequest } from '../lib/helpers/setup_request';
import { getTopTraces } from '../lib/traces/get_top_traces';
@ -19,7 +19,7 @@ const defaultErrorHandler = (err: Error) => {
throw Boom.boomify(err, { statusCode: 400 });
};
export function initTracesApi(core: CoreSetup) {
export function initTracesApi(core: InternalCoreSetup) {
const { server } = core.http;
// Get trace list

View file

@ -6,7 +6,7 @@
import Boom from 'boom';
import Joi from 'joi';
import { CoreSetup } from 'src/core/server';
import { InternalCoreSetup } from 'src/core/server';
import { withDefaultValidators } from '../lib/helpers/input_validation';
import { setupRequest } from '../lib/helpers/setup_request';
import { getChartsData } from '../lib/transactions/charts';
@ -19,7 +19,7 @@ const defaultErrorHandler = (err: Error) => {
throw Boom.boomify(err, { statusCode: 400 });
};
export function initTransactionGroupsApi(core: CoreSetup) {
export function initTransactionGroupsApi(core: InternalCoreSetup) {
const { server } = core.http;
server.route({