introduce StartServicesAccessor type for CoreSetup.getStartServices (#60748) (#61070)

* create StartServicesAccessor type

* update generated doc

* update usages to use new type

* add missing public annotation
This commit is contained in:
Pierre Gayvallet 2020-03-24 16:30:16 +01:00 committed by GitHub
parent c2109b8a23
commit 6bc866a9b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 144 additions and 96 deletions

View file

@ -14,5 +14,5 @@ mount: AppMount<HistoryLocationState> | AppMountDeprecated<HistoryLocationState>
## Remarks
When function has two arguments, it will be called with a [context](./kibana-plugin-core-public.appmountcontext.md) as the first argument. This behavior is \*\*deprecated\*\*, and consumers should instead use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
When function has two arguments, it will be called with a [context](./kibana-plugin-core-public.appmountcontext.md) as the first argument. This behavior is \*\*deprecated\*\*, and consumers should instead use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.

View file

@ -17,5 +17,5 @@ export interface ApplicationSetup
| --- | --- |
| [register(app)](./kibana-plugin-core-public.applicationsetup.register.md) | Register an mountable application to the system. |
| [registerAppUpdater(appUpdater$)](./kibana-plugin-core-public.applicationsetup.registerappupdater.md) | Register an application updater that can be used to change the [AppUpdatableFields](./kibana-plugin-core-public.appupdatablefields.md) fields of all applications at runtime.<!-- -->This is meant to be used by plugins that needs to updates the whole list of applications. To only updates a specific application, use the <code>updater$</code> property of the registered application instead. |
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |

View file

@ -8,7 +8,7 @@
>
>
Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
<b>Signature:</b>

View file

@ -24,5 +24,5 @@ export interface ApplicationStart
| --- | --- |
| [getUrlForApp(appId, options)](./kibana-plugin-core-public.applicationstart.geturlforapp.md) | Returns an URL to a given app, including the global base path. By default, the URL is relative (/basePath/app/my-app). Use the <code>absolute</code> option to generate an absolute url (http://host:port/basePath/app/my-app)<!-- -->Note that when generating absolute urls, the protocol, host and port are determined from the browser location. |
| [navigateToApp(appId, options)](./kibana-plugin-core-public.applicationstart.navigatetoapp.md) | Navigate to a given app |
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationstart.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationstart.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |

View file

@ -8,7 +8,7 @@
>
>
Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
<b>Signature:</b>

View file

@ -8,7 +8,7 @@
>
>
The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
<b>Signature:</b>

View file

@ -18,5 +18,5 @@ export declare type AppMountDeprecated<HistoryLocationState = unknown> = (contex
## Remarks
When function has two arguments, it will be called with a [context](./kibana-plugin-core-public.appmountcontext.md) as the first argument. This behavior is \*\*deprecated\*\*, and consumers should instead use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.
When function has two arguments, it will be called with a [context](./kibana-plugin-core-public.appmountcontext.md) as the first argument. This behavior is \*\*deprecated\*\*, and consumers should instead use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->.

View file

@ -2,16 +2,12 @@
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [CoreSetup](./kibana-plugin-core-public.coresetup.md) &gt; [getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)
## CoreSetup.getStartServices() method
## CoreSetup.getStartServices property
Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-core-public.app.mount.md)<!-- -->. Promise will not resolve until Core and plugin dependencies have completed `start`<!-- -->.
[StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md)
<b>Signature:</b>
```typescript
getStartServices(): Promise<[CoreStart, TPluginsStart]>;
getStartServices: StartServicesAccessor<TPluginsStart>;
```
<b>Returns:</b>
`Promise<[CoreStart, TPluginsStart]>`

View file

@ -19,14 +19,9 @@ export interface CoreSetup<TPluginsStart extends object = object>
| [application](./kibana-plugin-core-public.coresetup.application.md) | <code>ApplicationSetup</code> | [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) |
| [context](./kibana-plugin-core-public.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-core-public.contextsetup.md) |
| [fatalErrors](./kibana-plugin-core-public.coresetup.fatalerrors.md) | <code>FatalErrorsSetup</code> | [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) |
| [getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md) | <code>StartServicesAccessor&lt;TPluginsStart&gt;</code> | [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) |
| [http](./kibana-plugin-core-public.coresetup.http.md) | <code>HttpSetup</code> | [HttpSetup](./kibana-plugin-core-public.httpsetup.md) |
| [injectedMetadata](./kibana-plugin-core-public.coresetup.injectedmetadata.md) | <code>{</code><br/><code> getInjectedVar: (name: string, defaultValue?: any) =&gt; unknown;</code><br/><code> }</code> | exposed temporarily until https://github.com/elastic/kibana/issues/41990 done use \*only\* to retrieve config values. There is no way to set injected values in the new platform. Use the legacy platform API instead. |
| [notifications](./kibana-plugin-core-public.coresetup.notifications.md) | <code>NotificationsSetup</code> | [NotificationsSetup](./kibana-plugin-core-public.notificationssetup.md) |
| [uiSettings](./kibana-plugin-core-public.coresetup.uisettings.md) | <code>IUiSettingsClient</code> | [IUiSettingsClient](./kibana-plugin-core-public.iuisettingsclient.md) |
## Methods
| Method | Description |
| --- | --- |
| [getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md) | Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-core-public.app.mount.md)<!-- -->. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. |

View file

@ -38,7 +38,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [AppLeaveDefaultAction](./kibana-plugin-core-public.appleavedefaultaction.md) | Action to return from a [AppLeaveHandler](./kibana-plugin-core-public.appleavehandler.md) to execute the default behaviour when leaving the application.<!-- -->See |
| [ApplicationSetup](./kibana-plugin-core-public.applicationsetup.md) | |
| [ApplicationStart](./kibana-plugin-core-public.applicationstart.md) | |
| [AppMountContext](./kibana-plugin-core-public.appmountcontext.md) | The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
| [AppMountContext](./kibana-plugin-core-public.appmountcontext.md) | The context object received when applications are mounted to the DOM. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
| [AppMountParameters](./kibana-plugin-core-public.appmountparameters.md) | |
| [Capabilities](./kibana-plugin-core-public.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. |
| [ChromeBadge](./kibana-plugin-core-public.chromebadge.md) | |
@ -153,6 +153,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
| [SavedObjectAttributeSingle](./kibana-plugin-core-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) |
| [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) |
| [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) | Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-core-public.app.mount.md)<!-- -->. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. |
| [StringValidation](./kibana-plugin-core-public.stringvalidation.md) | Allows regex objects or a regex string |
| [Toast](./kibana-plugin-core-public.toast.md) | |
| [ToastInput](./kibana-plugin-core-public.toastinput.md) | Inputs for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs. |

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md)
## StartServicesAccessor type
Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-core-public.app.mount.md)<!-- -->. Promise will not resolve until Core and plugin dependencies have completed `start`<!-- -->.
<b>Signature:</b>
```typescript
export declare type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<[CoreStart, TPluginsStart]>;
```

View file

@ -2,16 +2,12 @@
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [CoreSetup](./kibana-plugin-core-server.coresetup.md) &gt; [getStartServices](./kibana-plugin-core-server.coresetup.getstartservices.md)
## CoreSetup.getStartServices() method
## CoreSetup.getStartServices property
Allows plugins to get access to APIs available in start inside async handlers. Promise will not resolve until Core and plugin dependencies have completed `start`<!-- -->. This should only be used inside handlers registered during `setup` that will only be executed after `start` lifecycle.
[StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md)
<b>Signature:</b>
```typescript
getStartServices(): Promise<[CoreStart, TPluginsStart]>;
getStartServices: StartServicesAccessor<TPluginsStart>;
```
<b>Returns:</b>
`Promise<[CoreStart, TPluginsStart]>`

View file

@ -19,15 +19,10 @@ export interface CoreSetup<TPluginsStart extends object = object>
| [capabilities](./kibana-plugin-core-server.coresetup.capabilities.md) | <code>CapabilitiesSetup</code> | [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) |
| [context](./kibana-plugin-core-server.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-core-server.contextsetup.md) |
| [elasticsearch](./kibana-plugin-core-server.coresetup.elasticsearch.md) | <code>ElasticsearchServiceSetup</code> | [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) |
| [getStartServices](./kibana-plugin-core-server.coresetup.getstartservices.md) | <code>StartServicesAccessor&lt;TPluginsStart&gt;</code> | [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) |
| [http](./kibana-plugin-core-server.coresetup.http.md) | <code>HttpServiceSetup</code> | [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) |
| [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | <code>MetricsServiceSetup</code> | [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) |
| [savedObjects](./kibana-plugin-core-server.coresetup.savedobjects.md) | <code>SavedObjectsServiceSetup</code> | [SavedObjectsServiceSetup](./kibana-plugin-core-server.savedobjectsservicesetup.md) |
| [uiSettings](./kibana-plugin-core-server.coresetup.uisettings.md) | <code>UiSettingsServiceSetup</code> | [UiSettingsServiceSetup](./kibana-plugin-core-server.uisettingsservicesetup.md) |
| [uuid](./kibana-plugin-core-server.coresetup.uuid.md) | <code>UuidServiceSetup</code> | [UuidServiceSetup](./kibana-plugin-core-server.uuidservicesetup.md) |
## Methods
| Method | Description |
| --- | --- |
| [getStartServices()](./kibana-plugin-core-server.coresetup.getstartservices.md) | Allows plugins to get access to APIs available in start inside async handlers. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. This should only be used inside handlers registered during <code>setup</code> that will only be executed after <code>start</code> lifecycle. |

View file

@ -259,6 +259,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) | Describe a [saved object type mapping](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) field.<!-- -->Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) For the mapping documentation |
| [ScopeableRequest](./kibana-plugin-core-server.scopeablerequest.md) | A user credentials container. It accommodates the necessary auth credentials to impersonate the current user.<!-- -->See [KibanaRequest](./kibana-plugin-core-server.kibanarequest.md)<!-- -->. |
| [SharedGlobalConfig](./kibana-plugin-core-server.sharedglobalconfig.md) | |
| [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) | Allows plugins to get access to APIs available in start inside async handlers. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. This should only be used inside handlers registered during <code>setup</code> that will only be executed after <code>start</code> lifecycle. |
| [StringValidation](./kibana-plugin-core-server.stringvalidation.md) | Allows regex objects or a regex string |
| [UiSettingsType](./kibana-plugin-core-server.uisettingstype.md) | UI element type to represent the settings. |

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md)
## StartServicesAccessor type
Allows plugins to get access to APIs available in start inside async handlers. Promise will not resolve until Core and plugin dependencies have completed `start`<!-- -->. This should only be used inside handlers registered during `setup` that will only be executed after `start` lifecycle.
<b>Signature:</b>
```typescript
export declare type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<[CoreStart, TPluginsStart]>;
```

View file

@ -60,6 +60,7 @@
| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | |
| [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | |
| [search](./kibana-plugin-plugins-data-server.search.md) | |
## Type Aliases
@ -69,5 +70,6 @@
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [ISearch](./kibana-plugin-plugins-data-server.isearch.md) | |
| [ISearchCancel](./kibana-plugin-plugins-data-server.isearchcancel.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | |
| [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. |

View file

@ -209,15 +209,21 @@ export interface CoreSetup<TPluginsStart extends object = object> {
injectedMetadata: {
getInjectedVar: (name: string, defaultValue?: any) => unknown;
};
/**
* Allows plugins to get access to APIs available in start inside async
* handlers, such as {@link App.mount}. Promise will not resolve until Core
* and plugin dependencies have completed `start`.
*/
getStartServices(): Promise<[CoreStart, TPluginsStart]>;
/** {@link StartServicesAccessor} */
getStartServices: StartServicesAccessor<TPluginsStart>;
}
/**
* Allows plugins to get access to APIs available in start inside async
* handlers, such as {@link App.mount}. Promise will not resolve until Core
* and plugin dependencies have completed `start`.
*
* @public
*/
export type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<
[CoreStart, TPluginsStart]
>;
/**
* Core services exposed to the `Plugin` start lifecycle
*

View file

@ -378,7 +378,8 @@ export interface CoreSetup<TPluginsStart extends object = object> {
context: ContextSetup;
// (undocumented)
fatalErrors: FatalErrorsSetup;
getStartServices(): Promise<[CoreStart, TPluginsStart]>;
// (undocumented)
getStartServices: StartServicesAccessor<TPluginsStart>;
// (undocumented)
http: HttpSetup;
// @deprecated
@ -1235,6 +1236,9 @@ export class SimpleSavedObject<T = unknown> {
_version?: SavedObject<T>['version'];
}
// @public
export type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<[CoreStart, TPluginsStart]>;
// @public
export type StringValidation = StringValidationRegex | StringValidationRegexString;

View file

@ -352,15 +352,22 @@ export interface CoreSetup<TPluginsStart extends object = object> {
uuid: UuidServiceSetup;
/** {@link MetricsServiceSetup} */
metrics: MetricsServiceSetup;
/**
* Allows plugins to get access to APIs available in start inside async handlers.
* Promise will not resolve until Core and plugin dependencies have completed `start`.
* This should only be used inside handlers registered during `setup` that will only be executed
* after `start` lifecycle.
*/
getStartServices(): Promise<[CoreStart, TPluginsStart]>;
/** {@link StartServicesAccessor} */
getStartServices: StartServicesAccessor<TPluginsStart>;
}
/**
* Allows plugins to get access to APIs available in start inside async handlers.
* Promise will not resolve until Core and plugin dependencies have completed `start`.
* This should only be used inside handlers registered during `setup` that will only be executed
* after `start` lifecycle.
*
* @public
*/
export type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<
[CoreStart, TPluginsStart]
>;
/**
* Context passed to the plugins `start` method.
*

View file

@ -629,7 +629,8 @@ export interface CoreSetup<TPluginsStart extends object = object> {
context: ContextSetup;
// (undocumented)
elasticsearch: ElasticsearchServiceSetup;
getStartServices(): Promise<[CoreStart, TPluginsStart]>;
// (undocumented)
getStartServices: StartServicesAccessor<TPluginsStart>;
// (undocumented)
http: HttpServiceSetup;
// (undocumented)
@ -2269,6 +2270,9 @@ export type SharedGlobalConfig = RecursiveReadonly_2<{
path: Pick<PathConfigType, typeof SharedGlobalConfigKeys.path[number]>;
}>;
// @public
export type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<[CoreStart, TPluginsStart]>;
// @public
export type StringValidation = StringValidationRegex | StringValidationRegexString;

View file

@ -24,7 +24,7 @@ import { i18n } from '@kbn/i18n';
import { I18nProvider } from '@kbn/i18n/react';
import { AdvancedSettings } from './advanced_settings';
import { ManagementSetup } from '../../../management/public';
import { CoreSetup } from '../../../../core/public';
import { StartServicesAccessor } from '../../../../core/public';
import { ComponentRegistry } from '../types';
const title = i18n.translate('advancedSettings.advancedSettingsLabel', {
@ -48,7 +48,7 @@ export async function registerAdvSettingsMgmntApp({
componentRegistry,
}: {
management: ManagementSetup;
getStartServices: CoreSetup['getStartServices'];
getStartServices: StartServicesAccessor;
componentRegistry: ComponentRegistry['start'];
}) {
const kibanaSection = management.sections.getSection('kibana');

View file

@ -17,12 +17,12 @@
* under the License.
*/
import { CoreSetup, IRouter, Logger } from 'kibana/server';
import { StartServicesAccessor, IRouter, Logger } from 'kibana/server';
import { schema } from '@kbn/config-schema';
export function registerKqlTelemetryRoute(
router: IRouter,
getStartServices: CoreSetup['getStartServices'],
getStartServices: StartServicesAccessor,
logger: Logger
) {
router.post(

View file

@ -26,7 +26,7 @@ import { KibanaLegacySetup } from '../../kibana_legacy/public';
import { LegacyManagementSection } from './legacy';
import { ManagementChrome } from './components';
import { ManagementSection } from './management_section';
import { ChromeBreadcrumb, CoreSetup } from '../../../core/public/';
import { ChromeBreadcrumb, StartServicesAccessor } from '../../../core/public/';
export class ManagementApp {
readonly id: string;
@ -41,7 +41,7 @@ export class ManagementApp {
getSections: () => ManagementSection[],
registerLegacyApp: KibanaLegacySetup['registerLegacyApp'],
getLegacyManagementSections: () => LegacyManagementSection,
getStartServices: CoreSetup['getStartServices']
getStartServices: StartServicesAccessor
) {
this.id = id;
this.title = title;

View file

@ -19,7 +19,7 @@
import { CreateSection, RegisterManagementAppArgs } from './types';
import { KibanaLegacySetup } from '../../kibana_legacy/public';
import { CoreSetup } from '../../../core/public';
import { StartServicesAccessor } from '../../../core/public';
// @ts-ignore
import { LegacyManagementSection } from './legacy';
import { ManagementApp } from './management_app';
@ -34,14 +34,14 @@ export class ManagementSection {
private readonly getSections: () => ManagementSection[];
private readonly registerLegacyApp: KibanaLegacySetup['registerLegacyApp'];
private readonly getLegacyManagementSection: () => LegacyManagementSection;
private readonly getStartServices: CoreSetup['getStartServices'];
private readonly getStartServices: StartServicesAccessor;
constructor(
{ id, title, order = 100, euiIconType, icon }: CreateSection,
getSections: () => ManagementSection[],
registerLegacyApp: KibanaLegacySetup['registerLegacyApp'],
getLegacyManagementSection: () => ManagementSection,
getStartServices: CoreSetup['getStartServices']
getStartServices: StartServicesAccessor
) {
this.id = id;
this.title = title;

View file

@ -22,7 +22,7 @@ import { KibanaLegacySetup } from '../../kibana_legacy/public';
// @ts-ignore
import { LegacyManagementSection } from './legacy';
import { CreateSection } from './types';
import { CoreSetup, CoreStart } from '../../../core/public';
import { StartServicesAccessor, CoreStart } from '../../../core/public';
export class ManagementService {
private sections: ManagementSection[] = [];
@ -30,7 +30,7 @@ export class ManagementService {
private register(
registerLegacyApp: KibanaLegacySetup['registerLegacyApp'],
getLegacyManagement: () => LegacyManagementSection,
getStartServices: CoreSetup['getStartServices']
getStartServices: StartServicesAccessor
) {
return (section: CreateSection) => {
if (this.getSection(section.id)) {
@ -71,7 +71,7 @@ export class ManagementService {
public setup(
kibanaLegacy: KibanaLegacySetup,
getLegacyManagement: () => LegacyManagementSection,
getStartServices: CoreSetup['getStartServices']
getStartServices: StartServicesAccessor
) {
const register = this.register.bind(this)(
kibanaLegacy.registerLegacyApp,

View file

@ -4,14 +4,19 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { CoreSetup, SavedObject, SavedObjectsBaseOptions } from 'src/core/server';
import {
StartServicesAccessor,
SavedObject,
SavedObjectsBaseOptions,
SavedObjectsServiceSetup,
} from 'src/core/server';
import { EncryptedSavedObjectsService } from '../crypto';
import { EncryptedSavedObjectsClientWrapper } from './encrypted_saved_objects_client_wrapper';
interface SetupSavedObjectsParams {
service: PublicMethodsOf<EncryptedSavedObjectsService>;
savedObjects: CoreSetup['savedObjects'];
getStartServices: CoreSetup['getStartServices'];
savedObjects: SavedObjectsServiceSetup;
getStartServices: StartServicesAccessor;
}
export interface SavedObjectsSetup {

View file

@ -5,14 +5,14 @@
*/
import { i18n } from '@kbn/i18n';
import { CoreSetup, AppMountParameters } from 'src/core/public';
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public';
import { AuthenticationServiceSetup } from '../authentication';
import { UserAPIClient } from '../management';
interface CreateDeps {
application: CoreSetup['application'];
application: ApplicationSetup;
authc: AuthenticationServiceSetup;
getStartServices: CoreSetup['getStartServices'];
getStartServices: StartServicesAccessor;
}
export const accountManagementApp = Object.freeze({

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { ApplicationSetup, CoreSetup, HttpSetup } from 'src/core/public';
import { ApplicationSetup, StartServicesAccessor, HttpSetup } from 'src/core/public';
import { AuthenticatedUser } from '../../common/model';
import { ConfigType } from '../config';
import { PluginStartDependencies } from '../plugin';
@ -17,7 +17,7 @@ interface SetupParams {
application: ApplicationSetup;
config: ConfigType;
http: HttpSetup;
getStartServices: CoreSetup<PluginStartDependencies>['getStartServices'];
getStartServices: StartServicesAccessor<PluginStartDependencies>;
}
export interface AuthenticationServiceSetup {

View file

@ -5,12 +5,17 @@
*/
import { i18n } from '@kbn/i18n';
import { CoreSetup, AppMountParameters, HttpSetup } from 'src/core/public';
import {
StartServicesAccessor,
ApplicationSetup,
AppMountParameters,
HttpSetup,
} from 'src/core/public';
interface CreateDeps {
application: CoreSetup['application'];
application: ApplicationSetup;
http: HttpSetup;
getStartServices: CoreSetup['getStartServices'];
getStartServices: StartServicesAccessor;
}
export const loggedOutApp = Object.freeze({

View file

@ -5,13 +5,18 @@
*/
import { i18n } from '@kbn/i18n';
import { CoreSetup, AppMountParameters, HttpSetup } from 'src/core/public';
import {
StartServicesAccessor,
AppMountParameters,
ApplicationSetup,
HttpSetup,
} from 'src/core/public';
import { ConfigType } from '../../config';
interface CreateDeps {
application: CoreSetup['application'];
application: ApplicationSetup;
http: HttpSetup;
getStartServices: CoreSetup['getStartServices'];
getStartServices: StartServicesAccessor;
config: Pick<ConfigType, 'loginAssistanceMessage'>;
}

View file

@ -5,13 +5,13 @@
*/
import { i18n } from '@kbn/i18n';
import { CoreSetup, AppMountParameters } from 'src/core/public';
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public';
import { AuthenticationServiceSetup } from '../authentication_service';
interface CreateDeps {
application: CoreSetup['application'];
application: ApplicationSetup;
authc: AuthenticationServiceSetup;
getStartServices: CoreSetup['getStartServices'];
getStartServices: StartServicesAccessor;
}
export const overwrittenSessionApp = Object.freeze({

View file

@ -7,7 +7,7 @@
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { i18n } from '@kbn/i18n';
import { CoreSetup } from 'src/core/public';
import { StartServicesAccessor } from 'src/core/public';
import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public';
import { PluginStartDependencies } from '../../plugin';
import { APIKeysGridPage } from './api_keys_grid';
@ -15,7 +15,7 @@ import { APIKeysAPIClient } from './api_keys_api_client';
import { DocumentationLinksService } from './documentation_links';
interface CreateParams {
getStartServices: CoreSetup<PluginStartDependencies>['getStartServices'];
getStartServices: StartServicesAccessor<PluginStartDependencies>;
}
export const apiKeysManagementApp = Object.freeze({

View file

@ -6,7 +6,7 @@
import { Subscription } from 'rxjs';
import { i18n } from '@kbn/i18n';
import { CoreSetup, FatalErrorsSetup } from 'src/core/public';
import { StartServicesAccessor, FatalErrorsSetup } from 'src/core/public';
import {
ManagementApp,
ManagementSetup,
@ -25,7 +25,7 @@ interface SetupParams {
license: SecurityLicense;
authc: AuthenticationServiceSetup;
fatalErrors: FatalErrorsSetup;
getStartServices: CoreSetup<PluginStartDependencies>['getStartServices'];
getStartServices: StartServicesAccessor<PluginStartDependencies>;
}
interface StartParams {

View file

@ -8,7 +8,7 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { HashRouter as Router, Route, Switch, useParams } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { CoreSetup } from 'src/core/public';
import { StartServicesAccessor } from 'src/core/public';
import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public';
import { PluginStartDependencies } from '../../plugin';
import { RolesAPIClient } from '../roles';
@ -18,7 +18,7 @@ import { RoleMappingsGridPage } from './role_mappings_grid';
import { EditRoleMappingPage } from './edit_role_mapping';
interface CreateParams {
getStartServices: CoreSetup<PluginStartDependencies>['getStartServices'];
getStartServices: StartServicesAccessor<PluginStartDependencies>;
}
export const roleMappingsManagementApp = Object.freeze({

View file

@ -8,7 +8,7 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { HashRouter as Router, Route, Switch, useParams } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { CoreSetup, FatalErrorsSetup } from 'src/core/public';
import { StartServicesAccessor, FatalErrorsSetup } from 'src/core/public';
import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public';
import { SecurityLicense } from '../../../common/licensing';
import { PluginStartDependencies } from '../../plugin';
@ -23,7 +23,7 @@ import { PrivilegesAPIClient } from './privileges_api_client';
interface CreateParams {
fatalErrors: FatalErrorsSetup;
license: SecurityLicense;
getStartServices: CoreSetup<PluginStartDependencies>['getStartServices'];
getStartServices: StartServicesAccessor<PluginStartDependencies>;
}
export const rolesManagementApp = Object.freeze({

View file

@ -8,7 +8,7 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { HashRouter as Router, Route, Switch, useParams } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { CoreSetup } from 'src/core/public';
import { StartServicesAccessor } from 'src/core/public';
import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public';
import { AuthenticationServiceSetup } from '../../authentication';
import { PluginStartDependencies } from '../../plugin';
@ -19,7 +19,7 @@ import { EditUserPage } from './edit_user';
interface CreateParams {
authc: AuthenticationServiceSetup;
getStartServices: CoreSetup<PluginStartDependencies>['getStartServices'];
getStartServices: StartServicesAccessor<PluginStartDependencies>;
}
export const usersManagementApp = Object.freeze({

View file

@ -5,7 +5,7 @@
*/
import { ManagementSetup, ManagementApp } from 'src/plugins/management/public';
import { CoreSetup, Capabilities } from 'src/core/public';
import { StartServicesAccessor, Capabilities } from 'src/core/public';
import { SecurityLicense } from '../../../security/public';
import { SpacesManager } from '../spaces_manager';
import { PluginsStart } from '../plugin';
@ -13,7 +13,7 @@ import { spacesManagementApp } from './spaces_management_app';
interface SetupDeps {
management: ManagementSetup;
getStartServices: CoreSetup<PluginsStart>['getStartServices'];
getStartServices: StartServicesAccessor<PluginsStart>;
spacesManager: SpacesManager;
securityLicense?: SecurityLicense;
}

View file

@ -8,7 +8,7 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { HashRouter as Router, Route, Switch, useParams } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { CoreSetup } from 'src/core/public';
import { StartServicesAccessor } from 'src/core/public';
import { SecurityLicense } from '../../../security/public';
import { RegisterManagementAppArgs } from '../../../../../src/plugins/management/public';
import { PluginsStart } from '../plugin';
@ -18,7 +18,7 @@ import { ManageSpacePage } from './edit_space';
import { Space } from '..';
interface CreateParams {
getStartServices: CoreSetup<PluginsStart>['getStartServices'];
getStartServices: StartServicesAccessor<PluginsStart>;
spacesManager: SpacesManager;
securityLicense?: SecurityLicense;
}

View file

@ -4,14 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { CoreSetup, AppMountParameters } from 'src/core/public';
import { StartServicesAccessor, ApplicationSetup, AppMountParameters } from 'src/core/public';
import { i18n } from '@kbn/i18n';
import { SpacesManager } from '../spaces_manager';
interface CreateDeps {
application: CoreSetup['application'];
application: ApplicationSetup;
spacesManager: SpacesManager;
getStartServices: CoreSetup['getStartServices'];
getStartServices: StartServicesAccessor;
}
export const spaceSelectorApp = Object.freeze({