mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
disallow external imports to src/core/utils (#64852)
This commit is contained in:
parent
509ea6a91c
commit
ee270c7c3f
67 changed files with 737 additions and 36 deletions
|
@ -193,6 +193,11 @@ module.exports = {
|
|||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: ['(src|x-pack)/**/*', '!src/core/**/*'],
|
||||
from: ['src/core/utils/**/*'],
|
||||
errorMessage: `Plugins may only import from src/core/server and src/core/public.`,
|
||||
},
|
||||
{
|
||||
target: [
|
||||
'(src|x-pack)/legacy/**/*',
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [assertNever](./kibana-plugin-core-public.assertnever.md)
|
||||
|
||||
## assertNever() function
|
||||
|
||||
Can be used in switch statements to ensure we perform exhaustive checks, see https://www.typescriptlang.org/docs/handbook/advanced-types.html\#exhaustiveness-checking
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function assertNever(x: never): never;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| x | <code>never</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`never`
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [deepFreeze](./kibana-plugin-core-public.deepfreeze.md)
|
||||
|
||||
## deepFreeze() function
|
||||
|
||||
Apply Object.freeze to a value recursively and convert the return type to Readonly variant recursively
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function deepFreeze<T extends Freezable>(object: T): RecursiveReadonly<T>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| object | <code>T</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`RecursiveReadonly<T>`
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [Freezable](./kibana-plugin-core-public.freezable.md)
|
||||
|
||||
## Freezable type
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type Freezable = {
|
||||
[k: string]: any;
|
||||
} | any[];
|
||||
```
|
|
@ -0,0 +1,30 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [getFlattenedObject](./kibana-plugin-core-public.getflattenedobject.md)
|
||||
|
||||
## getFlattenedObject() function
|
||||
|
||||
Flattens a deeply nested object to a map of dot-separated paths pointing to all primitive values \*\*and arrays\*\* from `rootValue`<!-- -->.
|
||||
|
||||
example: getFlattenedObject(<!-- -->{ a: { b: 1, c: \[2,3\] } }<!-- -->) // =<!-- -->> { 'a.b': 1, 'a.c': \[2,3\] }
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function getFlattenedObject(rootValue: Record<string, any>): {
|
||||
[key: string]: any;
|
||||
};
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| rootValue | <code>Record<string, any></code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`{
|
||||
[key: string]: any;
|
||||
}`
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [isRelativeUrl](./kibana-plugin-core-public.isrelativeurl.md)
|
||||
|
||||
## isRelativeUrl() function
|
||||
|
||||
Determine if a url is relative. Any url including a protocol, hostname, or port is not considered relative. This means that absolute \*paths\* are considered to be relative \*urls\*
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function isRelativeUrl(candidatePath: string): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| candidatePath | <code>string</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`boolean`
|
||||
|
|
@ -27,6 +27,16 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [AppNavLinkStatus](./kibana-plugin-core-public.appnavlinkstatus.md) | Status of the application's navLink. |
|
||||
| [AppStatus](./kibana-plugin-core-public.appstatus.md) | Accessibility status of an application. |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| --- | --- |
|
||||
| [assertNever(x)](./kibana-plugin-core-public.assertnever.md) | Can be used in switch statements to ensure we perform exhaustive checks, see https://www.typescriptlang.org/docs/handbook/advanced-types.html\#exhaustiveness-checking |
|
||||
| [deepFreeze(object)](./kibana-plugin-core-public.deepfreeze.md) | Apply Object.freeze to a value recursively and convert the return type to Readonly variant recursively |
|
||||
| [getFlattenedObject(rootValue)](./kibana-plugin-core-public.getflattenedobject.md) | Flattens a deeply nested object to a map of dot-separated paths pointing to all primitive values \*\*and arrays\*\* from <code>rootValue</code>.<!-- -->example: getFlattenedObject(<!-- -->{ a: { b: 1, c: \[2,3\] } }<!-- -->) // =<!-- -->> { 'a.b': 1, 'a.c': \[2,3\] } |
|
||||
| [isRelativeUrl(candidatePath)](./kibana-plugin-core-public.isrelativeurl.md) | Determine if a url is relative. Any url including a protocol, hostname, or port is not considered relative. This means that absolute \*paths\* are considered to be relative \*urls\* |
|
||||
| [modifyUrl(url, urlModifier)](./kibana-plugin-core-public.modifyurl.md) | Takes a URL and a function that takes the meaningful parts of the URL as a key-value object, modifies some or all of the parts, and returns the modified parts formatted again as a url.<!-- -->Url Parts sent: - protocol - slashes (does the url have the //) - auth - hostname (just the name of the host, no port or auth information) - port - pathname (the path after the hostname, no query or hash, starts with a slash if there was a path) - query (always an object, even when no query on original url) - hash<!-- -->Why? - The default url library in node produces several conflicting properties on the "parsed" output. Modifying any of these might lead to the modifications being ignored (depending on which property was modified) - It's not always clear whether to use path/pathname, host/hostname, so this tries to add helpful constraints |
|
||||
|
||||
## Interfaces
|
||||
|
||||
| Interface | Description |
|
||||
|
@ -118,6 +128,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs. |
|
||||
| [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
|
||||
| [UiSettingsState](./kibana-plugin-core-public.uisettingsstate.md) | |
|
||||
| [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) | We define our own typings because the current version of @<!-- -->types/node declares properties to be optional "hostname?: string". Although, parse call returns "hostname: null \| string". |
|
||||
| [UserProvidedValues](./kibana-plugin-core-public.userprovidedvalues.md) | Describes the values explicitly set by user. |
|
||||
|
||||
## Type Aliases
|
||||
|
@ -139,6 +150,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [ChromeHelpExtensionMenuLink](./kibana-plugin-core-public.chromehelpextensionmenulink.md) | |
|
||||
| [ChromeNavLinkUpdateableFields](./kibana-plugin-core-public.chromenavlinkupdateablefields.md) | |
|
||||
| [FatalErrorsStart](./kibana-plugin-core-public.fatalerrorsstart.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
|
||||
| [Freezable](./kibana-plugin-core-public.freezable.md) | |
|
||||
| [HandlerContextType](./kibana-plugin-core-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-core-public.handlerfunction.md) to represent the type of the context. |
|
||||
| [HandlerFunction](./kibana-plugin-core-public.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-core-public.icontextcontainer.md) |
|
||||
| [HandlerParameters](./kibana-plugin-core-public.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-core-public.handlerfunction.md)<!-- -->, excluding the [HandlerContextType](./kibana-plugin-core-public.handlercontexttype.md)<!-- -->. |
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [modifyUrl](./kibana-plugin-core-public.modifyurl.md)
|
||||
|
||||
## modifyUrl() function
|
||||
|
||||
Takes a URL and a function that takes the meaningful parts of the URL as a key-value object, modifies some or all of the parts, and returns the modified parts formatted again as a url.
|
||||
|
||||
Url Parts sent: - protocol - slashes (does the url have the //) - auth - hostname (just the name of the host, no port or auth information) - port - pathname (the path after the hostname, no query or hash, starts with a slash if there was a path) - query (always an object, even when no query on original url) - hash
|
||||
|
||||
Why? - The default url library in node produces several conflicting properties on the "parsed" output. Modifying any of these might lead to the modifications being ignored (depending on which property was modified) - It's not always clear whether to use path/pathname, host/hostname, so this tries to add helpful constraints
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function modifyUrl(url: string, urlModifier: (urlParts: URLMeaningfulParts) => Partial<URLMeaningfulParts> | void): string;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| url | <code>string</code> | |
|
||||
| urlModifier | <code>(urlParts: URLMeaningfulParts) => Partial<URLMeaningfulParts> | void</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
|
||||
The modified and reformatted url
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [auth](./kibana-plugin-core-public.urlmeaningfulparts.auth.md)
|
||||
|
||||
## URLMeaningfulParts.auth property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
auth?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [hash](./kibana-plugin-core-public.urlmeaningfulparts.hash.md)
|
||||
|
||||
## URLMeaningfulParts.hash property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hash?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [hostname](./kibana-plugin-core-public.urlmeaningfulparts.hostname.md)
|
||||
|
||||
## URLMeaningfulParts.hostname property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hostname?: string | null;
|
||||
```
|
|
@ -0,0 +1,27 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md)
|
||||
|
||||
## URLMeaningfulParts interface
|
||||
|
||||
We define our own typings because the current version of @<!-- -->types/node declares properties to be optional "hostname?: string". Although, parse call returns "hostname: null \| string".
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface URLMeaningfulParts
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [auth](./kibana-plugin-core-public.urlmeaningfulparts.auth.md) | <code>string | null</code> | |
|
||||
| [hash](./kibana-plugin-core-public.urlmeaningfulparts.hash.md) | <code>string | null</code> | |
|
||||
| [hostname](./kibana-plugin-core-public.urlmeaningfulparts.hostname.md) | <code>string | null</code> | |
|
||||
| [pathname](./kibana-plugin-core-public.urlmeaningfulparts.pathname.md) | <code>string | null</code> | |
|
||||
| [port](./kibana-plugin-core-public.urlmeaningfulparts.port.md) | <code>string | null</code> | |
|
||||
| [protocol](./kibana-plugin-core-public.urlmeaningfulparts.protocol.md) | <code>string | null</code> | |
|
||||
| [query](./kibana-plugin-core-public.urlmeaningfulparts.query.md) | <code>ParsedQuery</code> | |
|
||||
| [slashes](./kibana-plugin-core-public.urlmeaningfulparts.slashes.md) | <code>boolean | null</code> | |
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [pathname](./kibana-plugin-core-public.urlmeaningfulparts.pathname.md)
|
||||
|
||||
## URLMeaningfulParts.pathname property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
pathname?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [port](./kibana-plugin-core-public.urlmeaningfulparts.port.md)
|
||||
|
||||
## URLMeaningfulParts.port property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
port?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [protocol](./kibana-plugin-core-public.urlmeaningfulparts.protocol.md)
|
||||
|
||||
## URLMeaningfulParts.protocol property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
protocol?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [query](./kibana-plugin-core-public.urlmeaningfulparts.query.md)
|
||||
|
||||
## URLMeaningfulParts.query property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
query: ParsedQuery;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [URLMeaningfulParts](./kibana-plugin-core-public.urlmeaningfulparts.md) > [slashes](./kibana-plugin-core-public.urlmeaningfulparts.slashes.md)
|
||||
|
||||
## URLMeaningfulParts.slashes property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
slashes?: boolean | null;
|
||||
```
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [assertNever](./kibana-plugin-core-server.assertnever.md)
|
||||
|
||||
## assertNever() function
|
||||
|
||||
Can be used in switch statements to ensure we perform exhaustive checks, see https://www.typescriptlang.org/docs/handbook/advanced-types.html\#exhaustiveness-checking
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function assertNever(x: never): never;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| x | <code>never</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`never`
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [deepFreeze](./kibana-plugin-core-server.deepfreeze.md)
|
||||
|
||||
## deepFreeze() function
|
||||
|
||||
Apply Object.freeze to a value recursively and convert the return type to Readonly variant recursively
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function deepFreeze<T extends Freezable>(object: T): RecursiveReadonly<T>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| object | <code>T</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`RecursiveReadonly<T>`
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [Freezable](./kibana-plugin-core-server.freezable.md)
|
||||
|
||||
## Freezable type
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type Freezable = {
|
||||
[k: string]: any;
|
||||
} | any[];
|
||||
```
|
|
@ -0,0 +1,30 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [getFlattenedObject](./kibana-plugin-core-server.getflattenedobject.md)
|
||||
|
||||
## getFlattenedObject() function
|
||||
|
||||
Flattens a deeply nested object to a map of dot-separated paths pointing to all primitive values \*\*and arrays\*\* from `rootValue`<!-- -->.
|
||||
|
||||
example: getFlattenedObject(<!-- -->{ a: { b: 1, c: \[2,3\] } }<!-- -->) // =<!-- -->> { 'a.b': 1, 'a.c': \[2,3\] }
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function getFlattenedObject(rootValue: Record<string, any>): {
|
||||
[key: string]: any;
|
||||
};
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| rootValue | <code>Record<string, any></code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`{
|
||||
[key: string]: any;
|
||||
}`
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [isRelativeUrl](./kibana-plugin-core-server.isrelativeurl.md)
|
||||
|
||||
## isRelativeUrl() function
|
||||
|
||||
Determine if a url is relative. Any url including a protocol, hostname, or port is not considered relative. This means that absolute \*paths\* are considered to be relative \*urls\*
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function isRelativeUrl(candidatePath: string): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| candidatePath | <code>string</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`boolean`
|
||||
|
|
@ -41,8 +41,13 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
|
||||
| Function | Description |
|
||||
| --- | --- |
|
||||
| [assertNever(x)](./kibana-plugin-core-server.assertnever.md) | Can be used in switch statements to ensure we perform exhaustive checks, see https://www.typescriptlang.org/docs/handbook/advanced-types.html\#exhaustiveness-checking |
|
||||
| [deepFreeze(object)](./kibana-plugin-core-server.deepfreeze.md) | Apply Object.freeze to a value recursively and convert the return type to Readonly variant recursively |
|
||||
| [exportSavedObjectsToStream({ types, objects, search, savedObjectsClient, exportSizeLimit, includeReferencesDeep, excludeExportDetails, namespace, })](./kibana-plugin-core-server.exportsavedobjectstostream.md) | Generates sorted saved object stream to be used for export. See the [options](./kibana-plugin-core-server.savedobjectsexportoptions.md) for more detailed information. |
|
||||
| [getFlattenedObject(rootValue)](./kibana-plugin-core-server.getflattenedobject.md) | Flattens a deeply nested object to a map of dot-separated paths pointing to all primitive values \*\*and arrays\*\* from <code>rootValue</code>.<!-- -->example: getFlattenedObject(<!-- -->{ a: { b: 1, c: \[2,3\] } }<!-- -->) // =<!-- -->> { 'a.b': 1, 'a.c': \[2,3\] } |
|
||||
| [importSavedObjectsFromStream({ readStream, objectLimit, overwrite, savedObjectsClient, supportedTypes, namespace, })](./kibana-plugin-core-server.importsavedobjectsfromstream.md) | Import saved objects from given stream. See the [options](./kibana-plugin-core-server.savedobjectsimportoptions.md) for more detailed information. |
|
||||
| [isRelativeUrl(candidatePath)](./kibana-plugin-core-server.isrelativeurl.md) | Determine if a url is relative. Any url including a protocol, hostname, or port is not considered relative. This means that absolute \*paths\* are considered to be relative \*urls\* |
|
||||
| [modifyUrl(url, urlModifier)](./kibana-plugin-core-server.modifyurl.md) | Takes a URL and a function that takes the meaningful parts of the URL as a key-value object, modifies some or all of the parts, and returns the modified parts formatted again as a url.<!-- -->Url Parts sent: - protocol - slashes (does the url have the //) - auth - hostname (just the name of the host, no port or auth information) - port - pathname (the path after the hostname, no query or hash, starts with a slash if there was a path) - query (always an object, even when no query on original url) - hash<!-- -->Why? - The default url library in node produces several conflicting properties on the "parsed" output. Modifying any of these might lead to the modifications being ignored (depending on which property was modified) - It's not always clear whether to use path/pathname, host/hostname, so this tries to add helpful constraints |
|
||||
| [resolveSavedObjectsImportErrors({ readStream, objectLimit, retries, savedObjectsClient, supportedTypes, namespace, })](./kibana-plugin-core-server.resolvesavedobjectsimporterrors.md) | Resolve and return saved object import errors. See the [options](./kibana-plugin-core-server.savedobjectsresolveimporterrorsoptions.md) for more detailed informations. |
|
||||
|
||||
## Interfaces
|
||||
|
@ -186,6 +191,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [UiSettingsParams](./kibana-plugin-core-server.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
|
||||
| [UiSettingsServiceSetup](./kibana-plugin-core-server.uisettingsservicesetup.md) | |
|
||||
| [UiSettingsServiceStart](./kibana-plugin-core-server.uisettingsservicestart.md) | |
|
||||
| [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) | We define our own typings because the current version of @<!-- -->types/node declares properties to be optional "hostname?: string". Although, parse call returns "hostname: null \| string". |
|
||||
| [UserProvidedValues](./kibana-plugin-core-server.userprovidedvalues.md) | Describes the values explicitly set by user. |
|
||||
| [UuidServiceSetup](./kibana-plugin-core-server.uuidservicesetup.md) | APIs to access the application's instance uuid. |
|
||||
|
||||
|
@ -212,6 +218,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [ConfigPath](./kibana-plugin-core-server.configpath.md) | |
|
||||
| [DestructiveRouteMethod](./kibana-plugin-core-server.destructiveroutemethod.md) | Set of HTTP methods changing the state of the server. |
|
||||
| [ElasticsearchClientConfig](./kibana-plugin-core-server.elasticsearchclientconfig.md) | |
|
||||
| [Freezable](./kibana-plugin-core-server.freezable.md) | |
|
||||
| [GetAuthHeaders](./kibana-plugin-core-server.getauthheaders.md) | Get headers to authenticate a user against Elasticsearch. |
|
||||
| [GetAuthState](./kibana-plugin-core-server.getauthstate.md) | Gets authentication state for a request. Returned by <code>auth</code> interceptor. |
|
||||
| [HandlerContextType](./kibana-plugin-core-server.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-core-server.handlerfunction.md) to represent the type of the context. |
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [modifyUrl](./kibana-plugin-core-server.modifyurl.md)
|
||||
|
||||
## modifyUrl() function
|
||||
|
||||
Takes a URL and a function that takes the meaningful parts of the URL as a key-value object, modifies some or all of the parts, and returns the modified parts formatted again as a url.
|
||||
|
||||
Url Parts sent: - protocol - slashes (does the url have the //) - auth - hostname (just the name of the host, no port or auth information) - port - pathname (the path after the hostname, no query or hash, starts with a slash if there was a path) - query (always an object, even when no query on original url) - hash
|
||||
|
||||
Why? - The default url library in node produces several conflicting properties on the "parsed" output. Modifying any of these might lead to the modifications being ignored (depending on which property was modified) - It's not always clear whether to use path/pathname, host/hostname, so this tries to add helpful constraints
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function modifyUrl(url: string, urlModifier: (urlParts: URLMeaningfulParts) => Partial<URLMeaningfulParts> | void): string;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| url | <code>string</code> | |
|
||||
| urlModifier | <code>(urlParts: URLMeaningfulParts) => Partial<URLMeaningfulParts> | void</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
|
||||
The modified and reformatted url
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [auth](./kibana-plugin-core-server.urlmeaningfulparts.auth.md)
|
||||
|
||||
## URLMeaningfulParts.auth property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
auth?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [hash](./kibana-plugin-core-server.urlmeaningfulparts.hash.md)
|
||||
|
||||
## URLMeaningfulParts.hash property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hash?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [hostname](./kibana-plugin-core-server.urlmeaningfulparts.hostname.md)
|
||||
|
||||
## URLMeaningfulParts.hostname property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
hostname?: string | null;
|
||||
```
|
|
@ -0,0 +1,27 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md)
|
||||
|
||||
## URLMeaningfulParts interface
|
||||
|
||||
We define our own typings because the current version of @<!-- -->types/node declares properties to be optional "hostname?: string". Although, parse call returns "hostname: null \| string".
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface URLMeaningfulParts
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [auth](./kibana-plugin-core-server.urlmeaningfulparts.auth.md) | <code>string | null</code> | |
|
||||
| [hash](./kibana-plugin-core-server.urlmeaningfulparts.hash.md) | <code>string | null</code> | |
|
||||
| [hostname](./kibana-plugin-core-server.urlmeaningfulparts.hostname.md) | <code>string | null</code> | |
|
||||
| [pathname](./kibana-plugin-core-server.urlmeaningfulparts.pathname.md) | <code>string | null</code> | |
|
||||
| [port](./kibana-plugin-core-server.urlmeaningfulparts.port.md) | <code>string | null</code> | |
|
||||
| [protocol](./kibana-plugin-core-server.urlmeaningfulparts.protocol.md) | <code>string | null</code> | |
|
||||
| [query](./kibana-plugin-core-server.urlmeaningfulparts.query.md) | <code>ParsedQuery</code> | |
|
||||
| [slashes](./kibana-plugin-core-server.urlmeaningfulparts.slashes.md) | <code>boolean | null</code> | |
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [pathname](./kibana-plugin-core-server.urlmeaningfulparts.pathname.md)
|
||||
|
||||
## URLMeaningfulParts.pathname property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
pathname?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [port](./kibana-plugin-core-server.urlmeaningfulparts.port.md)
|
||||
|
||||
## URLMeaningfulParts.port property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
port?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [protocol](./kibana-plugin-core-server.urlmeaningfulparts.protocol.md)
|
||||
|
||||
## URLMeaningfulParts.protocol property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
protocol?: string | null;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [query](./kibana-plugin-core-server.urlmeaningfulparts.query.md)
|
||||
|
||||
## URLMeaningfulParts.query property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
query: ParsedQuery;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [URLMeaningfulParts](./kibana-plugin-core-server.urlmeaningfulparts.md) > [slashes](./kibana-plugin-core-server.urlmeaningfulparts.slashes.md)
|
||||
|
||||
## URLMeaningfulParts.slashes property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
slashes?: boolean | null;
|
||||
```
|
|
@ -77,7 +77,17 @@ import {
|
|||
} from './context';
|
||||
|
||||
export { CoreContext, CoreSystem } from './core_system';
|
||||
export { RecursiveReadonly, DEFAULT_APP_CATEGORIES } from '../utils';
|
||||
export {
|
||||
RecursiveReadonly,
|
||||
DEFAULT_APP_CATEGORIES,
|
||||
getFlattenedObject,
|
||||
URLMeaningfulParts,
|
||||
modifyUrl,
|
||||
isRelativeUrl,
|
||||
Freezable,
|
||||
deepFreeze,
|
||||
assertNever,
|
||||
} from '../utils';
|
||||
export {
|
||||
AppCategory,
|
||||
UiSettingsParams,
|
||||
|
|
|
@ -16,6 +16,7 @@ import { Location } from 'history';
|
|||
import { LocationDescriptorObject } from 'history';
|
||||
import { MaybePromise } from '@kbn/utility-types';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ParsedQuery } from 'query-string';
|
||||
import { PublicUiSettingsParams as PublicUiSettingsParams_2 } from 'src/core/server/types';
|
||||
import React from 'react';
|
||||
import * as Rx from 'rxjs';
|
||||
|
@ -174,6 +175,9 @@ export type AppUpdatableFields = Pick<AppBase, 'status' | 'navLinkStatus' | 'too
|
|||
// @public
|
||||
export type AppUpdater = (app: AppBase) => Partial<AppUpdatableFields> | undefined;
|
||||
|
||||
// @public
|
||||
export function assertNever(x: never): never;
|
||||
|
||||
// @public
|
||||
export interface Capabilities {
|
||||
[key: string]: Record<string, boolean | Record<string, boolean>>;
|
||||
|
@ -434,6 +438,9 @@ export class CoreSystem {
|
|||
stop(): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export function deepFreeze<T extends Freezable>(object: T): RecursiveReadonly<T>;
|
||||
|
||||
// @internal (undocumented)
|
||||
export const DEFAULT_APP_CATEGORIES: Readonly<{
|
||||
analyze: {
|
||||
|
@ -584,6 +591,16 @@ export interface FatalErrorsSetup {
|
|||
// @public
|
||||
export type FatalErrorsStart = FatalErrorsSetup;
|
||||
|
||||
// @public (undocumented)
|
||||
export type Freezable = {
|
||||
[k: string]: any;
|
||||
} | any[];
|
||||
|
||||
// @public
|
||||
export function getFlattenedObject(rootValue: Record<string, any>): {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type HandlerContextType<T extends HandlerFunction<any>> = T extends HandlerFunction<infer U> ? U : never;
|
||||
|
||||
|
@ -795,6 +812,9 @@ export interface ImageValidation {
|
|||
};
|
||||
}
|
||||
|
||||
// @public
|
||||
export function isRelativeUrl(candidatePath: string): boolean;
|
||||
|
||||
// @public
|
||||
export type IToasts = Pick<ToastsApi, 'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError' | 'addInfo'>;
|
||||
|
||||
|
@ -857,6 +877,9 @@ export interface LegacyNavLink {
|
|||
url: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export function modifyUrl(url: string, urlModifier: (urlParts: URLMeaningfulParts) => Partial<URLMeaningfulParts> | void): string;
|
||||
|
||||
// @public
|
||||
export type MountPoint<T extends HTMLElement = HTMLElement> = (element: T) => UnmountCallback;
|
||||
|
||||
|
@ -1356,6 +1379,26 @@ export type UiSettingsType = 'undefined' | 'json' | 'markdown' | 'number' | 'sel
|
|||
// @public
|
||||
export type UnmountCallback = () => void;
|
||||
|
||||
// @public
|
||||
export interface URLMeaningfulParts {
|
||||
// (undocumented)
|
||||
auth?: string | null;
|
||||
// (undocumented)
|
||||
hash?: string | null;
|
||||
// (undocumented)
|
||||
hostname?: string | null;
|
||||
// (undocumented)
|
||||
pathname?: string | null;
|
||||
// (undocumented)
|
||||
port?: string | null;
|
||||
// (undocumented)
|
||||
protocol?: string | null;
|
||||
// (undocumented)
|
||||
query: ParsedQuery;
|
||||
// (undocumented)
|
||||
slashes?: boolean | null;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface UserProvidedValues<T = any> {
|
||||
// (undocumented)
|
||||
|
|
|
@ -288,7 +288,17 @@ export {
|
|||
MetricsServiceSetup,
|
||||
} from './metrics';
|
||||
|
||||
export { RecursiveReadonly } from '../utils';
|
||||
export {
|
||||
RecursiveReadonly,
|
||||
DEFAULT_APP_CATEGORIES,
|
||||
getFlattenedObject,
|
||||
URLMeaningfulParts,
|
||||
modifyUrl,
|
||||
isRelativeUrl,
|
||||
Freezable,
|
||||
deepFreeze,
|
||||
assertNever,
|
||||
} from '../utils';
|
||||
|
||||
export {
|
||||
SavedObject,
|
||||
|
|
|
@ -103,6 +103,7 @@ import { NodesInfoParams } from 'elasticsearch';
|
|||
import { NodesStatsParams } from 'elasticsearch';
|
||||
import { ObjectType } from '@kbn/config-schema';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ParsedQuery } from 'query-string';
|
||||
import { PeerCertificate } from 'tls';
|
||||
import { PingParams } from 'elasticsearch';
|
||||
import { PutScriptParams } from 'elasticsearch';
|
||||
|
@ -388,6 +389,9 @@ export interface APICaller {
|
|||
<T = any>(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<T>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export function assertNever(x: never): never;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface AssistanceAPIResponse {
|
||||
// (undocumented)
|
||||
|
@ -691,6 +695,31 @@ export interface CustomHttpResponseOptions<T extends HttpResponsePayload | Respo
|
|||
statusCode: number;
|
||||
}
|
||||
|
||||
// @public
|
||||
export function deepFreeze<T extends Freezable>(object: T): RecursiveReadonly<T>;
|
||||
|
||||
// @internal (undocumented)
|
||||
export const DEFAULT_APP_CATEGORIES: Readonly<{
|
||||
analyze: {
|
||||
label: string;
|
||||
order: number;
|
||||
};
|
||||
observability: {
|
||||
label: string;
|
||||
euiIconType: string;
|
||||
order: number;
|
||||
};
|
||||
security: {
|
||||
label: string;
|
||||
order: number;
|
||||
euiIconType: string;
|
||||
};
|
||||
management: {
|
||||
label: string;
|
||||
euiIconType: string;
|
||||
};
|
||||
}>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface DeprecationAPIClientParams extends GenericParams {
|
||||
// (undocumented)
|
||||
|
@ -838,6 +867,11 @@ export interface FakeRequest {
|
|||
headers: Headers;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type Freezable = {
|
||||
[k: string]: any;
|
||||
} | any[];
|
||||
|
||||
// @public
|
||||
export type GetAuthHeaders = (request: KibanaRequest | LegacyRequest) => AuthHeaders | undefined;
|
||||
|
||||
|
@ -847,6 +881,11 @@ export type GetAuthState = <T = unknown>(request: KibanaRequest | LegacyRequest)
|
|||
state: T;
|
||||
};
|
||||
|
||||
// @public
|
||||
export function getFlattenedObject(rootValue: Record<string, any>): {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type HandlerContextType<T extends HandlerFunction<any>> = T extends HandlerFunction<infer U> ? U : never;
|
||||
|
||||
|
@ -1034,6 +1073,9 @@ export type ISavedObjectTypeRegistry = Omit<SavedObjectTypeRegistry, 'registerTy
|
|||
// @public
|
||||
export type IScopedClusterClient = Pick<ScopedClusterClient, 'callAsCurrentUser' | 'callAsInternalUser'>;
|
||||
|
||||
// @public
|
||||
export function isRelativeUrl(candidatePath: string): boolean;
|
||||
|
||||
// @public
|
||||
export interface IUiSettingsClient {
|
||||
get: <T = any>(key: string) => Promise<T>;
|
||||
|
@ -1289,6 +1331,9 @@ export type MIGRATION_ASSISTANCE_INDEX_ACTION = 'upgrade' | 'reindex';
|
|||
// @public (undocumented)
|
||||
export type MIGRATION_DEPRECATION_LEVEL = 'none' | 'info' | 'warning' | 'critical';
|
||||
|
||||
// @public
|
||||
export function modifyUrl(url: string, urlModifier: (urlParts: URLMeaningfulParts) => Partial<URLMeaningfulParts> | void): string;
|
||||
|
||||
// @public
|
||||
export type MutatingOperationRefreshSetting = boolean | 'wait_for';
|
||||
|
||||
|
@ -2447,6 +2492,26 @@ export interface UiSettingsServiceStart {
|
|||
// @public
|
||||
export type UiSettingsType = 'undefined' | 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string' | 'array' | 'image';
|
||||
|
||||
// @public
|
||||
export interface URLMeaningfulParts {
|
||||
// (undocumented)
|
||||
auth?: string | null;
|
||||
// (undocumented)
|
||||
hash?: string | null;
|
||||
// (undocumented)
|
||||
hostname?: string | null;
|
||||
// (undocumented)
|
||||
pathname?: string | null;
|
||||
// (undocumented)
|
||||
port?: string | null;
|
||||
// (undocumented)
|
||||
protocol?: string | null;
|
||||
// (undocumented)
|
||||
query: ParsedQuery;
|
||||
// (undocumented)
|
||||
slashes?: boolean | null;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface UserProvidedValues<T = any> {
|
||||
// (undocumented)
|
||||
|
|
|
@ -17,8 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
// Can be used in switch statements to ensure we perform exhaustive checks, see
|
||||
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
||||
/**
|
||||
* Can be used in switch statements to ensure we perform exhaustive checks, see
|
||||
* https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function assertNever(x: never): never {
|
||||
throw new Error(`Unexpected object: ${x}`);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
type Freezable = { [k: string]: any } | any[];
|
||||
|
||||
// if we define this inside RecursiveReadonly TypeScript complains
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface RecursiveReadonlyArray<T> extends Array<RecursiveReadonly<T>> {}
|
||||
|
@ -32,6 +30,15 @@ export type RecursiveReadonly<T> = T extends (...args: any[]) => any
|
|||
? Readonly<{ [K in keyof T]: RecursiveReadonly<T[K]> }>
|
||||
: T;
|
||||
|
||||
/** @public */
|
||||
export type Freezable = { [k: string]: any } | any[];
|
||||
|
||||
/**
|
||||
* Apply Object.freeze to a value recursively and convert the return type to
|
||||
* Readonly variant recursively
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function deepFreeze<T extends Freezable>(object: T) {
|
||||
// for any properties that reference an object, makes sure that object is
|
||||
// recursively frozen as well
|
||||
|
|
|
@ -30,8 +30,7 @@ function shouldReadKeys(value: unknown): value is Record<string, any> {
|
|||
* getFlattenedObject({ a: { b: 1, c: [2,3] } })
|
||||
* // => { 'a.b': 1, 'a.c': [2,3] }
|
||||
*
|
||||
* @param {Object} rootValue
|
||||
* @returns {Object}
|
||||
* @public
|
||||
*/
|
||||
export function getFlattenedObject(rootValue: Record<string, any>) {
|
||||
if (!shouldReadKeys(rootValue)) {
|
||||
|
|
|
@ -23,6 +23,8 @@ import { format as formatUrl, parse as parseUrl, UrlObject } from 'url';
|
|||
* We define our own typings because the current version of @types/node
|
||||
* declares properties to be optional "hostname?: string".
|
||||
* Although, parse call returns "hostname: null | string".
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface URLMeaningfulParts {
|
||||
auth?: string | null;
|
||||
|
@ -63,6 +65,7 @@ export interface URLMeaningfulParts {
|
|||
* @param url The string url to parse.
|
||||
* @param urlModifier A function that will modify the parsed url, or return a new one.
|
||||
* @returns The modified and reformatted url
|
||||
* @public
|
||||
*/
|
||||
export function modifyUrl(
|
||||
url: string,
|
||||
|
@ -100,6 +103,12 @@ export function modifyUrl(
|
|||
} as UrlObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a url is relative. Any url including a protocol, hostname, or
|
||||
* port is not considered relative. This means that absolute *paths* are considered
|
||||
* to be relative *urls*
|
||||
* @public
|
||||
*/
|
||||
export function isRelativeUrl(candidatePath: string) {
|
||||
// validate that `candidatePath` is not attempting a redirect to somewhere
|
||||
// outside of this Kibana install
|
||||
|
|
|
@ -24,11 +24,11 @@ import { promisify } from 'util';
|
|||
import { importApi } from './server/routes/api/import';
|
||||
import { exportApi } from './server/routes/api/export';
|
||||
import mappings from './mappings.json';
|
||||
import { getUiSettingDefaults } from './ui_setting_defaults';
|
||||
import { getUiSettingDefaults } from './server/ui_setting_defaults';
|
||||
import { registerCspCollector } from './server/lib/csp_usage_collector';
|
||||
import { injectVars } from './inject_vars';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
|
||||
import { kbnBaseUrl } from '../../../plugins/kibana_legacy/server';
|
||||
|
||||
const mkdirAsync = promisify(Fs.mkdir);
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
import numeralLanguages from '@elastic/numeral/languages';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { DEFAULT_QUERY_LANGUAGE } from '../../../plugins/data/common';
|
||||
import { isRelativeUrl } from '../../../core/utils';
|
||||
import { isRelativeUrl } from '../../../../core/server';
|
||||
import { DEFAULT_QUERY_LANGUAGE } from '../../../../plugins/data/common';
|
||||
|
||||
export function getUiSettingDefaults() {
|
||||
const weekdays = moment.weekdays().slice();
|
|
@ -21,7 +21,7 @@ import { resolve } from 'path';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { Legacy } from 'kibana';
|
||||
import { LegacyPluginApi, LegacyPluginInitializer } from 'src/legacy/plugin_discovery/types';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../core/server';
|
||||
|
||||
const experimentalLabel = i18n.translate('timelion.uiSettings.experimentalLabel', {
|
||||
defaultMessage: 'experimental',
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { parse } from 'url';
|
||||
|
||||
import { modifyUrl } from '../../../../core/utils';
|
||||
import { modifyUrl } from '../../../../core/public';
|
||||
import { prependPath } from './prepend_path';
|
||||
|
||||
interface Options {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import React from 'react';
|
||||
import { EuiCodeBlock, EuiDescriptionList, EuiSpacer } from '@elastic/eui';
|
||||
import { ShardFailure } from './shard_failure_types';
|
||||
import { getFlattenedObject } from '../../../../../core/utils';
|
||||
import { getFlattenedObject } from '../../../../../core/public';
|
||||
import { ShardFailureDescriptionHeader } from './shard_failure_description_header';
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,7 +36,7 @@ import { ChromeBreadcrumb, EnvironmentMode, PackageInfo } from 'kibana/public';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { CoreStart, LegacyCoreStart } from 'kibana/public';
|
||||
import { modifyUrl } from '../../../../core/utils';
|
||||
import { modifyUrl } from '../../../../core/public';
|
||||
import { toMountPoint } from '../../../kibana_react/public';
|
||||
import { isSystemApiRequest, UrlOverflowService } from '../utils';
|
||||
import { formatAngularHttpError, isAngularHttpError } from '../notify/lib';
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { ILocationService } from 'angular';
|
||||
import { modifyUrl } from '../../../../../core/utils';
|
||||
import { modifyUrl } from '../../../../../core/public';
|
||||
import { ToastsStart } from '../../../../../core/public';
|
||||
|
||||
const APP_REDIRECT_MESSAGE_PARAM = 'app_redirect_message';
|
||||
|
|
|
@ -23,7 +23,7 @@ import { schema } from '@kbn/config-schema';
|
|||
import { shortUrlAssertValid } from './lib/short_url_assert_valid';
|
||||
import { ShortUrlLookupService } from './lib/short_url_lookup';
|
||||
import { getGotoPath } from '../../common/short_url_routes';
|
||||
import { modifyUrl } from '../../../../core/utils';
|
||||
import { modifyUrl } from '../../../../core/server';
|
||||
|
||||
export const createGotoRoute = ({
|
||||
router,
|
||||
|
|
|
@ -25,7 +25,7 @@ import {
|
|||
PluginInitializerContext,
|
||||
RecursiveReadonly,
|
||||
} from '../../../../src/core/server';
|
||||
import { deepFreeze } from '../../../../src/core/utils';
|
||||
import { deepFreeze } from '../../../../src/core/server';
|
||||
import { configSchema } from '../config';
|
||||
import loadFunctions from './lib/load_functions';
|
||||
import { functionsRoute } from './routes/functions';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
|
||||
import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib';
|
||||
|
||||
export function canvas(kibana) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { resolve } from 'path';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
|
||||
import { CONFIG_DASHBOARD_ONLY_MODE_ROLES } from './common';
|
||||
import { createDashboardModeRequestInterceptor } from './server';
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
createMapPath,
|
||||
MAP_SAVED_OBJECT_TYPE,
|
||||
} from '../../../plugins/maps/common/constants';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
|
||||
|
||||
export function maps(kibana) {
|
||||
return new kibana.Plugin({
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { assertNever } from '../../../../../src/core/utils';
|
||||
import { assertNever } from '../../../../../src/core/server';
|
||||
import { ILicense } from '../../../licensing/common/types';
|
||||
import { PLUGIN } from '../constants/plugin';
|
||||
import { ActionType } from '../types';
|
||||
|
|
|
@ -8,7 +8,7 @@ import Boom from 'boom';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { ILicense } from '../../../../plugins/licensing/common/types';
|
||||
import { assertNever } from '../../../../../src/core/utils';
|
||||
import { assertNever } from '../../../../../src/core/server';
|
||||
import { PLUGIN } from '../constants/plugin';
|
||||
|
||||
export interface AlertingLicenseInformation {
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
Plugin,
|
||||
PluginInitializerContext
|
||||
} from '../../../../src/core/public';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
|
||||
|
||||
import {
|
||||
PluginSetupContract as AlertingPluginPublicSetup,
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
RecursiveReadonly,
|
||||
} from '../../../../src/core/server';
|
||||
import { Capabilities as UICapabilities } from '../../../../src/core/server';
|
||||
import { deepFreeze } from '../../../../src/core/utils';
|
||||
import { deepFreeze } from '../../../../src/core/server';
|
||||
import { XPackInfo } from '../../../legacy/plugins/xpack_main/server/lib/xpack_info';
|
||||
import { PluginSetupContract as TimelionSetupContract } from '../../../../src/plugins/vis_type_timelion/server';
|
||||
import { FeatureRegistry } from './feature_registry';
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ILicense } from '../../licensing/common/types';
|
||||
import { assertNever } from '../../../../src/core/utils';
|
||||
|
||||
// Can be used in switch statements to ensure we perform exhaustive checks, see
|
||||
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
||||
export function assertNever(x: never): never {
|
||||
throw new Error(`Unexpected object: ${x}`);
|
||||
}
|
||||
|
||||
export interface GraphLicenseInformation {
|
||||
showAppLink: boolean;
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
FeatureCatalogueCategory,
|
||||
HomePublicPluginSetup,
|
||||
} from '../../../../src/plugins/home/public';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
|
||||
import { ConfigSchema } from '../config';
|
||||
|
||||
export interface GraphPluginSetupDependencies {
|
||||
|
|
|
@ -17,7 +17,7 @@ import { setDatasource, IndexpatternDatasource, requestDatasource } from './data
|
|||
import { outlinkEncoders } from '../helpers/outlink_encoders';
|
||||
import { urlTemplatePlaceholder } from '../helpers/url_template';
|
||||
import { matchesOne } from './helpers';
|
||||
import { modifyUrl } from '../../../../../src/core/utils';
|
||||
import { modifyUrl } from '../../../../../src/core/public';
|
||||
|
||||
const actionCreator = actionCreatorFactory('x-pack/graph/urlTemplates');
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
PluginInitializerContext,
|
||||
AppMountParameters,
|
||||
} from 'kibana/public';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
|
||||
import { registerStartSingleton } from './legacy_singletons';
|
||||
import { registerFeatures } from './register_feature';
|
||||
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
CoreStart,
|
||||
} from 'src/core/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
|
||||
import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public';
|
||||
import { LicensingPluginSetup } from '../../licensing/public';
|
||||
import { PLUGIN_ID } from '../common/constants';
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
FeatureCatalogueCategory,
|
||||
HomePublicPluginSetup,
|
||||
} from '../../../../src/plugins/home/public';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
|
||||
import { MonitoringPluginDependencies, MonitoringConfig } from './types';
|
||||
import {
|
||||
MONITORING_CONFIG_ALERTING_EMAIL_ADDRESS,
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
IClusterClient,
|
||||
Headers,
|
||||
} from '../../../../../../src/core/server';
|
||||
import { deepFreeze } from '../../../../../../src/core/utils';
|
||||
import { deepFreeze } from '../../../../../../src/core/server';
|
||||
import { AuthenticatedUser } from '../../../common/model';
|
||||
import { AuthenticationResult } from '../authentication_result';
|
||||
import { DeauthenticationResult } from '../deauthentication_result';
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
Logger,
|
||||
PluginInitializerContext,
|
||||
} from '../../../../src/core/server';
|
||||
import { deepFreeze } from '../../../../src/core/utils';
|
||||
import { deepFreeze } from '../../../../src/core/server';
|
||||
import { SpacesPluginSetup } from '../../spaces/server';
|
||||
import { PluginSetupContract as FeaturesSetupContract } from '../../features/server';
|
||||
import { LicensingPluginSetup } from '../../licensing/server';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { deepFreeze } from '../../../../../src/core/utils';
|
||||
import { deepFreeze } from '../../../../../src/core/server';
|
||||
|
||||
export const SpacesSavedObjectMappings = deepFreeze({
|
||||
properties: {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { CoreSetup, PluginInitializer } from '../../../../../../src/core/server';
|
||||
import { deepFreeze } from '../../../../../../src/core/utils';
|
||||
import { deepFreeze } from '../../../../../../src/core/server';
|
||||
import {
|
||||
EncryptedSavedObjectsPluginSetup,
|
||||
EncryptedSavedObjectsPluginStart,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue