From 2352343c87bd238657438099370be0e3e52870a1 Mon Sep 17 00:00:00 2001 From: Rudolf Meijering Date: Thu, 21 Mar 2019 15:04:02 +0100 Subject: [PATCH] api-extractor: independantly analyze core/public and core/server Becasue of https://github.com/Microsoft/web-build-tools/issues/1029 api-extractor can't use core/index.ts as a single entry point for analyzing the public and server API's as isolated namespaces. Instead we analyze these projects separately. This introduces other problems like the api review files and documentation always being called "kibana." from the package.json filename. --- common/core_api_review/kibana.api.ts | 72 ----------- .../core/public/kibana.corestart.basepath.md | 9 ++ .../core/public/kibana.corestart.chrome.md | 9 ++ .../public/kibana.corestart.fatalerrors.md | 9 ++ .../core/public/kibana.corestart.http.md | 9 ++ .../core/public/kibana.corestart.i18n.md | 9 ++ .../kibana.corestart.injectedmetadata.md | 9 ++ .../core/public/kibana.corestart.md | 25 ++++ .../public/kibana.corestart.notifications.md | 9 ++ .../public/kibana.corestart.uisettings.md | 9 ++ docs/development/core/public/kibana.md | 10 ++ .../{api => server}/kibana.callapioptions.md | 0 .../kibana.callapioptions.wrap401errors.md | 0 .../kibana.clusterclient.asscoped.md | 0 ...kibana.clusterclient.callasinternaluser.md | 0 .../kibana.clusterclient.close.md | 0 .../{api => server}/kibana.clusterclient.md | 0 .../{api => server}/kibana.logger.debug.md | 0 .../{api => server}/kibana.logger.error.md | 0 .../{api => server}/kibana.logger.fatal.md | 0 .../{api => server}/kibana.logger.info.md | 0 .../core/{api => server}/kibana.logger.md | 0 .../{api => server}/kibana.logger.trace.md | 0 .../{api => server}/kibana.logger.warn.md | 0 .../kibana.loggerfactory.get.md | 0 .../{api => server}/kibana.loggerfactory.md | 0 .../core/{api => server}/kibana.logmeta.md | 0 .../core/{api => server}/kibana.md | 0 .../kibana.plugininitializercontext.config.md | 0 .../kibana.plugininitializercontext.env.md | 0 .../kibana.plugininitializercontext.logger.md | 0 .../kibana.plugininitializercontext.md | 0 .../core/{api => server}/kibana.pluginname.md | 0 ...kibana.pluginstartcontext.elasticsearch.md | 0 .../kibana.pluginstartcontext.md | 0 src/core/index.ts | 1 - src/core/public/index.ts | 6 + src/core/public/kibana.api.md | 71 +++++++++++ src/core/server/bootstrap.ts | 4 +- src/core/server/kibana.api.md | 99 +++++++++++++++ src/dev/run_check_core_api_changes.ts | 115 ++++++++++-------- 41 files changed, 352 insertions(+), 123 deletions(-) delete mode 100644 common/core_api_review/kibana.api.ts create mode 100644 docs/development/core/public/kibana.corestart.basepath.md create mode 100644 docs/development/core/public/kibana.corestart.chrome.md create mode 100644 docs/development/core/public/kibana.corestart.fatalerrors.md create mode 100644 docs/development/core/public/kibana.corestart.http.md create mode 100644 docs/development/core/public/kibana.corestart.i18n.md create mode 100644 docs/development/core/public/kibana.corestart.injectedmetadata.md create mode 100644 docs/development/core/public/kibana.corestart.md create mode 100644 docs/development/core/public/kibana.corestart.notifications.md create mode 100644 docs/development/core/public/kibana.corestart.uisettings.md create mode 100644 docs/development/core/public/kibana.md rename docs/development/core/{api => server}/kibana.callapioptions.md (100%) rename docs/development/core/{api => server}/kibana.callapioptions.wrap401errors.md (100%) rename docs/development/core/{api => server}/kibana.clusterclient.asscoped.md (100%) rename docs/development/core/{api => server}/kibana.clusterclient.callasinternaluser.md (100%) rename docs/development/core/{api => server}/kibana.clusterclient.close.md (100%) rename docs/development/core/{api => server}/kibana.clusterclient.md (100%) rename docs/development/core/{api => server}/kibana.logger.debug.md (100%) rename docs/development/core/{api => server}/kibana.logger.error.md (100%) rename docs/development/core/{api => server}/kibana.logger.fatal.md (100%) rename docs/development/core/{api => server}/kibana.logger.info.md (100%) rename docs/development/core/{api => server}/kibana.logger.md (100%) rename docs/development/core/{api => server}/kibana.logger.trace.md (100%) rename docs/development/core/{api => server}/kibana.logger.warn.md (100%) rename docs/development/core/{api => server}/kibana.loggerfactory.get.md (100%) rename docs/development/core/{api => server}/kibana.loggerfactory.md (100%) rename docs/development/core/{api => server}/kibana.logmeta.md (100%) rename docs/development/core/{api => server}/kibana.md (100%) rename docs/development/core/{api => server}/kibana.plugininitializercontext.config.md (100%) rename docs/development/core/{api => server}/kibana.plugininitializercontext.env.md (100%) rename docs/development/core/{api => server}/kibana.plugininitializercontext.logger.md (100%) rename docs/development/core/{api => server}/kibana.plugininitializercontext.md (100%) rename docs/development/core/{api => server}/kibana.pluginname.md (100%) rename docs/development/core/{api => server}/kibana.pluginstartcontext.elasticsearch.md (100%) rename docs/development/core/{api => server}/kibana.pluginstartcontext.md (100%) create mode 100644 src/core/public/kibana.api.md create mode 100644 src/core/server/kibana.api.md diff --git a/common/core_api_review/kibana.api.ts b/common/core_api_review/kibana.api.ts deleted file mode 100644 index 35736c37e4e7b..0000000000000 --- a/common/core_api_review/kibana.api.ts +++ /dev/null @@ -1,72 +0,0 @@ -// @public -interface CallAPIOptions { - wrap401Errors: boolean; -} - -// @public -declare class ClusterClient { - // (undocumented) - constructor(config: ElasticsearchClientConfig, log: Logger); - asScoped(req?: { - // (undocumented) - headers?: Headers; - }): ScopedClusterClient; - callAsInternalUser: (endpoint: string, clientParams?: Record, options?: CallAPIOptions | undefined) => Promise; - close(): void; - } - -// @public -interface Logger { - debug(message: string, meta?: LogMeta): void; - error(errorOrMessage: string | Error, meta?: LogMeta): void; - fatal(errorOrMessage: string | Error, meta?: LogMeta): void; - info(message: string, meta?: LogMeta): void; - trace(message: string, meta?: LogMeta): void; - warn(errorOrMessage: string | Error, meta?: LogMeta): void; -} - -// @public -interface LoggerFactory { - get(...contextParts: string[]): Logger; -} - -// @public -interface LogMeta { - // (undocumented) - [key: string]: any; -} - -// @public -interface PluginInitializerContext { - // (undocumented) - config: { - // (undocumented) - create: , Config>(ConfigClass: ConfigWithSchema) => Observable; - // (undocumented) - createIfExists: , Config>(ConfigClass: ConfigWithSchema) => Observable; - }; - // (undocumented) - env: { - // (undocumented) - mode: EnvironmentMode; - }; - // (undocumented) - logger: LoggerFactory; -} - -// @public -declare type PluginName = string; - -// @public -interface PluginStartContext { - // (undocumented) - elasticsearch: { - // (undocumented) - adminClient$: Observable; - // (undocumented) - dataClient$: Observable; - }; -} - - -// (No @packageDocumentation comment for this package) diff --git a/docs/development/core/public/kibana.corestart.basepath.md b/docs/development/core/public/kibana.corestart.basepath.md new file mode 100644 index 0000000000000..0bf09723d0a17 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.basepath.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [basePath](./kibana.corestart.basepath.md) + +## CoreStart.basePath property + +Signature: + +```typescript +basePath: BasePathStart; +``` diff --git a/docs/development/core/public/kibana.corestart.chrome.md b/docs/development/core/public/kibana.corestart.chrome.md new file mode 100644 index 0000000000000..312482a9f7380 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.chrome.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [chrome](./kibana.corestart.chrome.md) + +## CoreStart.chrome property + +Signature: + +```typescript +chrome: ChromeStart; +``` diff --git a/docs/development/core/public/kibana.corestart.fatalerrors.md b/docs/development/core/public/kibana.corestart.fatalerrors.md new file mode 100644 index 0000000000000..f53fa6bcdfa1d --- /dev/null +++ b/docs/development/core/public/kibana.corestart.fatalerrors.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [fatalErrors](./kibana.corestart.fatalerrors.md) + +## CoreStart.fatalErrors property + +Signature: + +```typescript +fatalErrors: FatalErrorsStart; +``` diff --git a/docs/development/core/public/kibana.corestart.http.md b/docs/development/core/public/kibana.corestart.http.md new file mode 100644 index 0000000000000..ca3a281e2591b --- /dev/null +++ b/docs/development/core/public/kibana.corestart.http.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [http](./kibana.corestart.http.md) + +## CoreStart.http property + +Signature: + +```typescript +http: HttpStart; +``` diff --git a/docs/development/core/public/kibana.corestart.i18n.md b/docs/development/core/public/kibana.corestart.i18n.md new file mode 100644 index 0000000000000..60c344971cbb1 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.i18n.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [i18n](./kibana.corestart.i18n.md) + +## CoreStart.i18n property + +Signature: + +```typescript +i18n: I18nStart; +``` diff --git a/docs/development/core/public/kibana.corestart.injectedmetadata.md b/docs/development/core/public/kibana.corestart.injectedmetadata.md new file mode 100644 index 0000000000000..4a84cb66d8ba8 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.injectedmetadata.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [injectedMetadata](./kibana.corestart.injectedmetadata.md) + +## CoreStart.injectedMetadata property + +Signature: + +```typescript +injectedMetadata: InjectedMetadataStart; +``` diff --git a/docs/development/core/public/kibana.corestart.md b/docs/development/core/public/kibana.corestart.md new file mode 100644 index 0000000000000..9f1bb60cdbda6 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.md @@ -0,0 +1,25 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) + +## CoreStart interface + +Core services exposed to the start lifecycle + +Signature: + +```typescript +export interface CoreStart +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [basePath](./kibana.corestart.basepath.md) | `BasePathStart` | | +| [chrome](./kibana.corestart.chrome.md) | `ChromeStart` | | +| [fatalErrors](./kibana.corestart.fatalerrors.md) | `FatalErrorsStart` | | +| [http](./kibana.corestart.http.md) | `HttpStart` | | +| [i18n](./kibana.corestart.i18n.md) | `I18nStart` | | +| [injectedMetadata](./kibana.corestart.injectedmetadata.md) | `InjectedMetadataStart` | | +| [notifications](./kibana.corestart.notifications.md) | `NotificationsStart` | | +| [uiSettings](./kibana.corestart.uisettings.md) | `UiSettingsClient` | | + diff --git a/docs/development/core/public/kibana.corestart.notifications.md b/docs/development/core/public/kibana.corestart.notifications.md new file mode 100644 index 0000000000000..c30ac2dbc5f91 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.notifications.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [notifications](./kibana.corestart.notifications.md) + +## CoreStart.notifications property + +Signature: + +```typescript +notifications: NotificationsStart; +``` diff --git a/docs/development/core/public/kibana.corestart.uisettings.md b/docs/development/core/public/kibana.corestart.uisettings.md new file mode 100644 index 0000000000000..960129d3b0db5 --- /dev/null +++ b/docs/development/core/public/kibana.corestart.uisettings.md @@ -0,0 +1,9 @@ +[Home](./index) > [kibana](./kibana.md) > [CoreStart](./kibana.corestart.md) > [uiSettings](./kibana.corestart.uisettings.md) + +## CoreStart.uiSettings property + +Signature: + +```typescript +uiSettings: UiSettingsClient; +``` diff --git a/docs/development/core/public/kibana.md b/docs/development/core/public/kibana.md new file mode 100644 index 0000000000000..297ecbd032bda --- /dev/null +++ b/docs/development/core/public/kibana.md @@ -0,0 +1,10 @@ +[Home](./index) > [kibana](./kibana.md) + +## kibana package + +## Interfaces + +| Interface | Description | +| --- | --- | +| [CoreStart](./kibana.corestart.md) | Core services exposed to the start lifecycle | + diff --git a/docs/development/core/api/kibana.callapioptions.md b/docs/development/core/server/kibana.callapioptions.md similarity index 100% rename from docs/development/core/api/kibana.callapioptions.md rename to docs/development/core/server/kibana.callapioptions.md diff --git a/docs/development/core/api/kibana.callapioptions.wrap401errors.md b/docs/development/core/server/kibana.callapioptions.wrap401errors.md similarity index 100% rename from docs/development/core/api/kibana.callapioptions.wrap401errors.md rename to docs/development/core/server/kibana.callapioptions.wrap401errors.md diff --git a/docs/development/core/api/kibana.clusterclient.asscoped.md b/docs/development/core/server/kibana.clusterclient.asscoped.md similarity index 100% rename from docs/development/core/api/kibana.clusterclient.asscoped.md rename to docs/development/core/server/kibana.clusterclient.asscoped.md diff --git a/docs/development/core/api/kibana.clusterclient.callasinternaluser.md b/docs/development/core/server/kibana.clusterclient.callasinternaluser.md similarity index 100% rename from docs/development/core/api/kibana.clusterclient.callasinternaluser.md rename to docs/development/core/server/kibana.clusterclient.callasinternaluser.md diff --git a/docs/development/core/api/kibana.clusterclient.close.md b/docs/development/core/server/kibana.clusterclient.close.md similarity index 100% rename from docs/development/core/api/kibana.clusterclient.close.md rename to docs/development/core/server/kibana.clusterclient.close.md diff --git a/docs/development/core/api/kibana.clusterclient.md b/docs/development/core/server/kibana.clusterclient.md similarity index 100% rename from docs/development/core/api/kibana.clusterclient.md rename to docs/development/core/server/kibana.clusterclient.md diff --git a/docs/development/core/api/kibana.logger.debug.md b/docs/development/core/server/kibana.logger.debug.md similarity index 100% rename from docs/development/core/api/kibana.logger.debug.md rename to docs/development/core/server/kibana.logger.debug.md diff --git a/docs/development/core/api/kibana.logger.error.md b/docs/development/core/server/kibana.logger.error.md similarity index 100% rename from docs/development/core/api/kibana.logger.error.md rename to docs/development/core/server/kibana.logger.error.md diff --git a/docs/development/core/api/kibana.logger.fatal.md b/docs/development/core/server/kibana.logger.fatal.md similarity index 100% rename from docs/development/core/api/kibana.logger.fatal.md rename to docs/development/core/server/kibana.logger.fatal.md diff --git a/docs/development/core/api/kibana.logger.info.md b/docs/development/core/server/kibana.logger.info.md similarity index 100% rename from docs/development/core/api/kibana.logger.info.md rename to docs/development/core/server/kibana.logger.info.md diff --git a/docs/development/core/api/kibana.logger.md b/docs/development/core/server/kibana.logger.md similarity index 100% rename from docs/development/core/api/kibana.logger.md rename to docs/development/core/server/kibana.logger.md diff --git a/docs/development/core/api/kibana.logger.trace.md b/docs/development/core/server/kibana.logger.trace.md similarity index 100% rename from docs/development/core/api/kibana.logger.trace.md rename to docs/development/core/server/kibana.logger.trace.md diff --git a/docs/development/core/api/kibana.logger.warn.md b/docs/development/core/server/kibana.logger.warn.md similarity index 100% rename from docs/development/core/api/kibana.logger.warn.md rename to docs/development/core/server/kibana.logger.warn.md diff --git a/docs/development/core/api/kibana.loggerfactory.get.md b/docs/development/core/server/kibana.loggerfactory.get.md similarity index 100% rename from docs/development/core/api/kibana.loggerfactory.get.md rename to docs/development/core/server/kibana.loggerfactory.get.md diff --git a/docs/development/core/api/kibana.loggerfactory.md b/docs/development/core/server/kibana.loggerfactory.md similarity index 100% rename from docs/development/core/api/kibana.loggerfactory.md rename to docs/development/core/server/kibana.loggerfactory.md diff --git a/docs/development/core/api/kibana.logmeta.md b/docs/development/core/server/kibana.logmeta.md similarity index 100% rename from docs/development/core/api/kibana.logmeta.md rename to docs/development/core/server/kibana.logmeta.md diff --git a/docs/development/core/api/kibana.md b/docs/development/core/server/kibana.md similarity index 100% rename from docs/development/core/api/kibana.md rename to docs/development/core/server/kibana.md diff --git a/docs/development/core/api/kibana.plugininitializercontext.config.md b/docs/development/core/server/kibana.plugininitializercontext.config.md similarity index 100% rename from docs/development/core/api/kibana.plugininitializercontext.config.md rename to docs/development/core/server/kibana.plugininitializercontext.config.md diff --git a/docs/development/core/api/kibana.plugininitializercontext.env.md b/docs/development/core/server/kibana.plugininitializercontext.env.md similarity index 100% rename from docs/development/core/api/kibana.plugininitializercontext.env.md rename to docs/development/core/server/kibana.plugininitializercontext.env.md diff --git a/docs/development/core/api/kibana.plugininitializercontext.logger.md b/docs/development/core/server/kibana.plugininitializercontext.logger.md similarity index 100% rename from docs/development/core/api/kibana.plugininitializercontext.logger.md rename to docs/development/core/server/kibana.plugininitializercontext.logger.md diff --git a/docs/development/core/api/kibana.plugininitializercontext.md b/docs/development/core/server/kibana.plugininitializercontext.md similarity index 100% rename from docs/development/core/api/kibana.plugininitializercontext.md rename to docs/development/core/server/kibana.plugininitializercontext.md diff --git a/docs/development/core/api/kibana.pluginname.md b/docs/development/core/server/kibana.pluginname.md similarity index 100% rename from docs/development/core/api/kibana.pluginname.md rename to docs/development/core/server/kibana.pluginname.md diff --git a/docs/development/core/api/kibana.pluginstartcontext.elasticsearch.md b/docs/development/core/server/kibana.pluginstartcontext.elasticsearch.md similarity index 100% rename from docs/development/core/api/kibana.pluginstartcontext.elasticsearch.md rename to docs/development/core/server/kibana.pluginstartcontext.elasticsearch.md diff --git a/docs/development/core/api/kibana.pluginstartcontext.md b/docs/development/core/server/kibana.pluginstartcontext.md similarity index 100% rename from docs/development/core/api/kibana.pluginstartcontext.md rename to docs/development/core/server/kibana.pluginstartcontext.md diff --git a/src/core/index.ts b/src/core/index.ts index 039faaff7d13b..23db81469f5bc 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - import * as Public from './public'; import * as Server from './server'; diff --git a/src/core/public/index.ts b/src/core/public/index.ts index a8399c6fd10a2..8a3bcdc0131ba 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -26,8 +26,14 @@ import { InjectedMetadataStart } from './injected_metadata'; import { NotificationsStart } from './notifications'; import { UiSettingsClient } from './ui_settings'; +/** @interal */ export { CoreSystem } from './core_system'; +/** + * Core services exposed to the start lifecycle + * + * @public + */ export interface CoreStart { i18n: I18nStart; injectedMetadata: InjectedMetadataStart; diff --git a/src/core/public/kibana.api.md b/src/core/public/kibana.api.md new file mode 100644 index 0000000000000..f6767e254cc0f --- /dev/null +++ b/src/core/public/kibana.api.md @@ -0,0 +1,71 @@ +## API Review File for "kibana" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { default } from 'react'; +import * as Rx from 'rxjs'; + +// @public +export interface CoreStart { + // Warning: (ae-forgotten-export) The symbol "BasePathStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + basePath: BasePathStart; + // Warning: (ae-forgotten-export) The symbol "ChromeStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + chrome: ChromeStart; + // Warning: (ae-forgotten-export) The symbol "FatalErrorsStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + fatalErrors: FatalErrorsStart; + // Warning: (ae-forgotten-export) The symbol "HttpStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + http: HttpStart; + // Warning: (ae-forgotten-export) The symbol "I18nStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + i18n: I18nStart; + // Warning: (ae-forgotten-export) The symbol "InjectedMetadataStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + injectedMetadata: InjectedMetadataStart; + // Warning: (ae-forgotten-export) The symbol "NotificationsStart" needs to be exported by the entry point index.d.ts + // + // (undocumented) + notifications: NotificationsStart; + // Warning: (ae-forgotten-export) The symbol "UiSettingsClient" needs to be exported by the entry point index.d.ts + // + // (undocumented) + uiSettings: UiSettingsClient; +} + +// Warning: (ae-internal-missing-underscore) The name CoreSystem should be prefixed with an underscore because the declaration is marked as "@internal" +// +// @internal +export class CoreSystem { + // Warning: (ae-forgotten-export) The symbol "Params" needs to be exported by the entry point index.d.ts + // + // (undocumented) + constructor(params: Params); + // (undocumented) + start(): { + fatalErrors: { + add: (error: string | Error, source?: string | undefined) => never; + get$: () => import("rxjs").Observable<{ + message: string; + stack: string | undefined; + }>; + }; + } | undefined; + // (undocumented) + stop(): void; + } + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/src/core/server/bootstrap.ts b/src/core/server/bootstrap.ts index 457c021ae4749..d8ce2cb22d4bf 100644 --- a/src/core/server/bootstrap.ts +++ b/src/core/server/bootstrap.ts @@ -48,9 +48,9 @@ interface BootstrapArgs { } /** - * @interal * - * @param options + * @internal + * @param param0 - options */ export async function bootstrap({ configs, diff --git a/src/core/server/kibana.api.md b/src/core/server/kibana.api.md new file mode 100644 index 0000000000000..a72b39cd462fa --- /dev/null +++ b/src/core/server/kibana.api.md @@ -0,0 +1,99 @@ +## API Review File for "kibana" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ConfigOptions } from 'elasticsearch'; +import { Duration } from 'moment'; +import { Observable } from 'rxjs'; +import { Type } from '@kbn/config-schema'; +import { TypeOf } from '@kbn/config-schema'; + +// Warning: (ae-forgotten-export) The symbol "BootstrapArgs" needs to be exported by the entry point index.d.ts +// Warning: (ae-internal-missing-underscore) The name bootstrap should be prefixed with an underscore because the declaration is marked as "@internal" +// +// @internal (undocumented) +export function bootstrap({ configs, cliArgs, applyConfigOverrides, features, }: BootstrapArgs): Promise; + +// @public +export interface CallAPIOptions { + wrap401Errors: boolean; +} + +// @public +export class ClusterClient { + // Warning: (ae-forgotten-export) The symbol "ElasticsearchClientConfig" needs to be exported by the entry point index.d.ts + // + // (undocumented) + constructor(config: ElasticsearchClientConfig, log: Logger); + // Warning: (ae-forgotten-export) The symbol "ScopedClusterClient" needs to be exported by the entry point index.d.ts + asScoped(req?: { + headers?: Headers; + }): ScopedClusterClient; + callAsInternalUser: (endpoint: string, clientParams?: Record, options?: CallAPIOptions | undefined) => Promise; + close(): void; + } + +// @public +export interface Logger { + debug(message: string, meta?: LogMeta): void; + error(errorOrMessage: string | Error, meta?: LogMeta): void; + fatal(errorOrMessage: string | Error, meta?: LogMeta): void; + info(message: string, meta?: LogMeta): void; + // Warning: (ae-forgotten-export) The symbol "LogRecord" needs to be exported by the entry point index.d.ts + // + // @internal (undocumented) + log(record: LogRecord): void; + trace(message: string, meta?: LogMeta): void; + warn(errorOrMessage: string | Error, meta?: LogMeta): void; +} + +// @public +export interface LoggerFactory { + get(...contextParts: string[]): Logger; +} + +// @public +export interface LogMeta { + // (undocumented) + [key: string]: any; +} + +// @public +export interface PluginInitializerContext { + // (undocumented) + config: { + create: , Config>(ConfigClass: ConfigWithSchema) => Observable; + createIfExists: , Config>(ConfigClass: ConfigWithSchema) => Observable; + }; + // (undocumented) + env: { + mode: EnvironmentMode; + }; + // (undocumented) + logger: LoggerFactory; +} + +// @public +export type PluginName = string; + +// @public +export interface PluginStartContext { + // (undocumented) + elasticsearch: { + adminClient$: Observable; + dataClient$: Observable; + }; +} + + +// Warnings were encountered during analysis: +// +// src/core/server/elasticsearch/cluster_client.ts:95:6 - (ae-forgotten-export) The symbol "Headers" needs to be exported by the entry point index.d.ts +// src/core/server/plugins/plugin_context.ts:35:9 - (ae-forgotten-export) The symbol "EnvironmentMode" needs to be exported by the entry point index.d.ts +// src/core/server/plugins/plugin_context.ts:39:9 - (ae-forgotten-export) The symbol "ConfigWithSchema" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/src/dev/run_check_core_api_changes.ts b/src/dev/run_check_core_api_changes.ts index d1a965a86d690..a98edb5873937 100644 --- a/src/dev/run_check_core_api_changes.ts +++ b/src/dev/run_check_core_api_changes.ts @@ -24,46 +24,53 @@ import dedent from 'dedent'; import execa from 'execa'; import getopts from 'getopts'; -const apiExtractorConfig: IExtractorConfig = { - compiler: { - configType: 'tsconfig', - rootFolder: '.', - }, - project: { - entryPointSourceFile: 'target/types/server/index.d.ts', - }, - apiReviewFile: { - enabled: true, - apiReviewFolder: './common/core_api_review/', - tempFolder: './build', - }, - apiJsonFile: { - enabled: true, - outputFolder: './build', - }, - dtsRollup: { - enabled: false, - trimming: true, - publishFolderForInternal: '', - publishFolderForBeta: '', - publishFolderForPublic: '', - mainDtsRollupPath: '', - }, +const apiExtractorConfig = (folder: string): IExtractorConfig => { + return { + compiler: { + configType: 'tsconfig', + rootFolder: '.', + }, + project: { + entryPointSourceFile: `target/types/${folder}/index.d.ts`, + }, + apiReviewFile: { + enabled: true, + apiReviewFolder: `./src/core/${folder}/`, + tempFolder: `./build/${folder}/`, + }, + apiJsonFile: { + enabled: true, + outputFolder: `./build/${folder}`, + }, + dtsRollup: { + enabled: false, + trimming: true, + publishFolderForInternal: '', + publishFolderForBeta: '', + publishFolderForPublic: '', + mainDtsRollupPath: '', + }, + policies: { + namespaceSupport: 'permissive', + }, + }; }; const runBuildTypes = async () => { await execa.shell('yarn run build:types'); }; -const runApiDocumenter = async () => { - await execa.shell('api-documenter markdown -i ./build -o ./docs/development/core/api'); +const runApiDocumenter = async (folder: string) => { + await execa.shell( + `api-documenter markdown -i ./build/${folder} -o ./docs/development/core/${folder}` + ); }; const isApiChangedWarning = (warning: string) => { return warning.startsWith('You have changed the public API signature for this project.'); }; -const runApiExtractor = (acceptChanges: boolean = false) => { +const runApiExtractor = (folder: string, acceptChanges: boolean = false) => { // Because of the internals of api-extractor ILogger can't be implemented as a typescript Class const warnings = [] as string[]; const errors = [] as string[]; @@ -95,7 +102,7 @@ const runApiExtractor = (acceptChanges: boolean = false) => { customLogger: memoryLogger, }; - const extractor = new Extractor(apiExtractorConfig, options); + const extractor = new Extractor(apiExtractorConfig(folder), options); extractor.processProject(); const printableWarnings = warnings.filter(msg => !isApiChangedWarning(msg)); @@ -104,7 +111,7 @@ const runApiExtractor = (acceptChanges: boolean = false) => { return { apiChanged, warnings: printableWarnings, errors }; }; -(async function run() { +async function run(folder: string): Promise { const log = new ToolingLog({ level: 'info', writeTo: process.stdout, @@ -122,12 +129,11 @@ const runApiExtractor = (acceptChanges: boolean = false) => { }, }); - if (extraFlags.length) { + if (extraFlags.length > 0) { for (const flag of extraFlags) { log.error(`Unknown flag: ${flag}`); } - process.exitCode = 1; opts.help = true; } @@ -156,24 +162,24 @@ const runApiExtractor = (acceptChanges: boolean = false) => { `) ); process.stdout.write('\n'); - process.exit(); + return !(extraFlags.length > 0); } - log.info('Kibana Core API: checking for changes in API signature...'); + log.info(`Core ${folder} API: checking for changes in API signature...`); await runBuildTypes().catch(e => { if (e) { log.error(e); - process.exit(1); + return false; } }); - const { apiChanged, warnings, errors } = runApiExtractor(opts.accept); + const { apiChanged, warnings, errors } = runApiExtractor(folder, opts.accept); if (apiChanged && opts.accept) { - log.warning('You have changed the public signature of the Kibana Core API'); + log.warning(`You have changed the public signature of the ${folder} Core API`); log.warning( - 'Please commit the updated API documentation and the review file in `common/core_api_review/kibana.api.ts` \n' + `Please commit the updated API documentation and the review file in \`common/core_api_review/kibana.api.ts\` \n` ); } @@ -187,28 +193,41 @@ const runApiExtractor = (acceptChanges: boolean = false) => { } if (!apiChanged) { - log.info('Kibana Core API: no changes detected ✔'); + log.info(`Core ${folder} API: no changes detected ✔`); } if (opts.accept || opts.docs) { - await runApiDocumenter().catch(e => { - log.error(e); - process.exit(1); - }); - - log.info('Kibana Core API: updated documentation ✔'); + await runApiDocumenter(folder) + .then(() => { + log.info(`Core ${folder} API: updated documentation ✔`); + }) + .catch(e => { + log.error(e); + return false; + }); } // If the API changed and we're not accepting the changes, exit process with error if (apiChanged && !opts.accept) { - process.exit(1); + return false; } // If any errors or warnings occured, exit with an error if (errors.length > 0 || warnings.length > 0) { - log.error('Kibana Core API: api-extractor failed with the following errors or warnings:'); + log.error(`Core ${folder} API: api-extractor failed with the following errors or warnings:`); errors.forEach(msg => log.error(msg)); warnings.forEach(msg => log.warning(msg)); - process.exit(1); + return false; + } + + return true; +} + +(async () => { + const publicSucceeded = await run('public'); + const serverSucceeded = await run('server'); + + if (!publicSucceeded || !serverSucceeded) { + process.exitCode = 1; } })();