mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -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
|
@ -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';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue