mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[core] remove root index.ts file (#137001)
* [core] remove root index.ts file * remove support for `kibana/*` imports, replace instances in docs
This commit is contained in:
parent
703580f944
commit
03f1a218c5
23 changed files with 61 additions and 76 deletions
|
@ -122,7 +122,7 @@ If you are developing in TypeScript (which we recommend), you will need to add a
|
|||
core capabilities as an argument. It should return an instance of its plugin class for Kibana to load.
|
||||
|
||||
```ts
|
||||
import type { PluginInitializerContext } from 'kibana/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
import { DemoPlugin } from './plugin';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
|
@ -156,7 +156,7 @@ Using the non-`type` variation will increase the bundle size unnecessarily and m
|
|||
point, but all plugins at Elastic should be consistent in this way.
|
||||
|
||||
```ts
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
|
||||
export class DemoPlugin implements Plugin {
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
|
@ -184,7 +184,7 @@ export class DemoPlugin implements Plugin {
|
|||
`server/plugin.ts` is the server-side plugin definition. The shape of this plugin is the same as it’s client-side counter-part:
|
||||
|
||||
```ts
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
|
||||
export class DemoPlugin implements Plugin {
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
|
@ -240,7 +240,7 @@ For example, the core http service exposes a function createRouter to all plugin
|
|||
a plugin just accesses it off of the first argument:
|
||||
|
||||
```ts
|
||||
import type { CoreSetup } from 'kibana/server';
|
||||
import type { CoreSetup } from '@kbn/core/server';
|
||||
|
||||
export class DemoPlugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -260,7 +260,7 @@ dependency in it’s kibana.json manifest file.
|
|||
** foobar plugin.ts: **
|
||||
|
||||
```ts
|
||||
import type { Plugin } from 'kibana/server';
|
||||
import type { Plugin } from '@kbn/core/server';
|
||||
// [1]
|
||||
export interface FoobarPluginSetup {
|
||||
getFoo(): string;
|
||||
|
@ -306,7 +306,7 @@ export class MyPlugin implements Plugin<FoobarPluginSetup, FoobarPluginStart> {
|
|||
With that specified in the plugin manifest, the appropriate interfaces are then available via the second argument of setup and/or start:
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
import type { FoobarPluginSetup, FoobarPluginStart } from '../../foobar/server';
|
||||
|
||||
// [1]
|
||||
|
|
|
@ -33,7 +33,7 @@ some heavy-weight libraries that will also be removed from the initial
|
|||
plugin bundle, therefore, reducing its size by a significant amount.
|
||||
|
||||
```ts
|
||||
import type { Plugin, CoreSetup, AppMountParameters } from 'kibana/public';
|
||||
import type { Plugin, CoreSetup, AppMountParameters } from '@kbn/core/public';
|
||||
export class MyPlugin implements Plugin<MyPluginSetup> {
|
||||
setup(core: CoreSetup, plugins: SetupDeps) {
|
||||
core.application.register({
|
||||
|
|
|
@ -54,7 +54,7 @@ The following is a basic example for using the `uiSettings` service:
|
|||
|
||||
**src/plugins/charts/public/plugin.ts**
|
||||
```ts
|
||||
import { Plugin, CoreSetup } from 'kibana/public';
|
||||
import { Plugin, CoreSetup } from '@kbn/core/public';
|
||||
import { ExpressionsSetup } from '../../expressions/public';
|
||||
import { palette, systemPalette } from '../common';
|
||||
|
||||
|
@ -132,7 +132,7 @@ The example also shows how plugins can leverage the optional deprecation paramet
|
|||
```ts
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { CoreSetup, Plugin } from 'kibana/server';
|
||||
import { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
import { COLOR_MAPPING_SETTING, LEGACY_TIME_AXIS, palette, systemPalette } from '../common';
|
||||
import { ExpressionsServerSetup } from '../../expressions/server';
|
||||
|
||||
|
@ -192,7 +192,7 @@ For example, changing the time filter refresh interval triggers a prompt in the
|
|||
```ts
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { DocLinksServiceSetup, UiSettingsParams } from 'kibana/server';
|
||||
import type { DocLinksServiceSetup, UiSettingsParams } from '@kbn/core/server';
|
||||
import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../common';
|
||||
|
||||
export function getUiSettings(
|
||||
|
@ -231,7 +231,7 @@ For example, in 7.9.0, `siem` as renamed to `securitySolution`, and in 8.0.0, `t
|
|||
**src/core/server/ui_settings/saved_objects/migrations.ts**
|
||||
|
||||
```ts
|
||||
import { SavedObjectUnsanitizedDoc, SavedObjectSanitizedDoc } from 'kibana/server';
|
||||
import { SavedObjectUnsanitizedDoc, SavedObjectSanitizedDoc } from '@kbn/core/server';
|
||||
|
||||
export const migrations = {
|
||||
'7.9.0': (doc: SavedObjectUnsanitizedDoc<any>): SavedObjectSanitizedDoc<any> => ({
|
||||
|
|
|
@ -18,7 +18,7 @@ However, the recommended and easiest way to search Elasticsearch is by using the
|
|||
Here is a basic example for using the `data.search` service from a custom plugin:
|
||||
|
||||
```ts
|
||||
import { CoreStart, Plugin } from 'kibana/public';
|
||||
import { CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { DataPublicPluginStart, isCompleteResponse, isErrorResponse } from import { DataPublicPluginStart, isCompleteResponse, isErrorResponse } from '../../src/plugins/data';
|
||||
|
||||
export interface MyPluginStartDependencies {
|
||||
|
@ -189,7 +189,7 @@ export const mySearchStrategyProvider = (
|
|||
|
||||
```ts
|
||||
// ./myPlugin/server/plugin.ts
|
||||
import type { CoreSetup, CoreStart, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
|
||||
import { mySearchStrategyProvider } from './my_strategy';
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ the request.
|
|||
The following snippet demonstrate how to create a basic `GET` endpoint on the `/api/my_plugin/get_object` path:
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -86,7 +86,7 @@ export class MyPlugin implements Plugin {
|
|||
consuming the endpoint from the client-side using core's `http` service would then look like:
|
||||
|
||||
```ts
|
||||
import { HttpStart } from 'kibana/public';
|
||||
import { HttpStart } from '@kbn/core/public';
|
||||
|
||||
interface ResponseType {
|
||||
result: string;
|
||||
|
@ -105,7 +105,7 @@ of the route definition.
|
|||
|
||||
```ts
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -135,7 +135,7 @@ export class MyPlugin implements Plugin {
|
|||
consuming the endpoint from the client-side using core's `http` service would then look like:
|
||||
|
||||
```ts
|
||||
import { HttpStart } from 'kibana/public';
|
||||
import { HttpStart } from '@kbn/core/public';
|
||||
import { MyObjectType } from '../common/types';
|
||||
|
||||
async function fetchData(http: HttpStart, id: string) {
|
||||
|
@ -150,7 +150,7 @@ must be provided when registering a `post` handler that will access the payload.
|
|||
|
||||
```ts
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -182,7 +182,7 @@ export class MyPlugin implements Plugin {
|
|||
consuming the endpoint from the client-side using core's `http` service would then look like:
|
||||
|
||||
```ts
|
||||
import { HttpStart } from 'kibana/public';
|
||||
import { HttpStart } from '@kbn/core/public';
|
||||
|
||||
interface ResponseType {
|
||||
updated: boolean;
|
||||
|
@ -207,7 +207,7 @@ option of the route definition to be accessible from the handler.
|
|||
|
||||
```ts
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -236,7 +236,7 @@ export class MyPlugin implements Plugin {
|
|||
consuming the endpoint from the client-side using core's `http` service would then look like:
|
||||
|
||||
```ts
|
||||
import { HttpStart } from 'kibana/public';
|
||||
import { HttpStart } from '@kbn/core/public';
|
||||
import { MyObjectType } from '../common/types';
|
||||
|
||||
interface ResponseType {
|
||||
|
@ -264,7 +264,7 @@ All APIs of the `response` parameter of the handler accept a `headers` property
|
|||
to define headers to attach to the response.
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -300,7 +300,7 @@ However, some of the less commonly used return codes don't have such helpers. In
|
|||
and/or `response.customError` APIs should be used.
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -332,7 +332,7 @@ These observables can either be used directly, or be used to control an `AbortCo
|
|||
|
||||
```ts
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -371,7 +371,7 @@ and will return a `401 - Unauthorized` otherwise.
|
|||
It is possible to disable this requirement using the `authRequired` option of the route.
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -407,7 +407,7 @@ be achieved by using the `url` and `route` properties of the `request` parameter
|
|||
request.url / request.route
|
||||
|
||||
```ts
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
|
|
@ -590,7 +590,7 @@ Objects client:
|
|||
```typescript
|
||||
// src/plugins/myplugin/server/lib/short_url_lookup.ts
|
||||
import crypto from 'crypto';
|
||||
import { SavedObjectsClientContract } from 'kibana/server';
|
||||
import { SavedObjectsClientContract } from '@kbn/core/server';
|
||||
|
||||
export const shortUrlLookup = {
|
||||
generateUrlId(url: string, savedObjectsClient: SavedObjectsClientContract) {
|
||||
|
@ -1025,7 +1025,7 @@ data.
|
|||
```typescript
|
||||
// src/plugins/myplugin/public/plugin.ts
|
||||
import { METRIC_TYPE } from '@kbn/analytics';
|
||||
import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { DataPublicPluginSetup, DataPublicPluginStart } from '../../data/public';
|
||||
import { UsageCollectionSetup } from '../../usage_collection/public';
|
||||
import { SuggestionsService } from './suggestions';
|
||||
|
|
|
@ -6,7 +6,7 @@ NOTE: The Application service is only available client side.
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import { AppMountParameters, CoreSetup, Plugin, DEFAULT_APP_CATEGORIES } from 'kibana/public';
|
||||
import { AppMountParameters, CoreSetup, Plugin, DEFAULT_APP_CATEGORIES } from '@kbn/core/public';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
|
|
@ -38,7 +38,7 @@ export type MyPluginConfigType = TypeOf<typeof config.schema>;
|
|||
*my_plugin/server/index.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext } from 'kibana/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
export class MyPlugin {
|
||||
constructor(initializerContext: PluginInitializerContext) {
|
||||
this.config$ = initializerContext.config.create<MyPluginConfigType>();
|
||||
|
@ -57,7 +57,7 @@ allow-list property.
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import type { PluginConfigDescriptor } from 'kibana/server';
|
||||
import type { PluginConfigDescriptor } from '@kbn/core/server';
|
||||
|
||||
const configSchema = schema.object({
|
||||
secret: schema.string({ defaultValue: 'Only on server' }),
|
||||
|
@ -115,7 +115,7 @@ configuration root.
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import type { PluginConfigDescriptor } from 'kibana/server';
|
||||
import type { PluginConfigDescriptor } from '@kbn/core/server';
|
||||
|
||||
const configSchema = schema.object({
|
||||
newProperty: schema.string({ defaultValue: 'Some string' }),
|
||||
|
|
|
@ -14,7 +14,7 @@ See <<scoped-services>> and <<development-security>>.
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import { CoreStart, Plugin } from 'kibana/public';
|
||||
import { CoreStart, Plugin } from '@kbn/core/public';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public start(core: CoreStart) {
|
||||
|
|
|
@ -17,7 +17,7 @@ See {kib-repo}blob/{branch}/docs/development/core/server/kibana-plugin-core-serv
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup, Plugin } from 'kibana/server';
|
||||
import type { CoreSetup, Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -54,7 +54,7 @@ The client-side HttpService is a preconfigured wrapper around `window.fetch` tha
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import { CoreStart } from 'kibana/public';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
interface ResponseType {…};
|
||||
interface MyPluginData {…};
|
||||
async function fetchData<ResponseType>(core: CoreStart) {
|
||||
|
|
|
@ -8,7 +8,7 @@ These API's are injected into your plugin's lifecycle methods and may be invoked
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { PluginInitializerContext, CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin {
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
|
|
|
@ -6,7 +6,7 @@ NOTE: The Logging service is only available server side.
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext, CoreSetup, Plugin, Logger } from 'kibana/server';
|
||||
import type { PluginInitializerContext, CoreSetup, Plugin, Logger } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
private readonly logger: Logger;
|
||||
|
|
|
@ -35,7 +35,7 @@ the request handler context:
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { CoreSetup, RequestHandlerContext, IScopedClusterClient } from 'kibana/server';
|
||||
import type { CoreSetup, RequestHandlerContext, IScopedClusterClient } from '@kbn/core/server';
|
||||
|
||||
interface MyRequestHandlerContext extends RequestHandlerContext {
|
||||
myPlugin: {
|
||||
|
|
|
@ -82,7 +82,7 @@ The following example shows how to {kib-repo}blob/{branch}/docs/development/core
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup,Plugin } from 'kibana/server';
|
||||
import type { CoreSetup,Plugin } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
|
|
@ -57,7 +57,7 @@ It should return an instance of its plugin class for
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext } from 'kibana/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
import { MyPlugin } from './plugin';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
|
@ -73,7 +73,7 @@ for first-party Elastic plugins].
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
|
@ -99,7 +99,7 @@ entry-point:
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext } from 'kibana/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
import { MyPlugin } from './plugin';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
|
@ -112,7 +112,7 @@ shape of this plugin is the same as it’s client-side counter-part:
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { Plugin, PluginInitializerContext, CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
|
@ -190,7 +190,7 @@ an HTTP route handler, a plugin just accesses it off of the first argument:
|
|||
|
||||
[source, typescript]
|
||||
----
|
||||
import type { CoreSetup } from 'kibana/server';
|
||||
import type { CoreSetup } from '@kbn/core/server';
|
||||
|
||||
export class MyPlugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -252,7 +252,7 @@ encouraged to expose types for their plugin interfaces.
|
|||
|
||||
[source, typescript]
|
||||
----
|
||||
import type { Plugin } from 'kibana/server';
|
||||
import type { Plugin } from '@kbn/core/server';
|
||||
export interface FoobarPluginSetup { <1>
|
||||
getFoo(): string;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ are then available via the second argument of `setup` and/or `start`:
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { CoreSetup, CoreStart } from 'kibana/server';
|
||||
import type { CoreSetup, CoreStart } from '@kbn/core/server';
|
||||
import type { FoobarPluginSetup, FoobarPluginStart } from '../../foobar/server';
|
||||
|
||||
interface DemoSetupPlugins { <1>
|
||||
|
|
|
@ -24,7 +24,7 @@ plugin bundle, therefore, reducing its size by a significant amount.
|
|||
|
||||
[source,typescript]
|
||||
----
|
||||
import type { Plugin, CoreSetup, AppMountParameters } from 'kibana/public';
|
||||
import type { Plugin, CoreSetup, AppMountParameters } from '@kbn/core/public';
|
||||
export class MyPlugin implements Plugin<MyPluginSetup> {
|
||||
setup(core: CoreSetup, plugins: SetupDeps) {
|
||||
core.application.register({
|
||||
|
|
|
@ -60,7 +60,7 @@ in the _constructor_ of the plugin:
|
|||
*plugins/my_plugin/(public|server)/index.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext } from 'kibana/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
import { MyPlugin } from './plugin';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
|
@ -71,7 +71,7 @@ export function plugin(initializerContext: PluginInitializerContext) {
|
|||
*plugins/my_plugin/(public|server)/plugin.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import { CoreSetup, Logger, Plugin, PluginInitializerContext, PluginName } from 'kibana/server';
|
||||
import { CoreSetup, Logger, Plugin, PluginInitializerContext, PluginName } from '@kbn/core/server';
|
||||
import type { MyPluginConfig } from './config';
|
||||
|
||||
export class MyPlugin implements Plugin {
|
||||
|
@ -118,7 +118,7 @@ same name in `plugins/demoplugin` with the following files:
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import type { PluginInitializerContext } from 'kibana/server';
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
import { DemoPlugin } from './plugin';
|
||||
|
||||
export const config = {
|
||||
|
@ -136,7 +136,7 @@ export { DemoPluginSetup } from './plugin';
|
|||
*plugins/demoplugin/server/plugin.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import type { PluginInitializerContext, Plugin, CoreSetup } from 'kibana/server';
|
||||
import type { PluginInitializerContext, Plugin, CoreSetup } from '@kbn/core/server';
|
||||
import type { DemoPluginConfig } from '.';
|
||||
export interface DemoPluginSetup {};
|
||||
|
||||
|
@ -205,7 +205,7 @@ to the {kib} platform format:
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { CoreSetup } from 'kibana/server';
|
||||
import type { CoreSetup } from '@kbn/core/server';
|
||||
|
||||
export class DemoPlugin {
|
||||
public setup(core: CoreSetup) {
|
||||
|
@ -239,7 +239,7 @@ migration is complete:
|
|||
[source,typescript]
|
||||
----
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { CoreSetup } from 'kibana/server';
|
||||
import { CoreSetup } from '@kbn/core/server';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
export class DemoPlugin {
|
||||
|
@ -706,7 +706,7 @@ First type:
|
|||
*plugins/demoplugin/server/saved_objects/first_type.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import type { SavedObjectsType } from 'kibana/server';
|
||||
import type { SavedObjectsType } from '@kbn/core/server';
|
||||
|
||||
export const firstType: SavedObjectsType = {
|
||||
name: 'first-type',
|
||||
|
@ -744,7 +744,7 @@ Second type:
|
|||
*plugins/demoplugin/server/saved_objects/second_type.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import type { SavedObjectsType } from 'kibana/server';
|
||||
import type { SavedObjectsType } from '@kbn/core/server';
|
||||
|
||||
export const secondType: SavedObjectsType = {
|
||||
name: 'second-type',
|
||||
|
@ -979,7 +979,7 @@ Legacy Elasticsearch library until the additional announcements.
|
|||
[source,typescript]
|
||||
----
|
||||
// Kibana provides a few typings for internal purposes
|
||||
import type { SearchResponse } from 'kibana/server';
|
||||
import type { SearchResponse } from '@kbn/core/server';
|
||||
type SearchSource = {...};
|
||||
type SearchBody = SearchResponse<SearchSource>;
|
||||
const { body } = await client.search<SearchBody>(...);
|
||||
|
|
|
@ -11,7 +11,7 @@ plugins always rely on valid public contracts:
|
|||
*my_plugin/server/plugin.test.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import { configServiceMock } from 'kibana/server/mocks';
|
||||
import { configServiceMock } from '@kbn/core/server/mocks';
|
||||
|
||||
const configService = configServiceMock.create();
|
||||
configService.atPath.mockReturnValue(config$);
|
||||
|
@ -24,7 +24,7 @@ Or if you need to get the whole core `setup` or `start` contracts:
|
|||
*my_plugin/server/plugin.test.ts*
|
||||
[source,typescript]
|
||||
----
|
||||
import { coreMock } from 'kibana/public/mocks';
|
||||
import { coreMock } from '@kbn/core/public/mocks';
|
||||
|
||||
const coreSetup = coreMock.createSetup();
|
||||
coreSetup.uiSettings.get.mockImplementation((key: string) => {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
import { useEffect, useState } from 'react';
|
||||
|
||||
// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
|
||||
// import { Capabilities } from 'kibana/public';
|
||||
// import { Capabilities } from '@kbn/core/public';
|
||||
type Capabilities = any;
|
||||
export interface UseGetUserAlertsPermissionsProps {
|
||||
crud: boolean;
|
||||
|
|
|
@ -16,7 +16,7 @@ import { filterFieldToList } from '../filter_field_to_list';
|
|||
import { getGenericComboBoxProps } from '../get_generic_combo_box_props';
|
||||
|
||||
// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/100715
|
||||
// import { HttpStart } from 'kibana/public';
|
||||
// import { HttpStart } from '@kbn/core/public';
|
||||
type HttpStart = any;
|
||||
|
||||
import * as i18n from '../translations';
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import * as Public from './public';
|
||||
import * as Server from './server';
|
||||
|
||||
export { Public, Server };
|
|
@ -61,7 +61,7 @@ export type ExposedToBrowserDescriptor<T> = {
|
|||
* ```typescript
|
||||
* // my_plugin/server/index.ts
|
||||
* import { schema, TypeOf } from '@kbn/config-schema';
|
||||
* import { PluginConfigDescriptor } from 'kibana/server';
|
||||
* import { PluginConfigDescriptor } from '@kbn/core/server';
|
||||
*
|
||||
* const configSchema = schema.object({
|
||||
* secret: schema.string({ defaultValue: 'Only on server' }),
|
||||
|
|
|
@ -451,9 +451,6 @@
|
|||
"@kbn/stack-management-usage-test-plugin/*": ["x-pack/test/usage_collection/plugins/stack_management_usage_test/*"],
|
||||
// END AUTOMATED PACKAGE LISTING
|
||||
// Allows for importing from `kibana` package for the exported types.
|
||||
"kibana": ["./kibana"],
|
||||
"kibana/public": ["src/core/public"],
|
||||
"kibana/server": ["src/core/server"],
|
||||
"@emotion/core": ["typings/@emotion"],
|
||||
"resize-observer-polyfill": ["typings/resize-observer-polyfill"]
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue