mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -04:00
Move core config service to kbn/config
package (#76874)
* move deprecations and raw loader to package * move config service to package * start to adapt the usages * adapt yet more usages * update generated doc * move logging types to `@kbn/logging` * update generated doc * add yarn.lock symlink * merge @kbn-logging PR * adapt Env.createDefault * update generated doc * remove mock exports from the main entrypoint to avoid importing it in production code * use dynamic require to import `REPO_ROOT` from bootstrap file * move logger mock to kbn-logging package * address review comments * import PublicMethodOf from kbn/utility-types * fix import conflict * update generated doc * use the @kbn/std package * update generated doc * adapt plugin service mock
This commit is contained in:
parent
e667f2fa8d
commit
ab92bbb726
192 changed files with 1079 additions and 1320 deletions
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) > [dev](./kibana-plugin-core-public.environmentmode.dev.md)
|
|
||||||
|
|
||||||
## EnvironmentMode.dev property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
dev: boolean;
|
|
||||||
```
|
|
|
@ -1,21 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md)
|
|
||||||
|
|
||||||
## EnvironmentMode interface
|
|
||||||
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface EnvironmentMode
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [dev](./kibana-plugin-core-public.environmentmode.dev.md) | <code>boolean</code> | |
|
|
||||||
| [name](./kibana-plugin-core-public.environmentmode.name.md) | <code>'development' | 'production'</code> | |
|
|
||||||
| [prod](./kibana-plugin-core-public.environmentmode.prod.md) | <code>boolean</code> | |
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) > [name](./kibana-plugin-core-public.environmentmode.name.md)
|
|
||||||
|
|
||||||
## EnvironmentMode.name property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
name: 'development' | 'production';
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) > [prod](./kibana-plugin-core-public.environmentmode.prod.md)
|
|
||||||
|
|
||||||
## EnvironmentMode.prod property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
prod: boolean;
|
|
||||||
```
|
|
|
@ -55,7 +55,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [CoreSetup](./kibana-plugin-core-public.coresetup.md) | Core services exposed to the <code>Plugin</code> setup lifecycle |
|
| [CoreSetup](./kibana-plugin-core-public.coresetup.md) | Core services exposed to the <code>Plugin</code> setup lifecycle |
|
||||||
| [CoreStart](./kibana-plugin-core-public.corestart.md) | Core services exposed to the <code>Plugin</code> start lifecycle |
|
| [CoreStart](./kibana-plugin-core-public.corestart.md) | Core services exposed to the <code>Plugin</code> start lifecycle |
|
||||||
| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
|
| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
|
||||||
| [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) | |
|
|
||||||
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs. |
|
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs. |
|
||||||
| [FatalErrorInfo](./kibana-plugin-core-public.fatalerrorinfo.md) | Represents the <code>message</code> and <code>stack</code> of a fatal Error |
|
| [FatalErrorInfo](./kibana-plugin-core-public.fatalerrorinfo.md) | Represents the <code>message</code> and <code>stack</code> of a fatal Error |
|
||||||
| [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
|
| [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
|
||||||
|
@ -85,7 +84,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [OverlayBannersStart](./kibana-plugin-core-public.overlaybannersstart.md) | |
|
| [OverlayBannersStart](./kibana-plugin-core-public.overlaybannersstart.md) | |
|
||||||
| [OverlayRef](./kibana-plugin-core-public.overlayref.md) | Returned by [OverlayStart](./kibana-plugin-core-public.overlaystart.md) methods for closing a mounted overlay. |
|
| [OverlayRef](./kibana-plugin-core-public.overlayref.md) | Returned by [OverlayStart](./kibana-plugin-core-public.overlaystart.md) methods for closing a mounted overlay. |
|
||||||
| [OverlayStart](./kibana-plugin-core-public.overlaystart.md) | |
|
| [OverlayStart](./kibana-plugin-core-public.overlaystart.md) | |
|
||||||
| [PackageInfo](./kibana-plugin-core-public.packageinfo.md) | |
|
|
||||||
| [Plugin](./kibana-plugin-core-public.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
|
| [Plugin](./kibana-plugin-core-public.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
|
||||||
| [PluginInitializerContext](./kibana-plugin-core-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
|
| [PluginInitializerContext](./kibana-plugin-core-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
|
||||||
| [SavedObject](./kibana-plugin-core-public.savedobject.md) | |
|
| [SavedObject](./kibana-plugin-core-public.savedobject.md) | |
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [PackageInfo](./kibana-plugin-core-public.packageinfo.md) > [branch](./kibana-plugin-core-public.packageinfo.branch.md)
|
|
||||||
|
|
||||||
## PackageInfo.branch property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
branch: string;
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [PackageInfo](./kibana-plugin-core-public.packageinfo.md) > [buildNum](./kibana-plugin-core-public.packageinfo.buildnum.md)
|
|
||||||
|
|
||||||
## PackageInfo.buildNum property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
buildNum: number;
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [PackageInfo](./kibana-plugin-core-public.packageinfo.md) > [buildSha](./kibana-plugin-core-public.packageinfo.buildsha.md)
|
|
||||||
|
|
||||||
## PackageInfo.buildSha property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
buildSha: string;
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [PackageInfo](./kibana-plugin-core-public.packageinfo.md) > [dist](./kibana-plugin-core-public.packageinfo.dist.md)
|
|
||||||
|
|
||||||
## PackageInfo.dist property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
dist: boolean;
|
|
||||||
```
|
|
|
@ -1,23 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [PackageInfo](./kibana-plugin-core-public.packageinfo.md)
|
|
||||||
|
|
||||||
## PackageInfo interface
|
|
||||||
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface PackageInfo
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [branch](./kibana-plugin-core-public.packageinfo.branch.md) | <code>string</code> | |
|
|
||||||
| [buildNum](./kibana-plugin-core-public.packageinfo.buildnum.md) | <code>number</code> | |
|
|
||||||
| [buildSha](./kibana-plugin-core-public.packageinfo.buildsha.md) | <code>string</code> | |
|
|
||||||
| [dist](./kibana-plugin-core-public.packageinfo.dist.md) | <code>boolean</code> | |
|
|
||||||
| [version](./kibana-plugin-core-public.packageinfo.version.md) | <code>string</code> | |
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [PackageInfo](./kibana-plugin-core-public.packageinfo.md) > [version](./kibana-plugin-core-public.packageinfo.version.md)
|
|
||||||
|
|
||||||
## PackageInfo.version property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
version: string;
|
|
||||||
```
|
|
|
@ -1,18 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md)
|
|
||||||
|
|
||||||
## ConfigDeprecation type
|
|
||||||
|
|
||||||
Configuration deprecation returned from [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md) that handles a single deprecation from the configuration.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export declare type ConfigDeprecation = (config: Record<string, any>, fromPath: string, logger: ConfigDeprecationLogger) => Record<string, any>;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Remarks
|
|
||||||
|
|
||||||
This should only be manually implemented if [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) does not provide the proper helpers for a specific deprecation need.
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationFactory interface
|
|
||||||
|
|
||||||
Provides helpers to generates the most commonly used [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md) when invoking a [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md)<!-- -->.
|
|
||||||
|
|
||||||
See methods documentation for more detailed examples.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface ConfigDeprecationFactory
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const provider: ConfigDeprecationProvider = ({ rename, unused }) => [
|
|
||||||
rename('oldKey', 'newKey'),
|
|
||||||
unused('deprecatedKey'),
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
| Method | Description |
|
|
||||||
| --- | --- |
|
|
||||||
| [rename(oldKey, newKey)](./kibana-plugin-core-server.configdeprecationfactory.rename.md) | Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. |
|
|
||||||
| [renameFromRoot(oldKey, newKey, silent)](./kibana-plugin-core-server.configdeprecationfactory.renamefromroot.md) | Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied.<!-- -->This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. |
|
|
||||||
| [unused(unusedKey)](./kibana-plugin-core-server.configdeprecationfactory.unused.md) | Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. |
|
|
||||||
| [unusedFromRoot(unusedKey)](./kibana-plugin-core-server.configdeprecationfactory.unusedfromroot.md) | Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied.<!-- -->This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. |
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) > [rename](./kibana-plugin-core-server.configdeprecationfactory.rename.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationFactory.rename() method
|
|
||||||
|
|
||||||
Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
rename(oldKey: string, newKey: string): ConfigDeprecation;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| oldKey | <code>string</code> | |
|
|
||||||
| newKey | <code>string</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`ConfigDeprecation`
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Rename 'myplugin.oldKey' to 'myplugin.newKey'
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const provider: ConfigDeprecationProvider = ({ rename }) => [
|
|
||||||
rename('oldKey', 'newKey'),
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) > [renameFromRoot](./kibana-plugin-core-server.configdeprecationfactory.renamefromroot.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationFactory.renameFromRoot() method
|
|
||||||
|
|
||||||
Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied.
|
|
||||||
|
|
||||||
This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
renameFromRoot(oldKey: string, newKey: string, silent?: boolean): ConfigDeprecation;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| oldKey | <code>string</code> | |
|
|
||||||
| newKey | <code>string</code> | |
|
|
||||||
| silent | <code>boolean</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`ConfigDeprecation`
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Rename 'oldplugin.key' to 'newplugin.key'
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const provider: ConfigDeprecationProvider = ({ renameFromRoot }) => [
|
|
||||||
renameFromRoot('oldplugin.key', 'newplugin.key'),
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) > [unused](./kibana-plugin-core-server.configdeprecationfactory.unused.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationFactory.unused() method
|
|
||||||
|
|
||||||
Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
unused(unusedKey: string): ConfigDeprecation;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| unusedKey | <code>string</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`ConfigDeprecation`
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Flags 'myplugin.deprecatedKey' as unused
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const provider: ConfigDeprecationProvider = ({ unused }) => [
|
|
||||||
unused('deprecatedKey'),
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) > [unusedFromRoot](./kibana-plugin-core-server.configdeprecationfactory.unusedfromroot.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationFactory.unusedFromRoot() method
|
|
||||||
|
|
||||||
Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied.
|
|
||||||
|
|
||||||
This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
unusedFromRoot(unusedKey: string): ConfigDeprecation;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| unusedKey | <code>string</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`ConfigDeprecation`
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Flags 'somepath.deprecatedProperty' as unused
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const provider: ConfigDeprecationProvider = ({ unusedFromRoot }) => [
|
|
||||||
unusedFromRoot('somepath.deprecatedProperty'),
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationLogger](./kibana-plugin-core-server.configdeprecationlogger.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationLogger type
|
|
||||||
|
|
||||||
Logger interface used when invoking a [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md)
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export declare type ConfigDeprecationLogger = (message: string) => void;
|
|
||||||
```
|
|
|
@ -1,28 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md)
|
|
||||||
|
|
||||||
## ConfigDeprecationProvider type
|
|
||||||
|
|
||||||
A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md)<!-- -->.
|
|
||||||
|
|
||||||
See [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) for more usage examples.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export declare type ConfigDeprecationProvider = (factory: ConfigDeprecationFactory) => ConfigDeprecation[];
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const provider: ConfigDeprecationProvider = ({ rename, unused }) => [
|
|
||||||
rename('oldKey', 'newKey'),
|
|
||||||
unused('deprecatedKey'),
|
|
||||||
myCustomDeprecation,
|
|
||||||
]
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ConfigPath](./kibana-plugin-core-server.configpath.md)
|
|
||||||
|
|
||||||
## ConfigPath type
|
|
||||||
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export declare type ConfigPath = string | string[];
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [EnvironmentMode](./kibana-plugin-core-server.environmentmode.md) > [dev](./kibana-plugin-core-server.environmentmode.dev.md)
|
|
||||||
|
|
||||||
## EnvironmentMode.dev property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
dev: boolean;
|
|
||||||
```
|
|
|
@ -1,21 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [EnvironmentMode](./kibana-plugin-core-server.environmentmode.md)
|
|
||||||
|
|
||||||
## EnvironmentMode interface
|
|
||||||
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface EnvironmentMode
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [dev](./kibana-plugin-core-server.environmentmode.dev.md) | <code>boolean</code> | |
|
|
||||||
| [name](./kibana-plugin-core-server.environmentmode.name.md) | <code>'development' | 'production'</code> | |
|
|
||||||
| [prod](./kibana-plugin-core-server.environmentmode.prod.md) | <code>boolean</code> | |
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [EnvironmentMode](./kibana-plugin-core-server.environmentmode.md) > [name](./kibana-plugin-core-server.environmentmode.name.md)
|
|
||||||
|
|
||||||
## EnvironmentMode.name property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
name: 'development' | 'production';
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [EnvironmentMode](./kibana-plugin-core-server.environmentmode.md) > [prod](./kibana-plugin-core-server.environmentmode.prod.md)
|
|
||||||
|
|
||||||
## EnvironmentMode.prod property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
prod: boolean;
|
|
||||||
```
|
|
|
@ -1,25 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [debug](./kibana-plugin-core-server.logger.debug.md)
|
|
||||||
|
|
||||||
## Logger.debug() method
|
|
||||||
|
|
||||||
Log messages useful for debugging and interactive investigation
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
debug(message: string, meta?: LogMeta): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| message | <code>string</code> | The log message |
|
|
||||||
| meta | <code>LogMeta</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [error](./kibana-plugin-core-server.logger.error.md)
|
|
||||||
|
|
||||||
## Logger.error() method
|
|
||||||
|
|
||||||
Logs abnormal or unexpected errors or messages that caused a failure in the application flow
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
error(errorOrMessage: string | Error, meta?: LogMeta): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| errorOrMessage | <code>string | Error</code> | An Error object or message string to log |
|
|
||||||
| meta | <code>LogMeta</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [fatal](./kibana-plugin-core-server.logger.fatal.md)
|
|
||||||
|
|
||||||
## Logger.fatal() method
|
|
||||||
|
|
||||||
Logs abnormal or unexpected errors or messages that caused an unrecoverable failure
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
fatal(errorOrMessage: string | Error, meta?: LogMeta): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| errorOrMessage | <code>string | Error</code> | An Error object or message string to log |
|
|
||||||
| meta | <code>LogMeta</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [get](./kibana-plugin-core-server.logger.get.md)
|
|
||||||
|
|
||||||
## Logger.get() method
|
|
||||||
|
|
||||||
Returns a new [Logger](./kibana-plugin-core-server.logger.md) instance extending the current logger context.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
get(...childContextPaths: string[]): Logger;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| childContextPaths | <code>string[]</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`Logger`
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const logger = loggerFactory.get('plugin', 'service'); // 'plugin.service' context
|
|
||||||
const subLogger = logger.get('feature'); // 'plugin.service.feature' context
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [info](./kibana-plugin-core-server.logger.info.md)
|
|
||||||
|
|
||||||
## Logger.info() method
|
|
||||||
|
|
||||||
Logs messages related to general application flow
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
info(message: string, meta?: LogMeta): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| message | <code>string</code> | The log message |
|
|
||||||
| meta | <code>LogMeta</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md)
|
|
||||||
|
|
||||||
## Logger interface
|
|
||||||
|
|
||||||
Logger exposes all the necessary methods to log any type of information and this is the interface used by the logging consumers including plugins.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface Logger
|
|
||||||
```
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
| Method | Description |
|
|
||||||
| --- | --- |
|
|
||||||
| [debug(message, meta)](./kibana-plugin-core-server.logger.debug.md) | Log messages useful for debugging and interactive investigation |
|
|
||||||
| [error(errorOrMessage, meta)](./kibana-plugin-core-server.logger.error.md) | Logs abnormal or unexpected errors or messages that caused a failure in the application flow |
|
|
||||||
| [fatal(errorOrMessage, meta)](./kibana-plugin-core-server.logger.fatal.md) | Logs abnormal or unexpected errors or messages that caused an unrecoverable failure |
|
|
||||||
| [get(childContextPaths)](./kibana-plugin-core-server.logger.get.md) | Returns a new [Logger](./kibana-plugin-core-server.logger.md) instance extending the current logger context. |
|
|
||||||
| [info(message, meta)](./kibana-plugin-core-server.logger.info.md) | Logs messages related to general application flow |
|
|
||||||
| [trace(message, meta)](./kibana-plugin-core-server.logger.trace.md) | Log messages at the most detailed log level |
|
|
||||||
| [warn(errorOrMessage, meta)](./kibana-plugin-core-server.logger.warn.md) | Logs abnormal or unexpected errors or messages |
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [trace](./kibana-plugin-core-server.logger.trace.md)
|
|
||||||
|
|
||||||
## Logger.trace() method
|
|
||||||
|
|
||||||
Log messages at the most detailed log level
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
trace(message: string, meta?: LogMeta): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| message | <code>string</code> | The log message |
|
|
||||||
| meta | <code>LogMeta</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Logger](./kibana-plugin-core-server.logger.md) > [warn](./kibana-plugin-core-server.logger.warn.md)
|
|
||||||
|
|
||||||
## Logger.warn() method
|
|
||||||
|
|
||||||
Logs abnormal or unexpected errors or messages
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
warn(errorOrMessage: string | Error, meta?: LogMeta): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| errorOrMessage | <code>string | Error</code> | An Error object or message string to log |
|
|
||||||
| meta | <code>LogMeta</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LoggerFactory](./kibana-plugin-core-server.loggerfactory.md) > [get](./kibana-plugin-core-server.loggerfactory.get.md)
|
|
||||||
|
|
||||||
## LoggerFactory.get() method
|
|
||||||
|
|
||||||
Returns a `Logger` instance for the specified context.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
get(...contextParts: string[]): Logger;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| contextParts | <code>string[]</code> | Parts of the context to return logger for. For example get('plugins', 'pid') will return a logger for the <code>plugins.pid</code> context. |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`Logger`
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LoggerFactory](./kibana-plugin-core-server.loggerfactory.md)
|
|
||||||
|
|
||||||
## LoggerFactory interface
|
|
||||||
|
|
||||||
The single purpose of `LoggerFactory` interface is to define a way to retrieve a context-based logger instance.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface LoggerFactory
|
|
||||||
```
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
| Method | Description |
|
|
||||||
| --- | --- |
|
|
||||||
| [get(contextParts)](./kibana-plugin-core-server.loggerfactory.get.md) | Returns a <code>Logger</code> instance for the specified context. |
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LogMeta](./kibana-plugin-core-server.logmeta.md)
|
|
||||||
|
|
||||||
## LogMeta interface
|
|
||||||
|
|
||||||
Contextual metadata
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface LogMeta
|
|
||||||
```
|
|
|
@ -65,7 +65,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [Capabilities](./kibana-plugin-core-server.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. |
|
| [Capabilities](./kibana-plugin-core-server.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. |
|
||||||
| [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | APIs to manage the [Capabilities](./kibana-plugin-core-server.capabilities.md) that will be used by the application.<!-- -->Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the <code>registerProvider</code> method.<!-- -->Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the <code>registerSwitcher</code> method.<!-- -->Refers to the methods documentation for complete description and examples. |
|
| [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | APIs to manage the [Capabilities](./kibana-plugin-core-server.capabilities.md) that will be used by the application.<!-- -->Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the <code>registerProvider</code> method.<!-- -->Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the <code>registerSwitcher</code> method.<!-- -->Refers to the methods documentation for complete description and examples. |
|
||||||
| [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) | APIs to access the application [Capabilities](./kibana-plugin-core-server.capabilities.md)<!-- -->. |
|
| [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) | APIs to access the application [Capabilities](./kibana-plugin-core-server.capabilities.md)<!-- -->. |
|
||||||
| [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) | Provides helpers to generates the most commonly used [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md) when invoking a [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md)<!-- -->.<!-- -->See methods documentation for more detailed examples. |
|
|
||||||
| [ContextSetup](./kibana-plugin-core-server.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. |
|
| [ContextSetup](./kibana-plugin-core-server.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. |
|
||||||
| [CoreSetup](./kibana-plugin-core-server.coresetup.md) | Context passed to the plugins <code>setup</code> method. |
|
| [CoreSetup](./kibana-plugin-core-server.coresetup.md) | Context passed to the plugins <code>setup</code> method. |
|
||||||
| [CoreStart](./kibana-plugin-core-server.corestart.md) | Context passed to the plugins <code>start</code> method. |
|
| [CoreStart](./kibana-plugin-core-server.corestart.md) | Context passed to the plugins <code>start</code> method. |
|
||||||
|
@ -81,7 +80,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) | |
|
| [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) | |
|
||||||
| [ElasticsearchServiceStart](./kibana-plugin-core-server.elasticsearchservicestart.md) | |
|
| [ElasticsearchServiceStart](./kibana-plugin-core-server.elasticsearchservicestart.md) | |
|
||||||
| [ElasticsearchStatusMeta](./kibana-plugin-core-server.elasticsearchstatusmeta.md) | |
|
| [ElasticsearchStatusMeta](./kibana-plugin-core-server.elasticsearchstatusmeta.md) | |
|
||||||
| [EnvironmentMode](./kibana-plugin-core-server.environmentmode.md) | |
|
|
||||||
| [ErrorHttpResponseOptions](./kibana-plugin-core-server.errorhttpresponseoptions.md) | HTTP response parameters |
|
| [ErrorHttpResponseOptions](./kibana-plugin-core-server.errorhttpresponseoptions.md) | HTTP response parameters |
|
||||||
| [Explanation](./kibana-plugin-core-server.explanation.md) | |
|
| [Explanation](./kibana-plugin-core-server.explanation.md) | |
|
||||||
| [FakeRequest](./kibana-plugin-core-server.fakerequest.md) | Fake request object created manually by Kibana plugins. |
|
| [FakeRequest](./kibana-plugin-core-server.fakerequest.md) | Fake request object created manually by Kibana plugins. |
|
||||||
|
@ -114,11 +112,8 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [LegacyRequest](./kibana-plugin-core-server.legacyrequest.md) | |
|
| [LegacyRequest](./kibana-plugin-core-server.legacyrequest.md) | |
|
||||||
| [LegacyServiceSetupDeps](./kibana-plugin-core-server.legacyservicesetupdeps.md) | |
|
| [LegacyServiceSetupDeps](./kibana-plugin-core-server.legacyservicesetupdeps.md) | |
|
||||||
| [LegacyServiceStartDeps](./kibana-plugin-core-server.legacyservicestartdeps.md) | |
|
| [LegacyServiceStartDeps](./kibana-plugin-core-server.legacyservicestartdeps.md) | |
|
||||||
| [Logger](./kibana-plugin-core-server.logger.md) | Logger exposes all the necessary methods to log any type of information and this is the interface used by the logging consumers including plugins. |
|
|
||||||
| [LoggerContextConfigInput](./kibana-plugin-core-server.loggercontextconfiginput.md) | |
|
| [LoggerContextConfigInput](./kibana-plugin-core-server.loggercontextconfiginput.md) | |
|
||||||
| [LoggerFactory](./kibana-plugin-core-server.loggerfactory.md) | The single purpose of <code>LoggerFactory</code> interface is to define a way to retrieve a context-based logger instance. |
|
|
||||||
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | Provides APIs to plugins for customizing the plugin's logger. |
|
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | Provides APIs to plugins for customizing the plugin's logger. |
|
||||||
| [LogMeta](./kibana-plugin-core-server.logmeta.md) | Contextual metadata |
|
|
||||||
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | APIs to retrieves metrics gathered and exposed by the core platform. |
|
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | APIs to retrieves metrics gathered and exposed by the core platform. |
|
||||||
| [NodesVersionCompatibility](./kibana-plugin-core-server.nodesversioncompatibility.md) | |
|
| [NodesVersionCompatibility](./kibana-plugin-core-server.nodesversioncompatibility.md) | |
|
||||||
| [OnPostAuthToolkit](./kibana-plugin-core-server.onpostauthtoolkit.md) | A tool set defining an outcome of OnPostAuth interceptor for incoming request. |
|
| [OnPostAuthToolkit](./kibana-plugin-core-server.onpostauthtoolkit.md) | A tool set defining an outcome of OnPostAuth interceptor for incoming request. |
|
||||||
|
@ -131,7 +126,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [OpsOsMetrics](./kibana-plugin-core-server.opsosmetrics.md) | OS related metrics |
|
| [OpsOsMetrics](./kibana-plugin-core-server.opsosmetrics.md) | OS related metrics |
|
||||||
| [OpsProcessMetrics](./kibana-plugin-core-server.opsprocessmetrics.md) | Process related metrics |
|
| [OpsProcessMetrics](./kibana-plugin-core-server.opsprocessmetrics.md) | Process related metrics |
|
||||||
| [OpsServerMetrics](./kibana-plugin-core-server.opsservermetrics.md) | server related metrics |
|
| [OpsServerMetrics](./kibana-plugin-core-server.opsservermetrics.md) | server related metrics |
|
||||||
| [PackageInfo](./kibana-plugin-core-server.packageinfo.md) | |
|
|
||||||
| [Plugin](./kibana-plugin-core-server.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
|
| [Plugin](./kibana-plugin-core-server.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
|
||||||
| [PluginConfigDescriptor](./kibana-plugin-core-server.pluginconfigdescriptor.md) | Describes a plugin configuration properties. |
|
| [PluginConfigDescriptor](./kibana-plugin-core-server.pluginconfigdescriptor.md) | Describes a plugin configuration properties. |
|
||||||
| [PluginInitializerContext](./kibana-plugin-core-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. |
|
| [PluginInitializerContext](./kibana-plugin-core-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. |
|
||||||
|
@ -233,10 +227,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
||||||
| [AuthResult](./kibana-plugin-core-server.authresult.md) | |
|
| [AuthResult](./kibana-plugin-core-server.authresult.md) | |
|
||||||
| [CapabilitiesProvider](./kibana-plugin-core-server.capabilitiesprovider.md) | See [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) |
|
| [CapabilitiesProvider](./kibana-plugin-core-server.capabilitiesprovider.md) | See [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) |
|
||||||
| [CapabilitiesSwitcher](./kibana-plugin-core-server.capabilitiesswitcher.md) | See [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) |
|
| [CapabilitiesSwitcher](./kibana-plugin-core-server.capabilitiesswitcher.md) | See [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) |
|
||||||
| [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md) | Configuration deprecation returned from [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md) that handles a single deprecation from the configuration. |
|
|
||||||
| [ConfigDeprecationLogger](./kibana-plugin-core-server.configdeprecationlogger.md) | Logger interface used when invoking a [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md) |
|
|
||||||
| [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md) | A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md)<!-- -->.<!-- -->See [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) for more usage examples. |
|
|
||||||
| [ConfigPath](./kibana-plugin-core-server.configpath.md) | |
|
|
||||||
| [DestructiveRouteMethod](./kibana-plugin-core-server.destructiveroutemethod.md) | Set of HTTP methods changing the state of the server. |
|
| [DestructiveRouteMethod](./kibana-plugin-core-server.destructiveroutemethod.md) | Set of HTTP methods changing the state of the server. |
|
||||||
| [ElasticsearchClient](./kibana-plugin-core-server.elasticsearchclient.md) | Client used to query the elasticsearch cluster. |
|
| [ElasticsearchClient](./kibana-plugin-core-server.elasticsearchclient.md) | Client used to query the elasticsearch cluster. |
|
||||||
| [ElasticsearchClientConfig](./kibana-plugin-core-server.elasticsearchclientconfig.md) | Configuration options to be used to create a [cluster client](./kibana-plugin-core-server.iclusterclient.md) using the [createClient API](./kibana-plugin-core-server.elasticsearchservicestart.createclient.md) |
|
| [ElasticsearchClientConfig](./kibana-plugin-core-server.elasticsearchclientconfig.md) | Configuration options to be used to create a [cluster client](./kibana-plugin-core-server.iclusterclient.md) using the [createClient API](./kibana-plugin-core-server.elasticsearchservicestart.createclient.md) |
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PackageInfo](./kibana-plugin-core-server.packageinfo.md) > [branch](./kibana-plugin-core-server.packageinfo.branch.md)
|
|
||||||
|
|
||||||
## PackageInfo.branch property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
branch: string;
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PackageInfo](./kibana-plugin-core-server.packageinfo.md) > [buildNum](./kibana-plugin-core-server.packageinfo.buildnum.md)
|
|
||||||
|
|
||||||
## PackageInfo.buildNum property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
buildNum: number;
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PackageInfo](./kibana-plugin-core-server.packageinfo.md) > [buildSha](./kibana-plugin-core-server.packageinfo.buildsha.md)
|
|
||||||
|
|
||||||
## PackageInfo.buildSha property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
buildSha: string;
|
|
||||||
```
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PackageInfo](./kibana-plugin-core-server.packageinfo.md) > [dist](./kibana-plugin-core-server.packageinfo.dist.md)
|
|
||||||
|
|
||||||
## PackageInfo.dist property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
dist: boolean;
|
|
||||||
```
|
|
|
@ -1,23 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PackageInfo](./kibana-plugin-core-server.packageinfo.md)
|
|
||||||
|
|
||||||
## PackageInfo interface
|
|
||||||
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface PackageInfo
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [branch](./kibana-plugin-core-server.packageinfo.branch.md) | <code>string</code> | |
|
|
||||||
| [buildNum](./kibana-plugin-core-server.packageinfo.buildnum.md) | <code>number</code> | |
|
|
||||||
| [buildSha](./kibana-plugin-core-server.packageinfo.buildsha.md) | <code>string</code> | |
|
|
||||||
| [dist](./kibana-plugin-core-server.packageinfo.dist.md) | <code>boolean</code> | |
|
|
||||||
| [version](./kibana-plugin-core-server.packageinfo.version.md) | <code>string</code> | |
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PackageInfo](./kibana-plugin-core-server.packageinfo.md) > [version](./kibana-plugin-core-server.packageinfo.version.md)
|
|
||||||
|
|
||||||
## PackageInfo.version property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
version: string;
|
|
||||||
```
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
## PluginConfigDescriptor.deprecations property
|
## PluginConfigDescriptor.deprecations property
|
||||||
|
|
||||||
Provider for the [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md) to apply to the plugin configuration.
|
Provider for the to apply to the plugin configuration.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ export const config: PluginConfigDescriptor<ConfigType> = {
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [deprecations](./kibana-plugin-core-server.pluginconfigdescriptor.deprecations.md) | <code>ConfigDeprecationProvider</code> | Provider for the [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md) to apply to the plugin configuration. |
|
| [deprecations](./kibana-plugin-core-server.pluginconfigdescriptor.deprecations.md) | <code>ConfigDeprecationProvider</code> | Provider for the to apply to the plugin configuration. |
|
||||||
| [exposeToBrowser](./kibana-plugin-core-server.pluginconfigdescriptor.exposetobrowser.md) | <code>{</code><br/><code> [P in keyof T]?: boolean;</code><br/><code> }</code> | List of configuration properties that will be available on the client-side plugin. |
|
| [exposeToBrowser](./kibana-plugin-core-server.pluginconfigdescriptor.exposetobrowser.md) | <code>{</code><br/><code> [P in keyof T]?: boolean;</code><br/><code> }</code> | List of configuration properties that will be available on the client-side plugin. |
|
||||||
| [schema](./kibana-plugin-core-server.pluginconfigdescriptor.schema.md) | <code>PluginConfigSchema<T></code> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-core-server.pluginconfigschema.md) |
|
| [schema](./kibana-plugin-core-server.pluginconfigdescriptor.schema.md) | <code>PluginConfigSchema<T></code> | Schema to use to validate the plugin configuration.[PluginConfigSchema](./kibana-plugin-core-server.pluginconfigschema.md) |
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
## PluginManifest.configPath property
|
## PluginManifest.configPath property
|
||||||
|
|
||||||
Root [configuration path](./kibana-plugin-core-server.configpath.md) used by the plugin, defaults to "id" in snake\_case format.
|
Root used by the plugin, defaults to "id" in snake\_case format.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ Should never be used in code outside of Core but is exported for documentation p
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [configPath](./kibana-plugin-core-server.pluginmanifest.configpath.md) | <code>ConfigPath</code> | Root [configuration path](./kibana-plugin-core-server.configpath.md) used by the plugin, defaults to "id" in snake\_case format. |
|
| [configPath](./kibana-plugin-core-server.pluginmanifest.configpath.md) | <code>ConfigPath</code> | Root used by the plugin, defaults to "id" in snake\_case format. |
|
||||||
| [extraPublicDirs](./kibana-plugin-core-server.pluginmanifest.extrapublicdirs.md) | <code>string[]</code> | Specifies directory names that can be imported by other ui-plugins built using the same instance of the @<!-- -->kbn/optimizer. A temporary measure we plan to replace with better mechanisms for sharing static code between plugins |
|
| [extraPublicDirs](./kibana-plugin-core-server.pluginmanifest.extrapublicdirs.md) | <code>string[]</code> | Specifies directory names that can be imported by other ui-plugins built using the same instance of the @<!-- -->kbn/optimizer. A temporary measure we plan to replace with better mechanisms for sharing static code between plugins |
|
||||||
| [id](./kibana-plugin-core-server.pluginmanifest.id.md) | <code>PluginName</code> | Identifier of the plugin. Must be a string in camelCase. Part of a plugin public contract. Other plugins leverage it to access plugin API, navigate to the plugin, etc. |
|
| [id](./kibana-plugin-core-server.pluginmanifest.id.md) | <code>PluginName</code> | Identifier of the plugin. Must be a string in camelCase. Part of a plugin public contract. Other plugins leverage it to access plugin API, navigate to the plugin, etc. |
|
||||||
| [kibanaVersion](./kibana-plugin-core-server.pluginmanifest.kibanaversion.md) | <code>string</code> | The version of Kibana the plugin is compatible with, defaults to "version". |
|
| [kibanaVersion](./kibana-plugin-core-server.pluginmanifest.kibanaversion.md) | <code>string</code> | The version of Kibana the plugin is compatible with, defaults to "version". |
|
||||||
|
|
|
@ -137,9 +137,11 @@
|
||||||
"@hapi/wreck": "^15.0.2",
|
"@hapi/wreck": "^15.0.2",
|
||||||
"@kbn/analytics": "1.0.0",
|
"@kbn/analytics": "1.0.0",
|
||||||
"@kbn/babel-preset": "1.0.0",
|
"@kbn/babel-preset": "1.0.0",
|
||||||
|
"@kbn/config": "1.0.0",
|
||||||
"@kbn/config-schema": "1.0.0",
|
"@kbn/config-schema": "1.0.0",
|
||||||
"@kbn/i18n": "1.0.0",
|
"@kbn/i18n": "1.0.0",
|
||||||
"@kbn/interpreter": "1.0.0",
|
"@kbn/interpreter": "1.0.0",
|
||||||
|
"@kbn/logging": "1.0.0",
|
||||||
"@kbn/pm": "1.0.0",
|
"@kbn/pm": "1.0.0",
|
||||||
"@kbn/std": "1.0.0",
|
"@kbn/std": "1.0.0",
|
||||||
"@kbn/telemetry-tools": "1.0.0",
|
"@kbn/telemetry-tools": "1.0.0",
|
||||||
|
|
3
packages/kbn-config/README.md
Normal file
3
packages/kbn-config/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# `@kbn/config` — Kibana configuration file loader
|
||||||
|
|
||||||
|
This package contains the configuration service used to load and read the kibana configuration file
|
30
packages/kbn-config/package.json
Normal file
30
packages/kbn-config/package.json
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "@kbn/config",
|
||||||
|
"main": "./target/index.js",
|
||||||
|
"types": "./target/index.d.ts",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"kbn:bootstrap": "yarn build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@elastic/safer-lodash-set": "0.0.0",
|
||||||
|
"@kbn/config-schema": "1.0.0",
|
||||||
|
"@kbn/dev-utils": "1.0.0",
|
||||||
|
"@kbn/logging": "1.0.0",
|
||||||
|
"@kbn/std": "1.0.0",
|
||||||
|
"@kbn/utility-types": "1.0.0",
|
||||||
|
"js-yaml": "3.13.1",
|
||||||
|
"load-json-file": "^6.2.0",
|
||||||
|
"lodash": "^4.17.20",
|
||||||
|
"moment": "^2.24.0",
|
||||||
|
"rxjs": "^6.5.5",
|
||||||
|
"type-detect": "^4.0.8"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "4.0.2",
|
||||||
|
"tsd": "^0.7.4"
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ export type ConfigPath = string | string[];
|
||||||
/**
|
/**
|
||||||
* Checks whether specified value can be considered as config path.
|
* Checks whether specified value can be considered as config path.
|
||||||
* @param value Value to check.
|
* @param value Value to check.
|
||||||
* @internal
|
* @public
|
||||||
*/
|
*/
|
||||||
export function isConfigPath(value: unknown): value is ConfigPath {
|
export function isConfigPath(value: unknown): value is ConfigPath {
|
||||||
if (!value) {
|
if (!value) {
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
||||||
jest.mock('../../../../package.json', () => mockPackage);
|
jest.mock('../../../package.json', () => mockPackage);
|
||||||
|
|
||||||
export const mockApplyDeprecations = jest.fn((config, deprecations, log) => config);
|
export const mockApplyDeprecations = jest.fn((config, deprecations, log) => config);
|
||||||
jest.mock('./deprecation/apply_deprecations', () => ({
|
jest.mock('./deprecation/apply_deprecations', () => ({
|
|
@ -20,22 +20,36 @@
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { first, take } from 'rxjs/operators';
|
import { first, take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { mockPackage, mockApplyDeprecations } from './config_service.test.mocks';
|
import { mockApplyDeprecations } from './config_service.test.mocks';
|
||||||
import { rawConfigServiceMock } from './raw_config_service.mock';
|
import { rawConfigServiceMock } from './raw/raw_config_service.mock';
|
||||||
|
|
||||||
import { schema } from '@kbn/config-schema';
|
import { schema } from '@kbn/config-schema';
|
||||||
|
import { MockedLogger, loggerMock } from '@kbn/logging/target/mocks';
|
||||||
|
|
||||||
|
import { ConfigService, Env, RawPackageInfo } from '.';
|
||||||
|
|
||||||
import { ConfigService, Env } from '.';
|
|
||||||
import { loggingSystemMock } from '../logging/logging_system.mock';
|
|
||||||
import { getEnvOptions } from './__mocks__/env';
|
import { getEnvOptions } from './__mocks__/env';
|
||||||
|
|
||||||
|
const packageInfos: RawPackageInfo = {
|
||||||
|
branch: 'master',
|
||||||
|
version: '8.0.0',
|
||||||
|
build: {
|
||||||
|
number: 42,
|
||||||
|
sha: 'one',
|
||||||
|
},
|
||||||
|
};
|
||||||
const emptyArgv = getEnvOptions();
|
const emptyArgv = getEnvOptions();
|
||||||
const defaultEnv = new Env('/kibana', emptyArgv);
|
const defaultEnv = new Env('/kibana', packageInfos, emptyArgv);
|
||||||
const logger = loggingSystemMock.create();
|
|
||||||
|
let logger: MockedLogger;
|
||||||
|
|
||||||
const getRawConfigProvider = (rawConfig: Record<string, any>) =>
|
const getRawConfigProvider = (rawConfig: Record<string, any>) =>
|
||||||
rawConfigServiceMock.create({ rawConfig });
|
rawConfigServiceMock.create({ rawConfig });
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
logger = loggerMock.create();
|
||||||
|
});
|
||||||
|
|
||||||
test('returns config at path as observable', async () => {
|
test('returns config at path as observable', async () => {
|
||||||
const rawConfig = getRawConfigProvider({ key: 'foo' });
|
const rawConfig = getRawConfigProvider({ key: 'foo' });
|
||||||
const configService = new ConfigService(rawConfig, defaultEnv, logger);
|
const configService = new ConfigService(rawConfig, defaultEnv, logger);
|
||||||
|
@ -237,7 +251,7 @@ test('tracks unhandled paths', async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('correctly passes context', async () => {
|
test('correctly passes context', async () => {
|
||||||
mockPackage.raw = {
|
const mockPackage = {
|
||||||
branch: 'feature-v1',
|
branch: 'feature-v1',
|
||||||
version: 'v1',
|
version: 'v1',
|
||||||
build: {
|
build: {
|
||||||
|
@ -247,7 +261,7 @@ test('correctly passes context', async () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const env = new Env('/kibana', getEnvOptions());
|
const env = new Env('/kibana', mockPackage, getEnvOptions());
|
||||||
const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: { foo: {} } });
|
const rawConfigProvider = rawConfigServiceMock.create({ rawConfig: { foo: {} } });
|
||||||
|
|
||||||
const schemaDefinition = schema.object({
|
const schemaDefinition = schema.object({
|
||||||
|
@ -441,9 +455,9 @@ test('logs deprecation warning during validation', async () => {
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
|
||||||
loggingSystemMock.clear(logger);
|
loggerMock.clear(logger);
|
||||||
await configService.validate();
|
await configService.validate();
|
||||||
expect(loggingSystemMock.collect(logger).warn).toMatchInlineSnapshot(`
|
expect(loggerMock.collect(logger).warn).toMatchInlineSnapshot(`
|
||||||
Array [
|
Array [
|
||||||
Array [
|
Array [
|
||||||
"some deprecation message",
|
"some deprecation message",
|
|
@ -16,23 +16,24 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||||
import { Type } from '@kbn/config-schema';
|
import { Type } from '@kbn/config-schema';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
|
||||||
import { distinctUntilChanged, first, map, shareReplay, take } from 'rxjs/operators';
|
import { distinctUntilChanged, first, map, shareReplay, take } from 'rxjs/operators';
|
||||||
|
import { Logger, LoggerFactory } from '@kbn/logging';
|
||||||
|
|
||||||
import { Config, ConfigPath, Env } from '.';
|
import { Config, ConfigPath, Env } from '.';
|
||||||
import { Logger, LoggerFactory } from '../logging';
|
|
||||||
import { hasConfigPathIntersection } from './config';
|
import { hasConfigPathIntersection } from './config';
|
||||||
import { RawConfigurationProvider } from './raw_config_service';
|
import { RawConfigurationProvider } from './raw/raw_config_service';
|
||||||
import {
|
import {
|
||||||
applyDeprecations,
|
applyDeprecations,
|
||||||
ConfigDeprecationWithContext,
|
ConfigDeprecationWithContext,
|
||||||
ConfigDeprecationProvider,
|
ConfigDeprecationProvider,
|
||||||
configDeprecationFactory,
|
configDeprecationFactory,
|
||||||
} from './deprecation';
|
} from './deprecation';
|
||||||
import { LegacyObjectToConfigAdapter } from '../legacy/config';
|
import { LegacyObjectToConfigAdapter } from './legacy';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export type IConfigService = PublicMethodsOf<ConfigService>;
|
export type IConfigService = PublicMethodsOf<ConfigService>;
|
28
packages/kbn-config/src/deprecation/index.ts
Normal file
28
packages/kbn-config/src/deprecation/index.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export {
|
||||||
|
ConfigDeprecation,
|
||||||
|
ConfigDeprecationWithContext,
|
||||||
|
ConfigDeprecationLogger,
|
||||||
|
ConfigDeprecationFactory,
|
||||||
|
ConfigDeprecationProvider,
|
||||||
|
} from './types';
|
||||||
|
export { configDeprecationFactory } from './deprecation_factory';
|
||||||
|
export { applyDeprecations } from './apply_deprecations';
|
|
@ -17,7 +17,10 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
jest.mock('path', () => ({
|
const realPath = jest.requireActual('path');
|
||||||
|
|
||||||
|
jest.doMock('path', () => ({
|
||||||
|
...realPath,
|
||||||
resolve(...pathSegments: string[]) {
|
resolve(...pathSegments: string[]) {
|
||||||
return pathSegments.join('/');
|
return pathSegments.join('/');
|
||||||
},
|
},
|
||||||
|
@ -26,5 +29,10 @@ jest.mock('path', () => ({
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
|
export const mockPackage = {
|
||||||
jest.mock('../../../../package.json', () => mockPackage);
|
raw: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
jest.doMock('load-json-file', () => ({
|
||||||
|
sync: () => mockPackage.raw,
|
||||||
|
}));
|
|
@ -19,9 +19,24 @@
|
||||||
|
|
||||||
import { mockPackage } from './env.test.mocks';
|
import { mockPackage } from './env.test.mocks';
|
||||||
|
|
||||||
import { Env } from '.';
|
import { Env, RawPackageInfo } from './env';
|
||||||
import { getEnvOptions } from './__mocks__/env';
|
import { getEnvOptions } from './__mocks__/env';
|
||||||
|
|
||||||
|
const REPO_ROOT = '/test/kibanaRoot';
|
||||||
|
|
||||||
|
const packageInfos: RawPackageInfo = {
|
||||||
|
branch: 'master',
|
||||||
|
version: '8.0.0',
|
||||||
|
build: {
|
||||||
|
number: 42,
|
||||||
|
sha: 'one',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
mockPackage.raw = {};
|
||||||
|
});
|
||||||
|
|
||||||
test('correctly creates default environment in dev mode.', () => {
|
test('correctly creates default environment in dev mode.', () => {
|
||||||
mockPackage.raw = {
|
mockPackage.raw = {
|
||||||
branch: 'some-branch',
|
branch: 'some-branch',
|
||||||
|
@ -29,6 +44,7 @@ test('correctly creates default environment in dev mode.', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultEnv = Env.createDefault(
|
const defaultEnv = Env.createDefault(
|
||||||
|
REPO_ROOT,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
configs: ['/test/cwd/config/kibana.yml'],
|
configs: ['/test/cwd/config/kibana.yml'],
|
||||||
isDevClusterMaster: true,
|
isDevClusterMaster: true,
|
||||||
|
@ -50,6 +66,7 @@ test('correctly creates default environment in prod distributable mode.', () =>
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultEnv = Env.createDefault(
|
const defaultEnv = Env.createDefault(
|
||||||
|
REPO_ROOT,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { dev: false },
|
cliArgs: { dev: false },
|
||||||
configs: ['/some/other/path/some-kibana.yml'],
|
configs: ['/some/other/path/some-kibana.yml'],
|
||||||
|
@ -71,6 +88,7 @@ test('correctly creates default environment in prod non-distributable mode.', ()
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultEnv = Env.createDefault(
|
const defaultEnv = Env.createDefault(
|
||||||
|
REPO_ROOT,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { dev: false },
|
cliArgs: { dev: false },
|
||||||
configs: ['/some/other/path/some-kibana.yml'],
|
configs: ['/some/other/path/some-kibana.yml'],
|
||||||
|
@ -92,6 +110,7 @@ test('correctly creates default environment if `--env.name` is supplied.', () =>
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultDevEnv = Env.createDefault(
|
const defaultDevEnv = Env.createDefault(
|
||||||
|
REPO_ROOT,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { envName: 'development' },
|
cliArgs: { envName: 'development' },
|
||||||
configs: ['/some/other/path/some-kibana.yml'],
|
configs: ['/some/other/path/some-kibana.yml'],
|
||||||
|
@ -99,6 +118,7 @@ test('correctly creates default environment if `--env.name` is supplied.', () =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const defaultProdEnv = Env.createDefault(
|
const defaultProdEnv = Env.createDefault(
|
||||||
|
REPO_ROOT,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { dev: false, envName: 'production' },
|
cliArgs: { dev: false, envName: 'production' },
|
||||||
configs: ['/some/other/path/some-kibana.yml'],
|
configs: ['/some/other/path/some-kibana.yml'],
|
||||||
|
@ -110,7 +130,9 @@ test('correctly creates default environment if `--env.name` is supplied.', () =>
|
||||||
});
|
});
|
||||||
|
|
||||||
test('correctly creates environment with constructor.', () => {
|
test('correctly creates environment with constructor.', () => {
|
||||||
mockPackage.raw = {
|
const env = new Env(
|
||||||
|
'/some/home/dir',
|
||||||
|
{
|
||||||
branch: 'feature-v1',
|
branch: 'feature-v1',
|
||||||
version: 'v1',
|
version: 'v1',
|
||||||
build: {
|
build: {
|
||||||
|
@ -118,10 +140,7 @@ test('correctly creates environment with constructor.', () => {
|
||||||
number: 100,
|
number: 100,
|
||||||
sha: 'feature-v1-build-sha',
|
sha: 'feature-v1-build-sha',
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
|
||||||
const env = new Env(
|
|
||||||
'/some/home/dir',
|
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { dev: false },
|
cliArgs: { dev: false },
|
||||||
configs: ['/some/other/path/some-kibana.yml'],
|
configs: ['/some/other/path/some-kibana.yml'],
|
||||||
|
@ -134,6 +153,7 @@ test('correctly creates environment with constructor.', () => {
|
||||||
test('pluginSearchPaths contains x-pack plugins path if --oss flag is false', () => {
|
test('pluginSearchPaths contains x-pack plugins path if --oss flag is false', () => {
|
||||||
const env = new Env(
|
const env = new Env(
|
||||||
'/some/home/dir',
|
'/some/home/dir',
|
||||||
|
packageInfos,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { oss: false },
|
cliArgs: { oss: false },
|
||||||
})
|
})
|
||||||
|
@ -145,6 +165,7 @@ test('pluginSearchPaths contains x-pack plugins path if --oss flag is false', ()
|
||||||
test('pluginSearchPaths does not contains x-pack plugins path if --oss flag is true', () => {
|
test('pluginSearchPaths does not contains x-pack plugins path if --oss flag is true', () => {
|
||||||
const env = new Env(
|
const env = new Env(
|
||||||
'/some/home/dir',
|
'/some/home/dir',
|
||||||
|
packageInfos,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { oss: true },
|
cliArgs: { oss: true },
|
||||||
})
|
})
|
||||||
|
@ -156,6 +177,7 @@ test('pluginSearchPaths does not contains x-pack plugins path if --oss flag is t
|
||||||
test('pluginSearchPaths contains examples plugins path if --run-examples flag is true', () => {
|
test('pluginSearchPaths contains examples plugins path if --run-examples flag is true', () => {
|
||||||
const env = new Env(
|
const env = new Env(
|
||||||
'/some/home/dir',
|
'/some/home/dir',
|
||||||
|
packageInfos,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { runExamples: true },
|
cliArgs: { runExamples: true },
|
||||||
})
|
})
|
||||||
|
@ -167,6 +189,7 @@ test('pluginSearchPaths contains examples plugins path if --run-examples flag is
|
||||||
test('pluginSearchPaths contains x-pack/examples plugins path if --run-examples flag is true', () => {
|
test('pluginSearchPaths contains x-pack/examples plugins path if --run-examples flag is true', () => {
|
||||||
const env = new Env(
|
const env = new Env(
|
||||||
'/some/home/dir',
|
'/some/home/dir',
|
||||||
|
packageInfos,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { runExamples: true },
|
cliArgs: { runExamples: true },
|
||||||
})
|
})
|
||||||
|
@ -178,6 +201,7 @@ test('pluginSearchPaths contains x-pack/examples plugins path if --run-examples
|
||||||
test('pluginSearchPaths does not contains examples plugins path if --run-examples flag is false', () => {
|
test('pluginSearchPaths does not contains examples plugins path if --run-examples flag is false', () => {
|
||||||
const env = new Env(
|
const env = new Env(
|
||||||
'/some/home/dir',
|
'/some/home/dir',
|
||||||
|
packageInfos,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { runExamples: false },
|
cliArgs: { runExamples: false },
|
||||||
})
|
})
|
||||||
|
@ -189,6 +213,7 @@ test('pluginSearchPaths does not contains examples plugins path if --run-example
|
||||||
test('pluginSearchPaths does not contains x-pack/examples plugins path if --run-examples flag is false', () => {
|
test('pluginSearchPaths does not contains x-pack/examples plugins path if --run-examples flag is false', () => {
|
||||||
const env = new Env(
|
const env = new Env(
|
||||||
'/some/home/dir',
|
'/some/home/dir',
|
||||||
|
packageInfos,
|
||||||
getEnvOptions({
|
getEnvOptions({
|
||||||
cliArgs: { runExamples: false },
|
cliArgs: { runExamples: false },
|
||||||
})
|
})
|
|
@ -17,13 +17,10 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { resolve, dirname } from 'path';
|
import { resolve, join } from 'path';
|
||||||
|
import loadJsonFile from 'load-json-file';
|
||||||
import { PackageInfo, EnvironmentMode } from './types';
|
import { PackageInfo, EnvironmentMode } from './types';
|
||||||
|
|
||||||
// `require` is necessary for this to work inside x-pack code as well
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
||||||
const pkg = require('../../../../package.json');
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export interface EnvOptions {
|
export interface EnvOptions {
|
||||||
configs: string[];
|
configs: string[];
|
||||||
|
@ -50,13 +47,26 @@ export interface CliArgs {
|
||||||
dist: boolean;
|
dist: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
|
export interface RawPackageInfo {
|
||||||
|
branch: string;
|
||||||
|
version: string;
|
||||||
|
build: {
|
||||||
|
distributable?: boolean;
|
||||||
|
number: number;
|
||||||
|
sha: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export class Env {
|
export class Env {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public static createDefault(options: EnvOptions): Env {
|
public static createDefault(repoRoot: string, options: EnvOptions, pkg?: RawPackageInfo): Env {
|
||||||
const repoRoot = dirname(require.resolve('../../../../package.json'));
|
if (!pkg) {
|
||||||
return new Env(repoRoot, options);
|
pkg = loadJsonFile.sync(join(repoRoot, 'package.json')) as RawPackageInfo;
|
||||||
|
}
|
||||||
|
return new Env(repoRoot, pkg, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
@ -99,7 +109,7 @@ export class Env {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
constructor(public readonly homeDir: string, options: EnvOptions) {
|
constructor(public readonly homeDir: string, pkg: RawPackageInfo, options: EnvOptions) {
|
||||||
this.configDir = resolve(this.homeDir, 'config');
|
this.configDir = resolve(this.homeDir, 'config');
|
||||||
this.binDir = resolve(this.homeDir, 'bin');
|
this.binDir = resolve(this.homeDir, 'bin');
|
||||||
this.logDir = resolve(this.homeDir, 'log');
|
this.logDir = resolve(this.homeDir, 'log');
|
37
packages/kbn-config/src/index.ts
Normal file
37
packages/kbn-config/src/index.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export {
|
||||||
|
applyDeprecations,
|
||||||
|
ConfigDeprecation,
|
||||||
|
ConfigDeprecationFactory,
|
||||||
|
configDeprecationFactory,
|
||||||
|
ConfigDeprecationLogger,
|
||||||
|
ConfigDeprecationProvider,
|
||||||
|
ConfigDeprecationWithContext,
|
||||||
|
} from './deprecation';
|
||||||
|
|
||||||
|
export { RawConfigurationProvider, RawConfigService, getConfigFromFiles } from './raw';
|
||||||
|
|
||||||
|
export { ConfigService, IConfigService } from './config_service';
|
||||||
|
export { Config, ConfigPath, isConfigPath, hasConfigPathIntersection } from './config';
|
||||||
|
export { ObjectToConfigAdapter } from './object_to_config_adapter';
|
||||||
|
export { CliArgs, Env, RawPackageInfo } from './env';
|
||||||
|
export { EnvironmentMode, PackageInfo } from './types';
|
||||||
|
export { LegacyObjectToConfigAdapter, LegacyLoggingConfig } from './legacy';
|
23
packages/kbn-config/src/legacy/index.ts
Normal file
23
packages/kbn-config/src/legacy/index.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export {
|
||||||
|
LegacyObjectToConfigAdapter,
|
||||||
|
LegacyLoggingConfig,
|
||||||
|
} from './legacy_object_to_config_adapter';
|
|
@ -17,10 +17,17 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ConfigPath } from '../../config';
|
import { ConfigPath } from '../config';
|
||||||
import { ObjectToConfigAdapter } from '../../config/object_to_config_adapter';
|
import { ObjectToConfigAdapter } from '../object_to_config_adapter';
|
||||||
import { LoggingConfigType } from '../../logging/logging_config';
|
|
||||||
import { LegacyVars } from '../types';
|
// TODO: fix once core schemas are moved to this package
|
||||||
|
type LoggingConfigType = any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
export type LegacyVars = Record<string, any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents logging config supported by the legacy platform.
|
* Represents logging config supported by the legacy platform.
|
28
packages/kbn-config/src/mocks.ts
Normal file
28
packages/kbn-config/src/mocks.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// these CANT be exported by the main entrypoint, as it cause ts check failures
|
||||||
|
// in `src/test` and `src/xpack/test` projects due to definition conflicts between
|
||||||
|
// mocha and jest declaring the same globals such as `it` or `beforeAll`, as the test
|
||||||
|
// files imports types from `core` that is importing the main `@kbn/config` entrypoint.
|
||||||
|
// For now, these should be imported using `import {} from '@kbn/config/target/mocks'`
|
||||||
|
export { configMock } from './config.mock';
|
||||||
|
export { configServiceMock } from './config_service.mock';
|
||||||
|
export { rawConfigServiceMock } from './raw/raw_config_service.mock';
|
||||||
|
export { getEnvOptions } from './__mocks__/env';
|
21
packages/kbn-config/src/raw/index.ts
Normal file
21
packages/kbn-config/src/raw/index.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export { RawConfigService, RawConfigurationProvider } from './raw_config_service';
|
||||||
|
export { getConfigFromFiles } from './read_config';
|
|
@ -16,6 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||||
import { RawConfigService } from './raw_config_service';
|
import { RawConfigService } from './raw_config_service';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
|
@ -20,7 +20,7 @@
|
||||||
import { mockGetConfigFromFiles } from './raw_config_service.test.mocks';
|
import { mockGetConfigFromFiles } from './raw_config_service.test.mocks';
|
||||||
|
|
||||||
import { first } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import { RawConfigService } from '.';
|
import { RawConfigService } from './raw_config_service';
|
||||||
|
|
||||||
const configFile = '/config/kibana.yml';
|
const configFile = '/config/kibana.yml';
|
||||||
const anotherConfigFile = '/config/kibana.dev.yml';
|
const anotherConfigFile = '/config/kibana.dev.yml';
|
|
@ -20,7 +20,7 @@
|
||||||
import { relative, resolve } from 'path';
|
import { relative, resolve } from 'path';
|
||||||
import { getConfigFromFiles } from './read_config';
|
import { getConfigFromFiles } from './read_config';
|
||||||
|
|
||||||
const fixtureFile = (name: string) => `${__dirname}/__fixtures__/${name}`;
|
const fixtureFile = (name: string) => resolve(`${__dirname}/../../__fixtures__/${name}`);
|
||||||
|
|
||||||
test('reads single yaml from file system and parses to json', () => {
|
test('reads single yaml from file system and parses to json', () => {
|
||||||
const config = getConfigFromFiles([fixtureFile('config.yml')]);
|
const config = getConfigFromFiles([fixtureFile('config.yml')]);
|
12
packages/kbn-config/tsconfig.json
Normal file
12
packages/kbn-config/tsconfig.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./target",
|
||||||
|
"stripInternal": false,
|
||||||
|
"declarationMap": true,
|
||||||
|
"types": ["jest", "node"]
|
||||||
|
},
|
||||||
|
"include": ["./src/**/*.ts"],
|
||||||
|
"exclude": ["target"]
|
||||||
|
}
|
1
packages/kbn-config/yarn.lock
Symbolic link
1
packages/kbn-config/yarn.lock
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../yarn.lock
|
61
packages/kbn-logging/README.md
Normal file
61
packages/kbn-logging/README.md
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# kbn-logging
|
||||||
|
|
||||||
|
Base types for the kibana platform logging system.
|
||||||
|
|
||||||
|
Note that this package currently only contains logging types. The only concrete implementation
|
||||||
|
is still in `core` for now.
|
||||||
|
|
||||||
|
- [Loggers, Appenders and Layouts](#loggers-appenders-and-layouts)
|
||||||
|
- [Logger hierarchy](#logger-hierarchy)
|
||||||
|
- [Log level](#log-level)
|
||||||
|
- [Layouts](#layouts)
|
||||||
|
|
||||||
|
The way logging works in Kibana is inspired by `log4j 2` logging framework used by [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#logging).
|
||||||
|
The main idea is to have consistent logging behaviour (configuration, log format etc.) across the entire Elastic Stack
|
||||||
|
where possible.
|
||||||
|
|
||||||
|
## Loggers, Appenders and Layouts
|
||||||
|
|
||||||
|
Kibana logging system has three main components: _loggers_, _appenders_ and _layouts_. These components allow us to log
|
||||||
|
messages according to message type and level, and to control how these messages are formatted and where the final logs
|
||||||
|
will be displayed or stored.
|
||||||
|
|
||||||
|
__Loggers__ define what logging settings should be applied at the particular context.
|
||||||
|
|
||||||
|
__Appenders__ define where log messages are displayed (eg. stdout or console) and stored (eg. file on the disk).
|
||||||
|
|
||||||
|
__Layouts__ define how log messages are formatted and what type of information they include.
|
||||||
|
|
||||||
|
|
||||||
|
## Logger hierarchy
|
||||||
|
|
||||||
|
Every logger has its unique name or context that follows hierarchical naming rule. The logger is considered to be an
|
||||||
|
ancestor of another logger if its name followed by a `.` is a prefix of the descendant logger name. For example logger
|
||||||
|
with `a.b` context is an ancestor of logger with `a.b.c` context. All top-level loggers are descendants of special
|
||||||
|
logger with `root` context that resides at the top of the logger hierarchy. This logger always exists and
|
||||||
|
fully configured.
|
||||||
|
|
||||||
|
Developer can configure _log level_ and _appenders_ that should be used within particular context. If logger configuration
|
||||||
|
specifies only _log level_ then _appenders_ configuration will be inherited from the ancestor logger.
|
||||||
|
|
||||||
|
__Note:__ in the current implementation log messages are only forwarded to appenders configured for a particular logger
|
||||||
|
context or to appenders of the closest ancestor if current logger doesn't have any appenders configured. That means that
|
||||||
|
we __don't support__ so called _appender additivity_ when log messages are forwarded to _every_ distinct appender within
|
||||||
|
ancestor chain including `root`.
|
||||||
|
|
||||||
|
## Log level
|
||||||
|
|
||||||
|
Currently we support the following log levels: _all_, _fatal_, _error_, _warn_, _info_, _debug_, _trace_, _off_.
|
||||||
|
Levels are ordered, so _all_ > _fatal_ > _error_ > _warn_ > _info_ > _debug_ > _trace_ > _off_.
|
||||||
|
A log record is being logged by the logger if its level is higher than or equal to the level of its logger. Otherwise,
|
||||||
|
the log record is ignored.
|
||||||
|
|
||||||
|
The _all_ and _off_ levels can be used only in configuration and are just handy shortcuts that allow developer to log every
|
||||||
|
log record or disable logging entirely for the specific context.
|
||||||
|
|
||||||
|
## Layouts
|
||||||
|
|
||||||
|
Every appender should know exactly how to format log messages before they are written to the console or file on the disk.
|
||||||
|
This behaviour is controlled by the layouts and configured through `appender.layout` configuration property for every
|
||||||
|
custom appender. Currently we don't define any default layout for the custom appenders, so one should always make the choice
|
||||||
|
explicitly.
|
18
packages/kbn-logging/package.json
Normal file
18
packages/kbn-logging/package.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "@kbn/logging",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"main": "./target/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"kbn:bootstrap": "yarn build",
|
||||||
|
"kbn:watch": "yarn build --watch"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@kbn/std": "1.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "4.0.2"
|
||||||
|
}
|
||||||
|
}
|
39
packages/kbn-logging/src/appenders.ts
Normal file
39
packages/kbn-logging/src/appenders.ts
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { LogRecord } from './log_record';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity that can append `LogRecord` instances to file, stdout, memory or whatever
|
||||||
|
* is implemented internally. It's supposed to be used by `Logger`.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface Appender {
|
||||||
|
append(record: LogRecord): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface should be additionally implemented by the `Appender`'s if they are supposed
|
||||||
|
* to be properly disposed. It's intentionally separated from `Appender` interface so that `Logger`
|
||||||
|
* that interacts with `Appender` doesn't have control over appender lifetime.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface DisposableAppender extends Appender {
|
||||||
|
dispose: () => void;
|
||||||
|
}
|
25
packages/kbn-logging/src/index.ts
Normal file
25
packages/kbn-logging/src/index.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export { LogLevel, LogLevelId } from './log_level';
|
||||||
|
export { LogRecord } from './log_record';
|
||||||
|
export { Logger, LogMeta } from './logger';
|
||||||
|
export { LoggerFactory } from './logger_factory';
|
||||||
|
export { Layout } from './layout';
|
||||||
|
export { Appender, DisposableAppender } from './appenders';
|
28
packages/kbn-logging/src/layout.ts
Normal file
28
packages/kbn-logging/src/layout.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { LogRecord } from './log_record';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity that can format `LogRecord` instance into a string.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export interface Layout {
|
||||||
|
format(record: LogRecord): string;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue