Bump TypeScript to v3.9 (#67666) (#68870)

* add babel support for export type

* bump ts version to 3.9.3

* rebuild kbn-pm

* bump typescript-eslint

* fix error in security plugin UI

* check export as works

* fix app migration type

* use correct test subj attribute

* fix errors from the old PR

* embeddable is already passed in props

* explicitly define type of fetch

* add some types for viz

* fix fetch type p.2

* add null to allow spreading without type errors due to override

* add type guard to fix type error

* cast to any, since cannot assign unknown

* add timestamp to known types

* fix type error in fetch

* fix type error. id is always defined in attibutes

* declare a type

* move ts-ignore to the lines with errors

* declare tuple type explicitly

* mute type error. cannot assign unknown

* fix errors. id is always defined

* fix error type

* fix override errors. id is always defined

* fix error. extends any doesn't work anymore

* fix type error. type is always defined

* env doesn't always contain values

* fix type error

* cast to string

* add: logs is already declared in getNodeLogsUrl

* state is already  passed in props

* fix some errors in timelion

* number of fragments is always defined

* 'absolute' is not just string, but value

* TEMP: option is always defined

* always true if cast to promise manually

* both props are always defined

* explicitly define returned SO type

* workaround type

* bump tslib to be compatible with ts v3.9

* test private property

* rebuild kbn-pm

* Fix ts errors for beats management

* Fix type inference broken by the TS 3.9 upgrade

* Fix ingest manager saved object attributes typings

* Fix TS errors in cross_cluster_replication and index_management.

* Fix TS error in Watcher.

* roll back colorRange wrong type

* fix security plugin types

* TypeScript 3.9 fixes for APM

* Fix ColorRange types.

* fix actions & alerts errors. ByGidi

* fix lists error

* More APM fixes

* Remove paramaterization from `removeEmpty in agent config SettingsPage component (it's only used there and doesn't need to be parameterized.)
* Add option chain for case in registerTransactionDurationAlertType
* Cast `overallValue` in transform_metrics_chart
* Use more specific type for custom link filters
* Add more option chaining for local UI filters buckets response
* Remove unused parameters from routes
* Fix getProjection type parameter
* Use destructuring in serviceNodesLocalFiltersRoute to hide `never` error
* Revert `UnionToIntersection` change in `AggregationResponseMap`

Fixes #67804.

* fix platform type error

* Fix visualizations types.

* Fix data plugin types.

* bump TS version to 3.9.5

* Fix telemetry TS errors

* Fix dashboard code

* Adding Canvas Fixes for TS 3.9

* Fix case and security_solution types

* roll back to the old export syntax. new one might cause problems in api-extractor

* update docs

* Fix timelion code

* Fix meta

* Fix types

* fix type errors om ingest_manager

* bump babel deps

* enable private props & methods syntax

* update kbn-pm dist

* whitelist 0BSD license

* use @babel/plugin-proposal-private-methods in default set as well

* disable new babel plugins

* Revert "disable new babel plugins"

This reverts commit 04d959431d.

* cleanup security_solution types

* Fixes type error for newer TypeScript

* update docs

Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
Co-authored-by: Felix Stürmer <stuermer@weltenwort.de>
Co-authored-by: CJ Cenizal <cj@cenizal.com>
Co-authored-by: Larry Gregory <larry.gregory@elastic.co>
Co-authored-by: Nathan L Smith <smith@nlsmith.com>
Co-authored-by: Walter Rafelsberger <walter@elastic.co>
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
Co-authored-by: Tim Roes <tim.roes@elastic.co>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
Co-authored-by: FrankHassanabad <frank.hassanabad@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
Co-authored-by: Felix Stürmer <stuermer@weltenwort.de>
Co-authored-by: CJ Cenizal <cj@cenizal.com>
Co-authored-by: Larry Gregory <larry.gregory@elastic.co>
Co-authored-by: Nathan L Smith <smith@nlsmith.com>
Co-authored-by: Walter Rafelsberger <walter@elastic.co>
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
Co-authored-by: Tim Roes <tim.roes@elastic.co>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
Co-authored-by: FrankHassanabad <frank.hassanabad@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Mikhail Shustov 2020-06-11 13:25:28 +03:00 committed by GitHub
parent b2db19b14c
commit c9ac203e94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
159 changed files with 4874 additions and 3442 deletions

View file

@ -9,5 +9,5 @@ Creates multiple documents at once
<b>Signature:</b>
```typescript
bulkCreate: (objects?: SavedObjectsBulkCreateObject<unknown>[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>>;
bulkCreate: (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>>;
```

View file

@ -9,10 +9,10 @@ Returns an array of objects by id
<b>Signature:</b>
```typescript
bulkGet: (objects?: {
bulkGet: (objects?: Array<{
id: string;
type: string;
}[]) => Promise<SavedObjectsBatchResponse<unknown>>;
}>) => Promise<SavedObjectsBatchResponse<unknown>>;
```
## Example

View file

@ -9,5 +9,5 @@ Deletes an object
<b>Signature:</b>
```typescript
delete: (type: string, id: string) => Promise<{}>;
delete: (type: string, id: string) => ReturnType<SavedObjectsApi['delete']>;
```

View file

@ -9,5 +9,5 @@ Search for objects
<b>Signature:</b>
```typescript
find: <T = unknown>(options: Pick<SavedObjectFindOptionsServer, "search" | "filter" | "type" | "page" | "perPage" | "sortField" | "fields" | "searchFields" | "hasReference" | "defaultSearchOperator">) => Promise<SavedObjectsFindResponsePublic<T>>;
find: <T = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T>>;
```

View file

@ -20,11 +20,11 @@ The constructor for this class is marked as internal. Third-party code should no
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [bulkCreate](./kibana-plugin-core-public.savedobjectsclient.bulkcreate.md) | | <code>(objects?: SavedObjectsBulkCreateObject&lt;unknown&gt;[], options?: SavedObjectsBulkCreateOptions) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;</code> | Creates multiple documents at once |
| [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | <code>(objects?: {</code><br/><code> id: string;</code><br/><code> type: string;</code><br/><code> }[]) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;</code> | Returns an array of objects by id |
| [bulkCreate](./kibana-plugin-core-public.savedobjectsclient.bulkcreate.md) | | <code>(objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;</code> | Creates multiple documents at once |
| [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | <code>(objects?: Array&lt;{</code><br/><code> id: string;</code><br/><code> type: string;</code><br/><code> }&gt;) =&gt; Promise&lt;SavedObjectsBatchResponse&lt;unknown&gt;&gt;</code> | Returns an array of objects by id |
| [create](./kibana-plugin-core-public.savedobjectsclient.create.md) | | <code>&lt;T = unknown&gt;(type: string, attributes: T, options?: SavedObjectsCreateOptions) =&gt; Promise&lt;SimpleSavedObject&lt;T&gt;&gt;</code> | Persists an object |
| [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | <code>(type: string, id: string) =&gt; Promise&lt;{}&gt;</code> | Deletes an object |
| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <code>&lt;T = unknown&gt;(options: Pick&lt;SavedObjectFindOptionsServer, &quot;search&quot; &#124; &quot;filter&quot; &#124; &quot;type&quot; &#124; &quot;page&quot; &#124; &quot;perPage&quot; &#124; &quot;sortField&quot; &#124; &quot;fields&quot; &#124; &quot;searchFields&quot; &#124; &quot;hasReference&quot; &#124; &quot;defaultSearchOperator&quot;&gt;) =&gt; Promise&lt;SavedObjectsFindResponsePublic&lt;T&gt;&gt;</code> | Search for objects |
| [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | <code>(type: string, id: string) =&gt; ReturnType&lt;SavedObjectsApi['delete']&gt;</code> | Deletes an object |
| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <code>&lt;T = unknown&gt;(options: SavedObjectsFindOptions) =&gt; Promise&lt;SavedObjectsFindResponsePublic&lt;T&gt;&gt;</code> | Search for objects |
| [get](./kibana-plugin-core-public.savedobjectsclient.get.md) | | <code>&lt;T = unknown&gt;(type: string, id: string) =&gt; Promise&lt;SimpleSavedObject&lt;T&gt;&gt;</code> | Fetches a single object |
## Methods

View file

@ -11,5 +11,5 @@ Creates an href (string) to the location. If `prependBasePath` is true (default)
```typescript
createHref: (location: LocationDescriptorObject<HistoryLocationState>, { prependBasePath }?: {
prependBasePath?: boolean | undefined;
}) => string;
}) => Href;
```

View file

@ -28,7 +28,7 @@ export declare class ScopedHistory<HistoryLocationState = unknown> implements Hi
| --- | --- | --- | --- |
| [action](./kibana-plugin-core-public.scopedhistory.action.md) | | <code>Action</code> | The last action dispatched on the history stack. |
| [block](./kibana-plugin-core-public.scopedhistory.block.md) | | <code>(prompt?: string &#124; boolean &#124; History.TransitionPromptHook&lt;HistoryLocationState&gt; &#124; undefined) =&gt; UnregisterCallback</code> | Not supported. Use [AppMountParameters.onAppLeave](./kibana-plugin-core-public.appmountparameters.onappleave.md)<!-- -->. |
| [createHref](./kibana-plugin-core-public.scopedhistory.createhref.md) | | <code>(location: LocationDescriptorObject&lt;HistoryLocationState&gt;, { prependBasePath }?: {</code><br/><code> prependBasePath?: boolean &#124; undefined;</code><br/><code> }) =&gt; string</code> | Creates an href (string) to the location. If <code>prependBasePath</code> is true (default), it will prepend the location's path with the scoped history basePath. |
| [createHref](./kibana-plugin-core-public.scopedhistory.createhref.md) | | <code>(location: LocationDescriptorObject&lt;HistoryLocationState&gt;, { prependBasePath }?: {</code><br/><code> prependBasePath?: boolean &#124; undefined;</code><br/><code> }) =&gt; Href</code> | Creates an href (string) to the location. If <code>prependBasePath</code> is true (default), it will prepend the location's path with the scoped history basePath. |
| [createSubHistory](./kibana-plugin-core-public.scopedhistory.createsubhistory.md) | | <code>&lt;SubHistoryLocationState = unknown&gt;(basePath: string) =&gt; ScopedHistory&lt;SubHistoryLocationState&gt;</code> | Creates a <code>ScopedHistory</code> for a subpath of this <code>ScopedHistory</code>. Useful for applications that may have sub-apps that do not need access to the containing application's history. |
| [go](./kibana-plugin-core-public.scopedhistory.go.md) | | <code>(n: number) =&gt; void</code> | Send the user forward or backwards in the history stack. |
| [goBack](./kibana-plugin-core-public.scopedhistory.goback.md) | | <code>() =&gt; void</code> | Send the user one location back in the history stack. Equivalent to calling [ScopedHistory.go(-1)](./kibana-plugin-core-public.scopedhistory.go.md)<!-- -->. If no more entries are available backwards, this is a no-op. |
@ -36,6 +36,6 @@ export declare class ScopedHistory<HistoryLocationState = unknown> implements Hi
| [length](./kibana-plugin-core-public.scopedhistory.length.md) | | <code>number</code> | The number of entries in the history stack, including all entries forwards and backwards from the current location. |
| [listen](./kibana-plugin-core-public.scopedhistory.listen.md) | | <code>(listener: (location: Location&lt;HistoryLocationState&gt;, action: Action) =&gt; void) =&gt; UnregisterCallback</code> | Adds a listener for location updates. |
| [location](./kibana-plugin-core-public.scopedhistory.location.md) | | <code>Location&lt;HistoryLocationState&gt;</code> | The current location of the history stack. |
| [push](./kibana-plugin-core-public.scopedhistory.push.md) | | <code>(pathOrLocation: string &#124; LocationDescriptorObject&lt;HistoryLocationState&gt;, state?: HistoryLocationState &#124; undefined) =&gt; void</code> | Pushes a new location onto the history stack. If there are forward entries in the stack, they will be removed. |
| [replace](./kibana-plugin-core-public.scopedhistory.replace.md) | | <code>(pathOrLocation: string &#124; LocationDescriptorObject&lt;HistoryLocationState&gt;, state?: HistoryLocationState &#124; undefined) =&gt; void</code> | Replaces the current location in the history stack. Does not remove forward or backward entries. |
| [push](./kibana-plugin-core-public.scopedhistory.push.md) | | <code>(pathOrLocation: Path &#124; LocationDescriptorObject&lt;HistoryLocationState&gt;, state?: HistoryLocationState &#124; undefined) =&gt; void</code> | Pushes a new location onto the history stack. If there are forward entries in the stack, they will be removed. |
| [replace](./kibana-plugin-core-public.scopedhistory.replace.md) | | <code>(pathOrLocation: Path &#124; LocationDescriptorObject&lt;HistoryLocationState&gt;, state?: HistoryLocationState &#124; undefined) =&gt; void</code> | Replaces the current location in the history stack. Does not remove forward or backward entries. |

View file

@ -9,5 +9,5 @@ Pushes a new location onto the history stack. If there are forward entries in th
<b>Signature:</b>
```typescript
push: (pathOrLocation: string | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
push: (pathOrLocation: Path | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
```

View file

@ -9,5 +9,5 @@ Replaces the current location in the history stack. Does not remove forward or b
<b>Signature:</b>
```typescript
replace: (pathOrLocation: string | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
replace: (pathOrLocation: Path | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
```

View file

@ -9,5 +9,5 @@ returns `basePath` value, specific for an incoming request.
<b>Signature:</b>
```typescript
get: (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>) => string;
get: (request: KibanaRequest | LegacyRequest) => string;
```

View file

@ -20,9 +20,9 @@ The constructor for this class is marked as internal. Third-party code should no
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [get](./kibana-plugin-core-server.basepath.get.md) | | <code>(request: LegacyRequest &#124; KibanaRequest&lt;unknown, unknown, unknown, any&gt;) =&gt; string</code> | returns <code>basePath</code> value, specific for an incoming request. |
| [get](./kibana-plugin-core-server.basepath.get.md) | | <code>(request: KibanaRequest &#124; LegacyRequest) =&gt; string</code> | returns <code>basePath</code> value, specific for an incoming request. |
| [prepend](./kibana-plugin-core-server.basepath.prepend.md) | | <code>(path: string) =&gt; string</code> | Prepends <code>path</code> with the basePath. |
| [remove](./kibana-plugin-core-server.basepath.remove.md) | | <code>(path: string) =&gt; string</code> | Removes the prepended basePath from the <code>path</code>. |
| [serverBasePath](./kibana-plugin-core-server.basepath.serverbasepath.md) | | <code>string</code> | returns the server's basePath<!-- -->See [BasePath.get](./kibana-plugin-core-server.basepath.get.md) for getting the basePath value for a specific request |
| [set](./kibana-plugin-core-server.basepath.set.md) | | <code>(request: LegacyRequest &#124; KibanaRequest&lt;unknown, unknown, unknown, any&gt;, requestSpecificBasePath: string) =&gt; void</code> | sets <code>basePath</code> value, specific for an incoming request. |
| [set](./kibana-plugin-core-server.basepath.set.md) | | <code>(request: KibanaRequest &#124; LegacyRequest, requestSpecificBasePath: string) =&gt; void</code> | sets <code>basePath</code> value, specific for an incoming request. |

View file

@ -9,5 +9,5 @@ sets `basePath` value, specific for an incoming request.
<b>Signature:</b>
```typescript
set: (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>, requestSpecificBasePath: string) => void;
set: (request: KibanaRequest | LegacyRequest, requestSpecificBasePath: string) => void;
```

View file

@ -8,8 +8,8 @@
```typescript
AggGroupLabels: {
[AggGroupNames.Buckets]: string;
[AggGroupNames.Metrics]: string;
[AggGroupNames.None]: string;
buckets: string;
metrics: string;
none: string;
}
```

View file

@ -9,5 +9,5 @@ Get the KbnFieldType name for an esType string
<b>Signature:</b>
```typescript
castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES
castEsToKbnFieldTypeName: (esType: ES_FIELD_TYPES | string) => KBN_FIELD_TYPES
```

View file

@ -9,24 +9,9 @@ Helper to setup two-way syncing of global data and a state container
<b>Signature:</b>
```typescript
connectToQueryState: <S extends QueryState>({ timefilter: { timefilter }, filterManager, state$, }: Pick<{
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: QueryStateChange;
state: QueryState;
}>;
savedQueries: import("..").SavedQueryService;
} | {
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: QueryStateChange;
state: QueryState;
}>;
}, "state$" | "timefilter" | "filterManager">, stateContainer: BaseStateContainer<S>, syncConfig: {
time?: boolean | undefined;
refreshInterval?: boolean | undefined;
filters?: boolean | FilterStateStore | undefined;
connectToQueryState: <S extends QueryState>({ timefilter: { timefilter }, filterManager, state$, }: Pick<QueryStart | QuerySetup, 'timefilter' | 'filterManager' | 'state$'>, stateContainer: BaseStateContainer<S>, syncConfig: {
time?: boolean;
refreshInterval?: boolean;
filters?: FilterStateStore | boolean;
}) => () => void
```

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
createSavedQueryService: (savedObjectsClient: Pick<import("../../../../../core/public").SavedObjectsClient, "update" | "find" | "get" | "delete" | "create" | "bulkCreate" | "bulkGet" | "bulkUpdate">) => SavedQueryService
createSavedQueryService: (savedObjectsClient: SavedObjectsClientContract) => SavedQueryService
```

View file

@ -8,6 +8,6 @@
```typescript
extractReferences: (state: SearchSourceFields) => [SearchSourceFields & {
indexRefName?: string | undefined;
indexRefName?: string;
}, SavedObjectReference[]]
```

View file

@ -9,22 +9,7 @@ Helper to setup syncing of global data with the URL
<b>Signature:</b>
```typescript
syncQueryStateWithUrl: (query: Pick<{
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: import("./types").QueryStateChange;
state: QueryState;
}>;
savedQueries: import("..").SavedQueryService;
} | {
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: import("./types").QueryStateChange;
state: QueryState;
}>;
}, "state$" | "timefilter" | "filterManager">, kbnUrlStateStorage: IKbnUrlStateStorage) => {
syncQueryStateWithUrl: (query: Pick<QueryStart | QuerySetup, 'filterManager' | 'timefilter' | 'state$'>, kbnUrlStateStorage: IKbnUrlStateStorage) => {
stop: () => void;
hasInheritedQueryFromUrl: boolean;
}

View file

@ -9,5 +9,5 @@ Get the KbnFieldType name for an esType string
<b>Signature:</b>
```typescript
castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES
castEsToKbnFieldTypeName: (esType: ES_FIELD_TYPES | string) => KBN_FIELD_TYPES
```

View file

@ -78,13 +78,13 @@
},
"resolutions": {
"**/@types/node": ">=10.17.17 <10.20.0",
"**/@types/react": "^16.9.19",
"**/@types/react": "^16.9.36",
"**/@types/react-router": "^5.1.3",
"**/@types/hapi": "^17.0.18",
"**/@types/angular": "^1.6.56",
"**/@types/hoist-non-react-statics": "^3.3.1",
"**/@types/chai": "^4.2.11",
"**/typescript": "3.7.2",
"**/typescript": "3.9.5",
"**/graphql-toolkit/lodash": "^4.17.13",
"**/hoist-non-react-statics": "^3.3.2",
"**/isomorphic-git/**/base64-js": "^1.2.1",
@ -117,9 +117,9 @@
]
},
"dependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
"@babel/register": "^7.9.0",
"@babel/core": "^7.10.2",
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/register": "^7.10.1",
"@elastic/apm-rum": "^5.1.1",
"@elastic/charts": "19.2.0",
"@elastic/datemath": "5.0.2",
@ -269,7 +269,7 @@
"tinygradient": "0.4.3",
"tinymath": "1.2.1",
"topojson-client": "3.0.0",
"tslib": "^1.9.3",
"tslib": "^2.0.0",
"type-detect": "^4.0.8",
"ui-select": "0.19.8",
"url-loader": "2.2.0",
@ -287,8 +287,8 @@
"yauzl": "2.10.0"
},
"devDependencies": {
"@babel/parser": "^7.9.3",
"@babel/types": "^7.9.0",
"@babel/parser": "^7.10.2",
"@babel/types": "^7.10.2",
"@elastic/elasticsearch": "^7.4.0",
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/eslint-plugin-eui": "0.0.2",
@ -366,8 +366,8 @@
"@types/podium": "^1.0.0",
"@types/prop-types": "^15.5.3",
"@types/reach__router": "^1.2.6",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@types/react": "^16.9.36",
"@types/react-dom": "^16.9.8",
"@types/react-grid-layout": "^0.16.7",
"@types/react-redux": "^7.1.7",
"@types/react-resize-detector": "^4.0.1",
@ -390,8 +390,8 @@
"@types/uuid": "^3.4.4",
"@types/vinyl-fs": "^2.4.11",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"angular-mocks": "^1.7.9",
"archiver": "^3.1.1",
"axe-core": "^3.4.1",
@ -490,7 +490,7 @@
"supertest-as-promised": "^4.0.2",
"tape": "^4.13.0",
"tree-kill": "^1.2.2",
"typescript": "3.7.2",
"typescript": "3.9.5",
"typings-tester": "^0.3.2",
"vinyl-fs": "^3.0.3",
"xml2js": "^0.4.22",
@ -501,4 +501,4 @@
"node": "10.21.0",
"yarn": "^1.21.1"
}
}
}

View file

@ -11,13 +11,13 @@
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/preset-env": "^7.9.0",
"@babel/cli": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"babel-plugin-add-module-exports": "^1.0.2",
"moment": "^2.24.0"
},
"dependencies": {
"tslib": "^1.9.3"
"tslib": "^2.0.0"
},
"peerDependencies": {
"moment": "^2.24.0"

View file

@ -15,8 +15,8 @@
},
"homepage": "https://github.com/elastic/eslint-config-kibana#readme",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",

View file

@ -14,9 +14,9 @@
"kbn:watch": "node scripts/build --source-maps --watch"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/cli": "^7.10.1",
"@kbn/dev-utils": "1.0.0",
"@kbn/babel-preset": "1.0.0",
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -15,12 +15,12 @@
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"@babel/cli": "^7.8.4"
"@babel/cli": "^7.10.1"
},
"dependencies": {
"@kbn/babel-preset": "1.0.0",
"@babel/parser": "^7.9.3",
"@babel/traverse": "^7.9.0",
"@babel/parser": "^7.10.2",
"@babel/traverse": "^7.10.1",
"lodash": "^4.17.15"
}
}

View file

@ -24,6 +24,8 @@ module.exports = {
plugins: [
'asyncGenerators',
'classProperties',
'classPrivateProperties',
'classPrivateMethods',
'dynamicImport',
'exportDefaultFrom',
'exportNamespaceFrom',

View file

@ -34,6 +34,14 @@ const plugins = [
// Nullish coalescing proposal is stage 3 (https://github.com/tc39/proposal-nullish-coalescing)
// Need this since we are using TypeScript 3.7+
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
// Proposal is on stage 4 (https://github.com/tc39/proposal-export-ns-from)
// Need this since we are using TypeScript 3.8+
require.resolve('@babel/plugin-proposal-export-namespace-from'),
// Proposal is on stage 4 (https://github.com/tc39/proposal-export-ns-from)
// Need this since we are using TypeScript 3.9+
require.resolve('@babel/plugin-proposal-private-methods'),
];
module.exports = {

View file

@ -4,12 +4,14 @@
"version": "1.0.0",
"license": "Apache-2.0",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.1",
"@babel/preset-typescript": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-export-namespace-from": "^7.10.1",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1",
"@babel/plugin-proposal-optional-chaining": "^7.10.1",
"@babel/plugin-proposal-private-methods": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@babel/preset-react": "^7.10.1",
"@babel/preset-typescript": "^7.10.1",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-filter-imports": "^3.0.0",
"babel-plugin-styled-components": "^1.10.7",

View file

@ -10,7 +10,7 @@
"kbn:bootstrap": "yarn build"
},
"devDependencies": {
"typescript": "3.7.2",
"typescript": "3.9.5",
"tsd": "^0.7.4"
},
"peerDependencies": {

View file

@ -20,10 +20,10 @@
"moment": "^2.24.0",
"rxjs": "^6.5.3",
"tree-kill": "^1.2.2",
"tslib": "^1.9.3"
"tslib": "^2.0.0"
},
"devDependencies": {
"typescript": "3.7.2",
"typescript": "3.9.5",
"@kbn/expect": "1.0.0",
"chance": "1.0.18"
}

View file

@ -12,8 +12,8 @@
"kbn:watch": "node scripts/build --watch --source-maps"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
@ -21,7 +21,7 @@
"del": "^5.1.0",
"getopts": "^2.2.4",
"supports-color": "^6.1.0",
"typescript": "3.7.2"
"typescript": "3.9.5"
},
"dependencies": {
"intl-format-cache": "^2.1.0",

View file

@ -9,17 +9,17 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@babel/runtime": "^7.9.2",
"@babel/runtime": "^7.10.2",
"@kbn/i18n": "1.0.0",
"lodash": "npm:@elastic/lodash@3.10.1-kibana4",
"lodash.clone": "^4.5.0",
"uuid": "3.3.2"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.1",
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"babel-loader": "^8.0.6",

View file

@ -20,7 +20,7 @@
"del": "^5.1.0",
"raw-loader": "3.1.0",
"supports-color": "^7.0.0",
"typescript": "3.7.2",
"typescript": "3.9.5",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
}

View file

@ -10,7 +10,7 @@
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@babel/cli": "^7.8.4",
"@babel/cli": "^7.10.1",
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/ui-shared-deps": "1.0.0",
@ -49,4 +49,4 @@
"webpack": "^4.41.5",
"webpack-merge": "^4.2.2"
}
}
}

View file

@ -12,7 +12,7 @@
"plugin-helpers": "bin/plugin-helpers.js"
},
"dependencies": {
"@babel/core": "^7.9.0",
"@babel/core": "^7.10.2",
"argv-split": "^2.0.1",
"commander": "^2.9.0",
"del": "^5.1.0",
@ -37,7 +37,7 @@
"@types/through2": "^2.0.35",
"@types/through2-map": "^3.0.0",
"@types/vinyl": "^2.0.4",
"typescript": "3.7.2"
"typescript": "3.9.5"
},
"peerDependencies": {
"@kbn/babel-preset": "1.0.0"

File diff suppressed because one or more lines are too long

View file

@ -10,11 +10,11 @@
"prettier": "prettier --write './src/**/*.ts'"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-typescript": "^7.9.0",
"@babel/core": "^7.10.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@babel/preset-typescript": "^7.10.1",
"@types/cmd-shim": "^2.0.0",
"@types/cpy": "^5.1.0",
"@types/dedent": "^0.7.0",
@ -59,13 +59,13 @@
"strip-ansi": "^4.0.0",
"strong-log-transformer": "^2.1.0",
"tempy": "^0.3.0",
"typescript": "3.7.2",
"typescript": "3.9.5",
"unlazy-loader": "^0.1.3",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"write-pkg": "^4.0.0"
},
"dependencies": {
"tslib": "^1.9.3"
"tslib": "^2.0.0"
}
}

View file

@ -10,7 +10,7 @@
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/cli": "^7.10.1",
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@types/parse-link-header": "^1.0.0",

View file

@ -30,7 +30,7 @@
"enzyme-adapter-react-16": "^1.9.1"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/core": "^7.10.2",
"@elastic/eui": "0.0.55",
"@kbn/babel-preset": "1.0.0",
"autoprefixer": "^9.7.4",

View file

@ -5,24 +5,146 @@
```ts
import { Action } from 'history';
import Boom from 'boom';
import { Breadcrumb } from '@elastic/eui';
import { BulkIndexDocumentsParams } from 'elasticsearch';
import { CatAliasesParams } from 'elasticsearch';
import { CatAllocationParams } from 'elasticsearch';
import { CatCommonParams } from 'elasticsearch';
import { CatFielddataParams } from 'elasticsearch';
import { CatHealthParams } from 'elasticsearch';
import { CatHelpParams } from 'elasticsearch';
import { CatIndicesParams } from 'elasticsearch';
import { CatRecoveryParams } from 'elasticsearch';
import { CatSegmentsParams } from 'elasticsearch';
import { CatShardsParams } from 'elasticsearch';
import { CatSnapshotsParams } from 'elasticsearch';
import { CatTasksParams } from 'elasticsearch';
import { CatThreadPoolParams } from 'elasticsearch';
import { ClearScrollParams } from 'elasticsearch';
import { Client } from 'elasticsearch';
import { ClusterAllocationExplainParams } from 'elasticsearch';
import { ClusterGetSettingsParams } from 'elasticsearch';
import { ClusterHealthParams } from 'elasticsearch';
import { ClusterPendingTasksParams } from 'elasticsearch';
import { ClusterPutSettingsParams } from 'elasticsearch';
import { ClusterRerouteParams } from 'elasticsearch';
import { ClusterStateParams } from 'elasticsearch';
import { ClusterStatsParams } from 'elasticsearch';
import { CountParams } from 'elasticsearch';
import { CreateDocumentParams } from 'elasticsearch';
import { DeleteDocumentByQueryParams } from 'elasticsearch';
import { DeleteDocumentParams } from 'elasticsearch';
import { DeleteScriptParams } from 'elasticsearch';
import { DeleteTemplateParams } from 'elasticsearch';
import { EuiButtonEmptyProps } from '@elastic/eui';
import { EuiConfirmModalProps } from '@elastic/eui';
import { EuiGlobalToastListToast } from '@elastic/eui';
import { ExclusiveUnion } from '@elastic/eui';
import { ExistsParams } from 'elasticsearch';
import { ExplainParams } from 'elasticsearch';
import { FieldStatsParams } from 'elasticsearch';
import { GenericParams } from 'elasticsearch';
import { GetParams } from 'elasticsearch';
import { GetResponse } from 'elasticsearch';
import { GetScriptParams } from 'elasticsearch';
import { GetSourceParams } from 'elasticsearch';
import { GetTemplateParams } from 'elasticsearch';
import { History } from 'history';
import { Href } from 'history';
import { IconType } from '@elastic/eui';
import { IndexDocumentParams } from 'elasticsearch';
import { IndicesAnalyzeParams } from 'elasticsearch';
import { IndicesClearCacheParams } from 'elasticsearch';
import { IndicesCloseParams } from 'elasticsearch';
import { IndicesCreateParams } from 'elasticsearch';
import { IndicesDeleteAliasParams } from 'elasticsearch';
import { IndicesDeleteParams } from 'elasticsearch';
import { IndicesDeleteTemplateParams } from 'elasticsearch';
import { IndicesExistsAliasParams } from 'elasticsearch';
import { IndicesExistsParams } from 'elasticsearch';
import { IndicesExistsTemplateParams } from 'elasticsearch';
import { IndicesExistsTypeParams } from 'elasticsearch';
import { IndicesFlushParams } from 'elasticsearch';
import { IndicesFlushSyncedParams } from 'elasticsearch';
import { IndicesForcemergeParams } from 'elasticsearch';
import { IndicesGetAliasParams } from 'elasticsearch';
import { IndicesGetFieldMappingParams } from 'elasticsearch';
import { IndicesGetMappingParams } from 'elasticsearch';
import { IndicesGetParams } from 'elasticsearch';
import { IndicesGetSettingsParams } from 'elasticsearch';
import { IndicesGetTemplateParams } from 'elasticsearch';
import { IndicesGetUpgradeParams } from 'elasticsearch';
import { IndicesOpenParams } from 'elasticsearch';
import { IndicesPutAliasParams } from 'elasticsearch';
import { IndicesPutMappingParams } from 'elasticsearch';
import { IndicesPutSettingsParams } from 'elasticsearch';
import { IndicesPutTemplateParams } from 'elasticsearch';
import { IndicesRecoveryParams } from 'elasticsearch';
import { IndicesRefreshParams } from 'elasticsearch';
import { IndicesRolloverParams } from 'elasticsearch';
import { IndicesSegmentsParams } from 'elasticsearch';
import { IndicesShardStoresParams } from 'elasticsearch';
import { IndicesShrinkParams } from 'elasticsearch';
import { IndicesStatsParams } from 'elasticsearch';
import { IndicesUpdateAliasesParams } from 'elasticsearch';
import { IndicesUpgradeParams } from 'elasticsearch';
import { IndicesValidateQueryParams } from 'elasticsearch';
import { InfoParams } from 'elasticsearch';
import { IngestDeletePipelineParams } from 'elasticsearch';
import { IngestGetPipelineParams } from 'elasticsearch';
import { IngestPutPipelineParams } from 'elasticsearch';
import { IngestSimulateParams } from 'elasticsearch';
import { KibanaConfigType } from 'src/core/server/kibana_config';
import { Location } from 'history';
import { LocationDescriptorObject } from 'history';
import { MaybePromise } from '@kbn/utility-types';
import { MGetParams } from 'elasticsearch';
import { MGetResponse } from 'elasticsearch';
import { MSearchParams } from 'elasticsearch';
import { MSearchResponse } from 'elasticsearch';
import { MSearchTemplateParams } from 'elasticsearch';
import { MTermVectorsParams } from 'elasticsearch';
import { NodesHotThreadsParams } from 'elasticsearch';
import { NodesInfoParams } from 'elasticsearch';
import { NodesStatsParams } from 'elasticsearch';
import { Observable } from 'rxjs';
import { ParsedQuery } from 'query-string';
import { Path } from 'history';
import { PingParams } from 'elasticsearch';
import { PublicUiSettingsParams as PublicUiSettingsParams_2 } from 'src/core/server/types';
import { PutScriptParams } from 'elasticsearch';
import { PutTemplateParams } from 'elasticsearch';
import React from 'react';
import { ReindexParams } from 'elasticsearch';
import { ReindexRethrottleParams } from 'elasticsearch';
import { RenderSearchTemplateParams } from 'elasticsearch';
import * as Rx from 'rxjs';
import { ScrollParams } from 'elasticsearch';
import { SearchParams } from 'elasticsearch';
import { SearchResponse } from 'elasticsearch';
import { SearchShardsParams } from 'elasticsearch';
import { SearchTemplateParams } from 'elasticsearch';
import { ShallowPromise } from '@kbn/utility-types';
import { SnapshotCreateParams } from 'elasticsearch';
import { SnapshotCreateRepositoryParams } from 'elasticsearch';
import { SnapshotDeleteParams } from 'elasticsearch';
import { SnapshotDeleteRepositoryParams } from 'elasticsearch';
import { SnapshotGetParams } from 'elasticsearch';
import { SnapshotGetRepositoryParams } from 'elasticsearch';
import { SnapshotRestoreParams } from 'elasticsearch';
import { SnapshotStatusParams } from 'elasticsearch';
import { SnapshotVerifyRepositoryParams } from 'elasticsearch';
import { SuggestParams } from 'elasticsearch';
import { TasksCancelParams } from 'elasticsearch';
import { TasksGetParams } from 'elasticsearch';
import { TasksListParams } from 'elasticsearch';
import { TermvectorsParams } from 'elasticsearch';
import { Type } from '@kbn/config-schema';
import { TypeOf } from '@kbn/config-schema';
import { UnregisterCallback } from 'history';
import { UpdateDocumentByQueryParams } from 'elasticsearch';
import { UpdateDocumentParams } from 'elasticsearch';
import { UserProvidedValues as UserProvidedValues_2 } from 'src/core/server/types';
// @internal (undocumented)
@ -1118,15 +1240,17 @@ export interface SavedObjectsBulkUpdateOptions {
export class SavedObjectsClient {
// @internal
constructor(http: HttpSetup);
bulkCreate: (objects?: SavedObjectsBulkCreateObject<unknown>[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>>;
bulkGet: (objects?: {
bulkCreate: (objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>>;
bulkGet: (objects?: Array<{
id: string;
type: string;
}[]) => Promise<SavedObjectsBatchResponse<unknown>>;
}>) => Promise<SavedObjectsBatchResponse<unknown>>;
bulkUpdate<T = unknown>(objects?: SavedObjectsBulkUpdateObject[]): Promise<SavedObjectsBatchResponse<unknown>>;
create: <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>>;
delete: (type: string, id: string) => Promise<{}>;
find: <T = unknown>(options: Pick<SavedObjectsFindOptions, "search" | "filter" | "type" | "page" | "perPage" | "sortField" | "fields" | "searchFields" | "hasReference" | "defaultSearchOperator">) => Promise<SavedObjectsFindResponsePublic<T>>;
// Warning: (ae-forgotten-export) The symbol "SavedObjectsClientContract" needs to be exported by the entry point index.d.ts
delete: (type: string, id: string) => ReturnType<SavedObjectsClientContract_2['delete']>;
// Warning: (ae-forgotten-export) The symbol "SavedObjectsFindOptions" needs to be exported by the entry point index.d.ts
find: <T = unknown>(options: SavedObjectsFindOptions_2) => Promise<SavedObjectsFindResponsePublic<T>>;
get: <T = unknown>(type: string, id: string) => Promise<SimpleSavedObject<T>>;
update<T = unknown>(type: string, id: string, attributes: T, { version, migrationVersion, references }?: SavedObjectsUpdateOptions): Promise<SimpleSavedObject<T>>;
}
@ -1283,7 +1407,7 @@ export class ScopedHistory<HistoryLocationState = unknown> implements History<Hi
block: (prompt?: string | boolean | History.TransitionPromptHook<HistoryLocationState> | undefined) => UnregisterCallback;
createHref: (location: LocationDescriptorObject<HistoryLocationState>, { prependBasePath }?: {
prependBasePath?: boolean | undefined;
}) => string;
}) => Href;
createSubHistory: <SubHistoryLocationState = unknown>(basePath: string) => ScopedHistory<SubHistoryLocationState>;
go: (n: number) => void;
goBack: () => void;
@ -1291,8 +1415,8 @@ export class ScopedHistory<HistoryLocationState = unknown> implements History<Hi
get length(): number;
listen: (listener: (location: Location<HistoryLocationState>, action: Action) => void) => UnregisterCallback;
get location(): Location<HistoryLocationState>;
push: (pathOrLocation: string | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
replace: (pathOrLocation: string | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
push: (pathOrLocation: Path | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
replace: (pathOrLocation: Path | LocationDescriptorObject<HistoryLocationState>, state?: HistoryLocationState | undefined) => void;
}
// @public

View file

@ -17,14 +17,7 @@
* under the License.
*/
import {
ValidationError,
Type,
schema,
ObjectType,
TypeOf,
isConfigSchema,
} from '@kbn/config-schema';
import { ValidationError, ObjectType, Type, schema, isConfigSchema } from '@kbn/config-schema';
import { Stream } from 'stream';
import { RouteValidationError } from './validator_error';
@ -92,7 +85,7 @@ type RouteValidationResultType<T extends RouteValidationSpec<any> | undefined> =
T extends RouteValidationFunction<any>
? ReturnType<T>['value']
: T extends Type<any>
? TypeOf<T>
? T['type']
: undefined
>;

View file

@ -480,11 +480,11 @@ export interface AuthToolkit {
export class BasePath {
// @internal
constructor(serverBasePath?: string);
get: (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>) => string;
get: (request: KibanaRequest | LegacyRequest) => string;
prepend: (path: string) => string;
remove: (path: string) => string;
readonly serverBasePath: string;
set: (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>, requestSpecificBasePath: string) => void;
set: (request: KibanaRequest | LegacyRequest, requestSpecificBasePath: string) => void;
}
// Warning: (ae-forgotten-export) The symbol "BootstrapArgs" needs to be exported by the entry point index.d.ts

View file

@ -76,7 +76,7 @@ export class Server {
private readonly status: StatusService;
private readonly coreApp: CoreApp;
private pluginsInitialized?: boolean;
#pluginsInitialized?: boolean;
private coreStart?: InternalCoreStart;
constructor(
@ -179,7 +179,7 @@ export class Server {
};
const pluginsSetup = await this.plugins.setup(coreSetup);
this.pluginsInitialized = pluginsSetup.initialized;
this.#pluginsInitialized = pluginsSetup.initialized;
await this.legacy.setup({
core: { ...coreSetup, plugins: pluginsSetup, rendering: renderingSetup },
@ -198,7 +198,7 @@ export class Server {
const elasticsearchStart = await this.elasticsearch.start();
const savedObjectsStart = await this.savedObjects.start({
elasticsearch: elasticsearchStart,
pluginsInitialized: this.pluginsInitialized,
pluginsInitialized: this.#pluginsInitialized,
});
const capabilitiesStart = this.capabilities.start();
const uiSettingsStart = await this.uiSettings.start();

View file

@ -72,10 +72,13 @@ export function* extractCodeMessages(buffer, reporter) {
'typescript',
'objectRestSpread',
'classProperties',
'classPrivateProperties',
'classPrivateMethods',
'asyncGenerators',
'dynamicImport',
'nullishCoalescingOperator',
'optionalChaining',
'exportNamespaceFrom',
],
});
} catch (error) {

View file

@ -21,6 +21,7 @@
// used as dependencies or dev dependencies
export const LICENSE_WHITELIST = [
'Elastic-License',
'0BSD',
'(BSD-2-Clause OR MIT OR Apache-2.0)',
'(BSD-2-Clause OR MIT)',
'(BSD-3-Clause AND Apache-2.0)',

View file

@ -57,7 +57,6 @@ export const globals = (specService: SpecDefinitionsService) => {
fields: {
'{field}': {
fragment_size: 20,
number_of_fragments: 3,
...highlightOptions,
},
},

View file

@ -105,11 +105,6 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
) {
super(
{
panels: {},
isEmbeddedExternally: false,
isFullScreenMode: false,
filters: [],
useMargins: true,
...initialInput,
},
{ embeddableLoaded: {} },

View file

@ -39,7 +39,7 @@ import {
* Once we hit a major version, we can remove support for older style URLs and get rid of this logic.
*/
export function migrateAppState(
appState: { [key: string]: unknown } & DashboardAppState,
appState: { [key: string]: any } & DashboardAppState,
kibanaVersion: string,
usageCollection?: UsageCollectionSetup
): DashboardAppState {

View file

@ -58,8 +58,6 @@ export function getSampleDashboardPanel<TEmbeddableInput extends EmbeddableInput
y: 0,
i: overrides.explicitInput.id,
},
type: overrides.type,
explicitInput: overrides.explicitInput,
...overrides,
};
}

View file

@ -22,9 +22,7 @@ import { fields } from '../../../index_patterns/mocks';
import { nodeTypes } from './index';
import { IIndexPattern } from '../../../index_patterns';
// @ts-ignore
import { buildNode, buildNodeWithArgumentNodes, toElasticsearchQuery } from './function';
// @ts-ignore
import { toElasticsearchQuery as isFunctionToElasticsearchQuery } from '../functions/is';
describe('kuery node types', () => {

View file

@ -18,7 +18,7 @@
*/
import _ from 'lodash';
// @ts-ignore
import { functions } from '../functions';
import { IIndexPattern, KueryNode } from '../../..';
import { FunctionName, FunctionTypeBuildNode } from './types';
@ -30,7 +30,7 @@ export function buildNode(functionName: FunctionName, ...args: any[]) {
}
return {
type: 'function',
type: 'function' as 'function',
function: functionName,
// This requires better typing of the different typings and their return types.
// @ts-ignore

View file

@ -9,11 +9,42 @@ import _ from 'lodash';
import { Action } from 'history';
import { ApplicationStart } from 'kibana/public';
import { Assign } from '@kbn/utility-types';
import Boom from 'boom';
import { Breadcrumb } from '@elastic/eui';
import { BulkIndexDocumentsParams } from 'elasticsearch';
import { CatAliasesParams } from 'elasticsearch';
import { CatAllocationParams } from 'elasticsearch';
import { CatCommonParams } from 'elasticsearch';
import { CatFielddataParams } from 'elasticsearch';
import { CatHealthParams } from 'elasticsearch';
import { CatHelpParams } from 'elasticsearch';
import { CatIndicesParams } from 'elasticsearch';
import { CatRecoveryParams } from 'elasticsearch';
import { CatSegmentsParams } from 'elasticsearch';
import { CatShardsParams } from 'elasticsearch';
import { CatSnapshotsParams } from 'elasticsearch';
import { CatTasksParams } from 'elasticsearch';
import { CatThreadPoolParams } from 'elasticsearch';
import { ClearScrollParams } from 'elasticsearch';
import { Client } from 'elasticsearch';
import { ClusterAllocationExplainParams } from 'elasticsearch';
import { ClusterGetSettingsParams } from 'elasticsearch';
import { ClusterHealthParams } from 'elasticsearch';
import { ClusterPendingTasksParams } from 'elasticsearch';
import { ClusterPutSettingsParams } from 'elasticsearch';
import { ClusterRerouteParams } from 'elasticsearch';
import { ClusterStateParams } from 'elasticsearch';
import { ClusterStatsParams } from 'elasticsearch';
import { Component } from 'react';
import { CoreSetup } from 'src/core/public';
import { CoreStart } from 'kibana/public';
import { CoreStart as CoreStart_2 } from 'src/core/public';
import { CountParams } from 'elasticsearch';
import { CreateDocumentParams } from 'elasticsearch';
import { DeleteDocumentByQueryParams } from 'elasticsearch';
import { DeleteDocumentParams } from 'elasticsearch';
import { DeleteScriptParams } from 'elasticsearch';
import { DeleteTemplateParams } from 'elasticsearch';
import { Ensure } from '@kbn/utility-types';
import { EuiButtonEmptyProps } from '@elastic/eui';
import { EuiComboBoxProps } from '@elastic/eui';
@ -21,37 +52,123 @@ import { EuiConfirmModalProps } from '@elastic/eui';
import { EuiFieldText } from '@elastic/eui';
import { EuiGlobalToastListToast } from '@elastic/eui';
import { ExclusiveUnion } from '@elastic/eui';
import { ExistsParams } from 'elasticsearch';
import { ExplainParams } from 'elasticsearch';
import { ExpressionAstFunction } from 'src/plugins/expressions/public';
import { ExpressionsSetup } from 'src/plugins/expressions/public';
import { FieldStatsParams } from 'elasticsearch';
import { GenericParams } from 'elasticsearch';
import { GetParams } from 'elasticsearch';
import { GetResponse } from 'elasticsearch';
import { GetScriptParams } from 'elasticsearch';
import { GetSourceParams } from 'elasticsearch';
import { GetTemplateParams } from 'elasticsearch';
import { History } from 'history';
import { Href } from 'history';
import { HttpSetup } from 'src/core/public';
import { HttpStart } from 'src/core/public';
import { IconType } from '@elastic/eui';
import { IndexDocumentParams } from 'elasticsearch';
import { IndicesAnalyzeParams } from 'elasticsearch';
import { IndicesClearCacheParams } from 'elasticsearch';
import { IndicesCloseParams } from 'elasticsearch';
import { IndicesCreateParams } from 'elasticsearch';
import { IndicesDeleteAliasParams } from 'elasticsearch';
import { IndicesDeleteParams } from 'elasticsearch';
import { IndicesDeleteTemplateParams } from 'elasticsearch';
import { IndicesExistsAliasParams } from 'elasticsearch';
import { IndicesExistsParams } from 'elasticsearch';
import { IndicesExistsTemplateParams } from 'elasticsearch';
import { IndicesExistsTypeParams } from 'elasticsearch';
import { IndicesFlushParams } from 'elasticsearch';
import { IndicesFlushSyncedParams } from 'elasticsearch';
import { IndicesForcemergeParams } from 'elasticsearch';
import { IndicesGetAliasParams } from 'elasticsearch';
import { IndicesGetFieldMappingParams } from 'elasticsearch';
import { IndicesGetMappingParams } from 'elasticsearch';
import { IndicesGetParams } from 'elasticsearch';
import { IndicesGetSettingsParams } from 'elasticsearch';
import { IndicesGetTemplateParams } from 'elasticsearch';
import { IndicesGetUpgradeParams } from 'elasticsearch';
import { IndicesOpenParams } from 'elasticsearch';
import { IndicesPutAliasParams } from 'elasticsearch';
import { IndicesPutMappingParams } from 'elasticsearch';
import { IndicesPutSettingsParams } from 'elasticsearch';
import { IndicesPutTemplateParams } from 'elasticsearch';
import { IndicesRecoveryParams } from 'elasticsearch';
import { IndicesRefreshParams } from 'elasticsearch';
import { IndicesRolloverParams } from 'elasticsearch';
import { IndicesSegmentsParams } from 'elasticsearch';
import { IndicesShardStoresParams } from 'elasticsearch';
import { IndicesShrinkParams } from 'elasticsearch';
import { IndicesStatsParams } from 'elasticsearch';
import { IndicesUpdateAliasesParams } from 'elasticsearch';
import { IndicesUpgradeParams } from 'elasticsearch';
import { IndicesValidateQueryParams } from 'elasticsearch';
import { InfoParams } from 'elasticsearch';
import { IngestDeletePipelineParams } from 'elasticsearch';
import { IngestGetPipelineParams } from 'elasticsearch';
import { IngestPutPipelineParams } from 'elasticsearch';
import { IngestSimulateParams } from 'elasticsearch';
import { InjectedIntl } from '@kbn/i18n/react';
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
import { IUiSettingsClient } from 'src/core/public';
import { IUiSettingsClient as IUiSettingsClient_3 } from 'kibana/public';
import { KibanaConfigType } from 'src/core/server/kibana_config';
import { Location } from 'history';
import { LocationDescriptorObject } from 'history';
import { MaybePromise } from '@kbn/utility-types';
import { MGetParams } from 'elasticsearch';
import { MGetResponse } from 'elasticsearch';
import { Moment } from 'moment';
import moment from 'moment';
import { MSearchParams } from 'elasticsearch';
import { MSearchResponse } from 'elasticsearch';
import { MSearchTemplateParams } from 'elasticsearch';
import { MTermVectorsParams } from 'elasticsearch';
import { NameList } from 'elasticsearch';
import { NodesHotThreadsParams } from 'elasticsearch';
import { NodesInfoParams } from 'elasticsearch';
import { NodesStatsParams } from 'elasticsearch';
import { Observable } from 'rxjs';
import { Path } from 'history';
import { PingParams } from 'elasticsearch';
import { Plugin as Plugin_2 } from 'src/core/public';
import { PluginInitializerContext as PluginInitializerContext_2 } from 'src/core/public';
import { PopoverAnchorPosition } from '@elastic/eui';
import { PublicUiSettingsParams } from 'src/core/server/types';
import { PutScriptParams } from 'elasticsearch';
import { PutTemplateParams } from 'elasticsearch';
import React from 'react';
import * as React_2 from 'react';
import { ReindexParams } from 'elasticsearch';
import { ReindexRethrottleParams } from 'elasticsearch';
import { RenderSearchTemplateParams } from 'elasticsearch';
import { Required } from '@kbn/utility-types';
import * as Rx from 'rxjs';
import { SavedObject as SavedObject_2 } from 'src/core/public';
import { SavedObjectsClientContract } from 'src/core/public';
import { ScrollParams } from 'elasticsearch';
import { SearchParams } from 'elasticsearch';
import { SearchResponse as SearchResponse_2 } from 'elasticsearch';
import { SearchShardsParams } from 'elasticsearch';
import { SearchTemplateParams } from 'elasticsearch';
import { SimpleSavedObject } from 'src/core/public';
import { SnapshotCreateParams } from 'elasticsearch';
import { SnapshotCreateRepositoryParams } from 'elasticsearch';
import { SnapshotDeleteParams } from 'elasticsearch';
import { SnapshotDeleteRepositoryParams } from 'elasticsearch';
import { SnapshotGetParams } from 'elasticsearch';
import { SnapshotGetRepositoryParams } from 'elasticsearch';
import { SnapshotRestoreParams } from 'elasticsearch';
import { SnapshotStatusParams } from 'elasticsearch';
import { SnapshotVerifyRepositoryParams } from 'elasticsearch';
import { Subscription } from 'rxjs';
import { SuggestParams } from 'elasticsearch';
import { TasksCancelParams } from 'elasticsearch';
import { TasksGetParams } from 'elasticsearch';
import { TasksListParams } from 'elasticsearch';
import { TermvectorsParams } from 'elasticsearch';
import { Toast } from 'kibana/public';
import { ToastsStart } from 'kibana/public';
import { TypeOf } from '@kbn/config-schema';
@ -59,6 +176,8 @@ import { UiActionsSetup } from 'src/plugins/ui_actions/public';
import { UiActionsStart } from 'src/plugins/ui_actions/public';
import { Unit } from '@elastic/datemath';
import { UnregisterCallback } from 'history';
import { UpdateDocumentByQueryParams } from 'elasticsearch';
import { UpdateDocumentParams } from 'elasticsearch';
import { UserProvidedValues } from 'src/core/server/types';
// Warning: (ae-forgotten-export) The symbol "AggConfigSerialized" needs to be exported by the entry point index.d.ts
@ -73,9 +192,9 @@ export type AggConfigOptions = Assign<AggConfigSerialized, {
//
// @public (undocumented)
export const AggGroupLabels: {
[AggGroupNames.Buckets]: string;
[AggGroupNames.Metrics]: string;
[AggGroupNames.None]: string;
buckets: string;
metrics: string;
none: string;
};
// Warning: (ae-missing-release-tag) "AggGroupName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@ -160,37 +279,24 @@ export enum BUCKET_TYPES {
// Warning: (ae-missing-release-tag) "castEsToKbnFieldTypeName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES;
export const castEsToKbnFieldTypeName: (esType: ES_FIELD_TYPES | string) => KBN_FIELD_TYPES;
// Warning: (ae-forgotten-export) The symbol "QueryStart" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "QuerySetup" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "BaseStateContainer" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "connectToQueryState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const connectToQueryState: <S extends QueryState>({ timefilter: { timefilter }, filterManager, state$, }: Pick<{
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: QueryStateChange;
state: QueryState;
}>;
savedQueries: import("..").SavedQueryService;
} | {
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: QueryStateChange;
state: QueryState;
}>;
}, "state$" | "timefilter" | "filterManager">, stateContainer: BaseStateContainer<S>, syncConfig: {
time?: boolean | undefined;
refreshInterval?: boolean | undefined;
filters?: boolean | FilterStateStore | undefined;
export const connectToQueryState: <S extends QueryState>({ timefilter: { timefilter }, filterManager, state$, }: Pick<QueryStart | QuerySetup, 'timefilter' | 'filterManager' | 'state$'>, stateContainer: BaseStateContainer<S>, syncConfig: {
time?: boolean;
refreshInterval?: boolean;
filters?: FilterStateStore | boolean;
}) => () => void;
// Warning: (ae-missing-release-tag) "createSavedQueryService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const createSavedQueryService: (savedObjectsClient: Pick<import("../../../../../core/public").SavedObjectsClient, "update" | "find" | "get" | "delete" | "create" | "bulkCreate" | "bulkGet" | "bulkUpdate">) => SavedQueryService;
export const createSavedQueryService: (savedObjectsClient: SavedObjectsClientContract) => SavedQueryService;
// Warning: (ae-missing-release-tag) "CustomFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@ -211,8 +317,6 @@ export interface DataPublicPluginSetup {
//
// (undocumented)
fieldFormats: FieldFormatsSetup;
// Warning: (ae-forgotten-export) The symbol "QuerySetup" needs to be exported by the entry point index.d.ts
//
// (undocumented)
query: QuerySetup;
// Warning: (ae-forgotten-export) The symbol "ISearchSetup" needs to be exported by the entry point index.d.ts
@ -240,8 +344,6 @@ export interface DataPublicPluginStart {
fieldFormats: FieldFormatsStart;
// (undocumented)
indexPatterns: IndexPatternsContract;
// Warning: (ae-forgotten-export) The symbol "QueryStart" needs to be exported by the entry point index.d.ts
//
// (undocumented)
query: QueryStart;
// Warning: (ae-forgotten-export) The symbol "ISearchStart" needs to be exported by the entry point index.d.ts
@ -426,7 +528,7 @@ export type ExistsFilter = Filter & {
//
// @public (undocumented)
export const extractSearchSourceReferences: (state: SearchSourceFields) => [SearchSourceFields & {
indexRefName?: string | undefined;
indexRefName?: string;
}, SavedObjectReference[]];
// Warning: (ae-missing-release-tag) "FetchOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@ -1731,22 +1833,7 @@ export const SYNC_SEARCH_STRATEGY = "SYNC_SEARCH_STRATEGY";
// Warning: (ae-missing-release-tag) "syncQueryStateWithUrl" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const syncQueryStateWithUrl: (query: Pick<{
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: import("./types").QueryStateChange;
state: QueryState;
}>;
savedQueries: import("..").SavedQueryService;
} | {
filterManager: import("..").FilterManager;
timefilter: import("..").TimefilterSetup;
state$: import("rxjs").Observable<{
changes: import("./types").QueryStateChange;
state: QueryState;
}>;
}, "state$" | "timefilter" | "filterManager">, kbnUrlStateStorage: IKbnUrlStateStorage) => {
export const syncQueryStateWithUrl: (query: Pick<QueryStart | QuerySetup, 'filterManager' | 'timefilter' | 'state$'>, kbnUrlStateStorage: IKbnUrlStateStorage) => {
stop: () => void;
hasInheritedQueryFromUrl: boolean;
};
@ -1893,8 +1980,7 @@ export const UI_SETTINGS: {
// src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:40:60 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:53:5 - (ae-forgotten-export) The symbol "createFiltersFromRangeSelectAction" needs to be exported by the entry point index.d.ts
// src/plugins/data/public/types.ts:61:5 - (ae-forgotten-export) The symbol "IndexPatternSelectProps" needs to be exported by the entry point index.d.ts

View file

@ -42,7 +42,7 @@ export async function fetchSoon(
* @param ms The number of milliseconds to wait
* @return Promise<any> A promise that resolves with the result of executing the function
*/
function delay(fn: Function, ms: number) {
function delay<T>(fn: (...args: any) => T, ms: number): Promise<T> {
return new Promise((resolve) => {
setTimeout(() => resolve(fn()), ms);
});
@ -75,7 +75,7 @@ async function delayedFetch(
const i = requestsToFetch.length;
requestsToFetch = [...requestsToFetch, request];
requestOptions = [...requestOptions, options];
const responses = await (fetchInProgress =
const responses: SearchResponse[] = await (fetchInProgress =
fetchInProgress ||
delay(() => {
const response = callClient(requestsToFetch, requestOptions, fetchHandlers);

View file

@ -83,4 +83,4 @@ export class PhraseSuggestorUI<T extends PhraseSuggestorProps> extends React.Com
}, 500);
}
export const PhraseSuggestor = withKibana(PhraseSuggestorUI);
export const PhraseSuggestor = withKibana(PhraseSuggestorUI as any);

View file

@ -31,12 +31,12 @@ describe('makeKQLUsageCollector', () => {
});
it('should call registerCollector', () => {
makeKQLUsageCollector(usageCollectionMock, '.kibana');
makeKQLUsageCollector(usageCollectionMock as UsageCollectionSetup, '.kibana');
expect(usageCollectionMock.registerCollector).toHaveBeenCalledTimes(1);
});
it('should call makeUsageCollector with type = kql', () => {
makeKQLUsageCollector(usageCollectionMock, '.kibana');
makeKQLUsageCollector(usageCollectionMock as UsageCollectionSetup, '.kibana');
expect(usageCollectionMock.makeUsageCollector).toHaveBeenCalledTimes(1);
expect(usageCollectionMock.makeUsageCollector.mock.calls[0][0].type).toBe('kql');
});

View file

@ -150,7 +150,7 @@ import { Url } from 'url';
// Warning: (ae-missing-release-tag) "castEsToKbnFieldTypeName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const castEsToKbnFieldTypeName: (esType: string) => KBN_FIELD_TYPES;
export const castEsToKbnFieldTypeName: (esType: ES_FIELD_TYPES | string) => KBN_FIELD_TYPES;
// Warning: (ae-forgotten-export) The symbol "PluginConfigDescriptor" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ConfigSchema" needs to be exported by the entry point index.d.ts

View file

@ -68,12 +68,7 @@ export const withEmbeddableSubscription = <
render() {
return (
<WrappedComponent
input={this.state.input}
output={this.state.output}
embeddable={this.props.embeddable}
{...this.props}
/>
<WrappedComponent input={this.state.input} output={this.state.output} {...this.props} />
);
}
};

View file

@ -53,7 +53,6 @@ export const SelectField = ({ field, euiFieldProps, ...rest }: Props) => {
onChange={(e) => {
field.setValue(e.target.value);
}}
options={[]}
hasNoInitialSelection={true}
isInvalid={isInvalid}
data-test-subj="select"

View file

@ -320,7 +320,7 @@ export const useField = <T>(
validationTypeToValidate: validationType,
});
if ((validationErrors as Promise<ValidationError[]>).then) {
if (Reflect.has(validationErrors, 'then')) {
return (validationErrors as Promise<ValidationError[]>).then(onValidationErrors);
}
return onValidationErrors(validationErrors as ValidationError[]);

View file

@ -17,10 +17,11 @@
* under the License.
*/
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/server';
import { savedObjectsRepositoryMock } from '../../../../../core/server/mocks';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CollectorOptions } from '../../../../../plugins/usage_collection/server/collector/collector';
import {
CollectorOptions,
createUsageCollectionSetupMock,
} from '../../../../usage_collection/server/usage_collection.mock';
import { registerApplicationUsageCollector } from './';
import {
@ -34,10 +35,11 @@ describe('telemetry_application_usage', () => {
let collector: CollectorOptions;
const usageCollectionMock: jest.Mocked<UsageCollectionSetup> = {
makeUsageCollector: jest.fn().mockImplementation((config) => (collector = config)),
registerCollector: jest.fn(),
} as any;
const usageCollectionMock = createUsageCollectionSetupMock();
usageCollectionMock.makeUsageCollector.mockImplementation((config) => {
collector = config;
return createUsageCollectionSetupMock().makeUsageCollector(config);
});
const getUsageCollector = jest.fn();
const registerType = jest.fn();

View file

@ -17,20 +17,22 @@
* under the License.
*/
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/server';
import { pluginInitializerContextConfigMock } from '../../../../../core/server/mocks';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CollectorOptions } from '../../../../../plugins/usage_collection/server/collector/collector';
import {
CollectorOptions,
createUsageCollectionSetupMock,
} from '../../../../usage_collection/server/usage_collection.mock';
import { registerKibanaUsageCollector } from './';
describe('telemetry_kibana', () => {
let collector: CollectorOptions;
const usageCollectionMock: jest.Mocked<UsageCollectionSetup> = {
makeUsageCollector: jest.fn().mockImplementation((config) => (collector = config)),
registerCollector: jest.fn(),
} as any;
const usageCollectionMock = createUsageCollectionSetupMock();
usageCollectionMock.makeUsageCollector.mockImplementation((config) => {
collector = config;
return createUsageCollectionSetupMock().makeUsageCollector(config);
});
const legacyConfig$ = pluginInitializerContextConfigMock({}).legacy.globalConfig$;
const callCluster = jest.fn().mockImplementation(() => ({}));

View file

@ -17,20 +17,22 @@
* under the License.
*/
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { uiSettingsServiceMock } from '../../../../../core/server/mocks';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CollectorOptions } from '../../../../../plugins/usage_collection/server/collector/collector';
import {
CollectorOptions,
createUsageCollectionSetupMock,
} from '../../../../usage_collection/server/usage_collection.mock';
import { registerManagementUsageCollector } from './';
describe('telemetry_application_usage_collector', () => {
let collector: CollectorOptions;
const usageCollectionMock: jest.Mocked<UsageCollectionSetup> = {
makeUsageCollector: jest.fn().mockImplementation((config) => (collector = config)),
registerCollector: jest.fn(),
} as any;
const usageCollectionMock = createUsageCollectionSetupMock();
usageCollectionMock.makeUsageCollector.mockImplementation((config) => {
collector = config;
return createUsageCollectionSetupMock().makeUsageCollector(config);
});
const uiSettingsClient = uiSettingsServiceMock.createClient();
const getUiSettingsClient = jest.fn(() => uiSettingsClient);

View file

@ -18,9 +18,10 @@
*/
import { Subject } from 'rxjs';
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/server';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CollectorOptions } from '../../../../../plugins/usage_collection/server/collector/collector';
import {
CollectorOptions,
createUsageCollectionSetupMock,
} from '../../../../usage_collection/server/usage_collection.mock';
import { registerOpsStatsCollector } from './';
import { OpsMetrics } from '../../../../../core/server';
@ -28,10 +29,11 @@ import { OpsMetrics } from '../../../../../core/server';
describe('telemetry_ops_stats', () => {
let collector: CollectorOptions;
const usageCollectionMock: jest.Mocked<UsageCollectionSetup> = {
makeStatsCollector: jest.fn().mockImplementation((config) => (collector = config)),
registerCollector: jest.fn(),
} as any;
const usageCollectionMock = createUsageCollectionSetupMock();
usageCollectionMock.makeStatsCollector.mockImplementation((config) => {
collector = config;
return createUsageCollectionSetupMock().makeStatsCollector(config);
});
const metrics$ = new Subject<OpsMetrics>();
const callCluster = jest.fn();

View file

@ -17,20 +17,22 @@
* under the License.
*/
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/server';
import { savedObjectsRepositoryMock } from '../../../../../core/server/mocks';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { CollectorOptions } from '../../../../../plugins/usage_collection/server/collector/collector';
import {
CollectorOptions,
createUsageCollectionSetupMock,
} from '../../../../usage_collection/server/usage_collection.mock';
import { registerUiMetricUsageCollector } from './';
describe('telemetry_ui_metric', () => {
let collector: CollectorOptions;
const usageCollectionMock: jest.Mocked<UsageCollectionSetup> = {
makeUsageCollector: jest.fn().mockImplementation((config) => (collector = config)),
registerCollector: jest.fn(),
} as any;
const usageCollectionMock = createUsageCollectionSetupMock();
usageCollectionMock.makeUsageCollector.mockImplementation((config) => {
collector = config;
return createUsageCollectionSetupMock().makeUsageCollector(config);
});
const getUsageCollector = jest.fn();
const registerType = jest.fn();

View file

@ -23,25 +23,27 @@ import {
savedObjectsRepositoryMock,
uiSettingsServiceMock,
} from '../../../core/server/mocks';
import { UsageCollectionSetup } from '../../usage_collection/server';
import {
CollectorOptions,
createUsageCollectionSetupMock,
} from '../../usage_collection/server/usage_collection.mock';
import { plugin } from './';
describe('kibana_usage_collection', () => {
const pluginInstance = plugin(coreMock.createPluginInitializerContext({}));
const usageCollectors: Array<{ isReady: () => boolean }> = [];
const usageCollectors: CollectorOptions[] = [];
const usageCollection: jest.Mocked<UsageCollectionSetup> = {
makeStatsCollector: jest.fn().mockImplementation((opts) => {
usageCollectors.push(opts);
return opts;
}),
makeUsageCollector: jest.fn().mockImplementation((opts) => {
usageCollectors.push(opts);
return opts;
}),
registerCollector: jest.fn(),
} as any;
const usageCollection = createUsageCollectionSetupMock();
usageCollection.makeUsageCollector.mockImplementation((opts) => {
usageCollectors.push(opts);
return createUsageCollectionSetupMock().makeUsageCollector(opts);
});
usageCollection.makeStatsCollector.mockImplementation((opts) => {
usageCollectors.push(opts);
return createUsageCollectionSetupMock().makeStatsCollector(opts);
});
test('Runs the setup method without issues', () => {
const coreSetup = coreMock.createSetup();

View file

@ -28,8 +28,10 @@ export interface KibanaUsageStats {
};
kibana_stats: {
os: {
platform: string;
platformRelease: string;
// These should be provided
platform: string | undefined;
platformRelease: string | undefined;
// The ones below are really optional
distro?: string;
distroRelease?: string;
};

View file

@ -28,7 +28,7 @@ export const getTelemetrySavedObject: GetTelemetrySavedObject = async (
repository: SavedObjectsClientContract
) => {
try {
const { attributes } = await repository.get('telemetry', 'telemetry');
const { attributes } = await repository.get<TelemetrySavedObject>('telemetry', 'telemetry');
return attributes;
} catch (error) {
if (SavedObjectsErrorHelpers.isNotFoundError(error)) {

View file

@ -71,7 +71,8 @@ export class CollectorSet {
return x instanceof UsageCollector;
};
public areAllCollectorsReady = async (collectorSet = this) => {
public areAllCollectorsReady = async (collectorSet: CollectorSet = this) => {
// Kept this for runtime validation in JS code.
if (!(collectorSet instanceof CollectorSet)) {
throw new Error(
`areAllCollectorsReady method given bad collectorSet parameter: ` + typeof collectorSet

View file

@ -0,0 +1,47 @@
/*
* 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 { CollectorOptions } from './collector/collector';
import { UsageCollectionSetup } from './index';
export { CollectorOptions };
export const createUsageCollectionSetupMock = () => {
const usageCollectionSetupMock: jest.Mocked<UsageCollectionSetup> = {
areAllCollectorsReady: jest.fn(),
bulkFetch: jest.fn(),
bulkFetchUsage: jest.fn(),
getCollectorByType: jest.fn(),
getFilteredCollectorSet: jest.fn(),
// @ts-ignore jest.fn doesn't play nice with type guards
isUsageCollector: jest.fn(),
makeCollectorSetFromArray: jest.fn(),
makeStatsCollector: jest.fn(),
map: jest.fn(),
maximumWaitTimeForAllCollectorsInS: 0,
some: jest.fn(),
toApiFieldNames: jest.fn(),
toObject: jest.fn(),
makeUsageCollector: jest.fn(),
registerCollector: jest.fn(),
};
usageCollectionSetupMock.areAllCollectorsReady.mockResolvedValue(true);
return usageCollectionSetupMock;
};

View file

@ -38,6 +38,11 @@ import { tickFormatters } from '../helpers/tick_formatters';
import { generateTicksProvider } from '../helpers/tick_generator';
import { TimelionVisDependencies } from '../plugin';
interface CrosshairPlot extends jquery.flot.plot {
setCrosshair: (pos: Position) => void;
clearCrosshair: () => void;
}
interface PanelProps {
interval: string;
seriesList: Sheet;
@ -70,26 +75,26 @@ const emptyCaption = '<br>';
function Panel({ interval, seriesList, renderComplete }: PanelProps) {
const kibana = useKibana<TimelionVisDependencies>();
const [chart, setChart] = useState(() => cloneDeep(seriesList.list));
const [canvasElem, setCanvasElem] = useState();
const [chartElem, setChartElem] = useState();
const [canvasElem, setCanvasElem] = useState<HTMLDivElement>();
const [chartElem, setChartElem] = useState<HTMLDivElement>();
const [originalColorMap, setOriginalColorMap] = useState(() => new Map<Series, string>());
const [highlightedSeries, setHighlightedSeries] = useState<number | null>(null);
const [focusedSeries, setFocusedSeries] = useState();
const [plot, setPlot] = useState();
const [focusedSeries, setFocusedSeries] = useState<number | null>();
const [plot, setPlot] = useState<jquery.flot.plot>();
// Used to toggle the series, and for displaying values on hover
const [legendValueNumbers, setLegendValueNumbers] = useState();
const [legendCaption, setLegendCaption] = useState();
const [legendValueNumbers, setLegendValueNumbers] = useState<JQuery<HTMLElement>>();
const [legendCaption, setLegendCaption] = useState<JQuery<HTMLElement>>();
const canvasRef = useCallback((node) => {
const canvasRef = useCallback((node: HTMLDivElement | null) => {
if (node !== null) {
setCanvasElem(node);
}
}, []);
const elementRef = useCallback((node) => {
const elementRef = useCallback((node: HTMLDivElement | null) => {
if (node !== null) {
setChartElem(node);
}
@ -97,7 +102,9 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
useEffect(
() => () => {
$(chartElem).off('plotselected').off('plothover').off('mouseleave');
if (chartElem) {
$(chartElem).off('plotselected').off('plothover').off('mouseleave');
}
},
[chartElem]
);
@ -149,7 +156,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
const updateCaption = useCallback(
(plotData: any) => {
if (get(plotData, '[0]._global.legend.showTime', true)) {
if (canvasElem && get(plotData, '[0]._global.legend.showTime', true)) {
const caption = $('<caption class="timChart__legendCaption"></caption>');
caption.html(emptyCaption);
setLegendCaption(caption);
@ -199,7 +206,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
});
}
const newPlot = $.plot(canvasElem, updatedSeries, options);
const newPlot = $.plot($(canvasElem), updatedSeries, options);
setPlot(newPlot);
renderComplete();
@ -249,12 +256,12 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
(pos: Position) => {
unhighlightSeries();
const axes = plot.getAxes();
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max) {
const axes = plot!.getAxes();
if (pos.x < axes.xaxis.min! || pos.x > axes.xaxis.max!) {
return;
}
const dataset = plot.getData();
const dataset = plot!.getData();
if (legendCaption) {
legendCaption.text(
moment(pos.x).format(get(dataset, '[0]._global.legend.timeFormat', DEFAULT_TIME_FORMAT))
@ -262,10 +269,11 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
}
for (let i = 0; i < dataset.length; ++i) {
const series = dataset[i];
const useNearestPoint = series.lines.show && !series.lines.steps;
const useNearestPoint = series.lines!.show && !series.lines!.steps;
const precision = get(series, '_meta.precision', 2);
if (series._hide) {
// We're setting this flag on top on the series object belonging to the flot library, so we're simply casting here.
if ((series as { _hide?: boolean })._hide) {
continue;
}
@ -282,14 +290,17 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
const y = currentPoint[1];
if (y != null && legendValueNumbers) {
let label = y.toFixed(precision);
if (series.yaxis.tickFormatter) {
label = series.yaxis.tickFormatter(Number(label), series.yaxis);
if (legendValueNumbers) {
if (y == null) {
legendValueNumbers.eq(i).empty();
} else {
let label = y.toFixed(precision);
const formatter = ((series.yaxis as unknown) as Axis).tickFormatter;
if (formatter) {
label = formatter(Number(label), (series.yaxis as unknown) as Axis);
}
legendValueNumbers.eq(i).text(`(${label})`);
}
legendValueNumbers.eq(i).text(`(${label})`);
} else {
legendValueNumbers.eq(i).empty();
}
}
},
@ -310,7 +321,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
if (legendCaption) {
legendCaption.html(emptyCaption);
}
each(legendValueNumbers, (num: Node) => {
each(legendValueNumbers!, (num: Node) => {
$(num).empty();
});
}, [legendCaption, legendValueNumbers]);
@ -320,7 +331,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
if (!plot) {
return;
}
plot.setCrosshair(pos);
(plot as CrosshairPlot).setCrosshair(pos);
debouncedSetLegendNumbers(pos);
},
[plot, debouncedSetLegendNumbers]
@ -329,7 +340,7 @@ function Panel({ interval, seriesList, renderComplete }: PanelProps) {
if (!plot) {
return;
}
plot.clearCrosshair();
(plot as CrosshairPlot).clearCrosshair();
clearLegendNumbers();
}, [plot, clearLegendNumbers]);

View file

@ -16,9 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
import { SavedObjectAttributes, SavedObjectReference } from '../../../../core/public';
import {
SavedObjectAttribute,
SavedObjectAttributes,
SavedObjectReference,
} from '../../../../core/public';
import { VisSavedObject } from '../types';
import { injectSearchSourceReferences, extractSearchSourceReferences } from '../../../data/public';
import {
extractSearchSourceReferences,
injectSearchSourceReferences,
SearchSourceFields,
} from '../../../data/public';
export function extractReferences({
attributes,
@ -32,9 +40,9 @@ export function extractReferences({
if (updatedAttributes.searchSourceFields) {
const [searchSource, searchSourceReferences] = extractSearchSourceReferences(
updatedAttributes.searchSourceFields as any
updatedAttributes.searchSourceFields as SearchSourceFields
);
updatedAttributes.searchSourceFields = searchSource;
updatedAttributes.searchSourceFields = searchSource as SavedObjectAttribute;
searchSourceReferences.forEach((r) => updatedReferences.push(r));
}

View file

@ -31,9 +31,9 @@ export async function createTestUserService(
const config = getService('config');
// @ts-ignore browser service is not normally available in common.
const browser: Browser | void = hasService('browser') && getService('browser');
const testSubjects: TestSubjects | void =
// @ts-ignore testSubject service is not normally available in common.
hasService('testSubjects') && getService('testSubjects');
const testSubjects: TestSubjects | undefined =
// testSubject service is not normally available in common.
hasService('testSubjects') ? (getService('testSubjects' as any) as TestSubjects) : undefined;
const kibanaServer = getService('kibanaServer');
const enabledPlugins = config.get('security.disableTestUser')

View file

@ -18,6 +18,6 @@
},
"devDependencies": {
"@kbn/plugin-helpers": "9.0.2",
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -16,6 +16,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,7 +12,7 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -17,6 +17,6 @@
},
"devDependencies": {
"@kbn/plugin-helpers": "9.0.2",
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -17,6 +17,6 @@
},
"devDependencies": {
"@kbn/plugin-helpers": "9.0.2",
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -12,6 +12,6 @@
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
"typescript": "3.9.5"
}
}

View file

@ -11,6 +11,15 @@ import { DatabaseAdapter } from '../database/adapter_types';
import { FrameworkUser } from '../framework/adapter_types';
import { BeatsTagAssignment, CMBeatsAdapter } from './adapter_types';
function formatWithTags(beat: CMBeat) {
const { tags, ...rest } = beat;
return {
tags: tags || [],
...rest,
};
}
export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
private database: DatabaseAdapter;
@ -97,10 +106,9 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
if (beats.length === 0) {
return [];
}
return beats.map((beat: any) => ({
tags: [] as string[],
...(omit(beat._source.beat as CMBeat, ['access_token']) as CMBeat),
}));
return beats.map((beat: any) =>
formatWithTags(omit(beat._source.beat as CMBeat, ['access_token']) as CMBeat)
);
}
public async getBeatWithToken(
@ -124,7 +132,7 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
if (beats.length === 0) {
return null;
}
return omit<CMBeat, {}>(_get<CMBeat>({ tags: [], ...beats[0] }, '_source.beat'), [
return omit<CMBeat, {}>(_get<CMBeat>(formatWithTags(beats[0]), '_source.beat'), [
'access_token',
]);
}
@ -165,10 +173,9 @@ export class ElasticsearchBeatsAdapter implements CMBeatsAdapter {
}
const beats = _get<any>(response, 'hits.hits', []);
return beats.map((beat: any) => ({
tags: [] as string[],
...(omit(beat._source.beat as CMBeat, ['access_token']) as CMBeat),
}));
return beats.map((beat: any) =>
formatWithTags(omit(beat._source.beat as CMBeat, ['access_token']) as CMBeat)
);
}
public async removeTagsFromBeats(

View file

@ -137,12 +137,13 @@ export class ElasticsearchConfigurationBlockAdapter implements ConfigurationBloc
public async create(user: FrameworkUser, configs: ConfigurationBlock[]): Promise<string[]> {
const body = flatten(
configs.map((config) => {
const id = config.id || uuidv4();
const { id: configId, ...configWithoutId } = config;
const id = configId || uuidv4();
return [
{ index: { _id: `configuration_block:${id}` } },
{
type: 'configuration_block',
configuration_block: { id, ...config, config: JSON.stringify(config.config) },
configuration_block: { id, ...configWithoutId, config: JSON.stringify(config.config) },
},
];
})

View file

@ -95,9 +95,9 @@
"@types/prop-types": "^15.5.3",
"@types/proper-lockfile": "^3.0.1",
"@types/puppeteer": "^1.20.1",
"@types/react": "^16.9.19",
"@types/react": "^16.9.36",
"@types/react-beautiful-dnd": "^12.1.1",
"@types/react-dom": "^16.9.5",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.7",
"@types/react-router-dom": "^5.1.3",
"@types/react-sticky": "^6.0.3",
@ -179,16 +179,16 @@
"tmp": "0.1.0",
"tree-kill": "^1.2.2",
"ts-loader": "^6.0.4",
"typescript": "3.7.2",
"typescript": "3.9.5",
"vinyl-fs": "^3.0.3",
"whatwg-fetch": "^3.0.0",
"xml-crypto": "^1.4.0",
"yargs": "4.8.1"
},
"dependencies": {
"@babel/core": "^7.9.0",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@babel/core": "^7.10.2",
"@babel/register": "^7.10.1",
"@babel/runtime": "^7.10.2",
"@elastic/apm-rum-react": "^1.1.1",
"@elastic/datemath": "5.0.2",
"@elastic/ems-client": "7.8.0",
@ -356,7 +356,7 @@
"tinycolor2": "1.4.1",
"tinymath": "1.2.1",
"topojson-client": "3.0.0",
"tslib": "^1.9.3",
"tslib": "^2.0.0",
"turf": "3.0.14",
"typescript-fsa": "^3.0.0",
"typescript-fsa-reducers": "^1.2.1",
@ -381,4 +381,4 @@
"cypress-multi-reporters"
]
}
}
}

View file

@ -6,11 +6,11 @@
import { PluginInitializerContext, RequestHandlerContext } from '../../../../src/core/server';
import { coreMock, httpServerMock } from '../../../../src/core/server/mocks';
import { usageCollectionPluginMock } from '../../../../src/plugins/usage_collection/server/mocks';
import { licensingMock } from '../../licensing/server/mocks';
import { encryptedSavedObjectsMock } from '../../encrypted_saved_objects/server/mocks';
import { taskManagerMock } from '../../task_manager/server/mocks';
import { eventLogMock } from '../../event_log/server/mocks';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { ActionType } from './types';
import { ActionsConfig } from './config';
import {
@ -21,10 +21,6 @@ import {
} from './plugin';
describe('Actions Plugin', () => {
const usageCollectionMock: jest.Mocked<UsageCollectionSetup> = ({
makeUsageCollector: jest.fn(),
registerCollector: jest.fn(),
} as unknown) as jest.Mocked<UsageCollectionSetup>;
describe('setup()', () => {
let context: PluginInitializerContext;
let plugin: ActionsPlugin;
@ -46,7 +42,7 @@ describe('Actions Plugin', () => {
encryptedSavedObjects: encryptedSavedObjectsMock.createSetup(),
licensing: licensingMock.createSetup(),
eventLog: eventLogMock.createSetup(),
usageCollection: usageCollectionMock,
usageCollection: usageCollectionPluginMock.createSetupContract(),
};
});
@ -203,7 +199,7 @@ describe('Actions Plugin', () => {
encryptedSavedObjects: encryptedSavedObjectsMock.createSetup(),
licensing: licensingMock.createSetup(),
eventLog: eventLogMock.createSetup(),
usageCollection: usageCollectionMock,
usageCollection: usageCollectionPluginMock.createSetupContract(),
};
pluginsStart = {
taskManager: taskManagerMock.createStart(),

View file

@ -22,12 +22,18 @@ describe('registerActionsUsageCollector', () => {
});
it('should call registerCollector', () => {
registerActionsUsageCollector(usageCollectionMock, mockTaskManagerStart);
registerActionsUsageCollector(
usageCollectionMock as UsageCollectionSetup,
mockTaskManagerStart
);
expect(usageCollectionMock.registerCollector).toHaveBeenCalledTimes(1);
});
it('should call makeUsageCollector with type = actions', () => {
registerActionsUsageCollector(usageCollectionMock, mockTaskManagerStart);
registerActionsUsageCollector(
usageCollectionMock as UsageCollectionSetup,
mockTaskManagerStart
);
expect(usageCollectionMock.makeUsageCollector).toHaveBeenCalledTimes(1);
expect(usageCollectionMock.makeUsageCollector.mock.calls[0][0].type).toBe('actions');
});

View file

@ -22,12 +22,12 @@ describe('registerAlertsUsageCollector', () => {
});
it('should call registerCollector', () => {
registerAlertsUsageCollector(usageCollectionMock, taskManagerStart);
registerAlertsUsageCollector(usageCollectionMock as UsageCollectionSetup, taskManagerStart);
expect(usageCollectionMock.registerCollector).toHaveBeenCalledTimes(1);
});
it('should call makeUsageCollector with type = alerts', () => {
registerAlertsUsageCollector(usageCollectionMock, taskManagerStart);
registerAlertsUsageCollector(usageCollectionMock as UsageCollectionSetup, taskManagerStart);
expect(usageCollectionMock.makeUsageCollector).toHaveBeenCalledTimes(1);
expect(usageCollectionMock.makeUsageCollector.mock.calls[0][0].type).toBe('alerts');
});

View file

@ -19,7 +19,7 @@
"p-limit": "^2.3.0",
"p-retry": "^4.2.0",
"ts-loader": "^7.0.4",
"typescript": "3.9.2",
"typescript": "3.9.5",
"wait-on": "^5.0.0",
"webpack": "^4.43.0",
"yargs": "^15.3.1"

View file

@ -77,6 +77,7 @@ function getLayoutOptions(
): cytoscape.LayoutOptions {
return {
name: 'breadthfirst',
// @ts-ignore DefinitelyTyped is incorrect here. Roots can be an Array
roots: selectedRoots.length ? selectedRoots : undefined,
fit: true,
padding: nodeHeight,

View file

@ -183,11 +183,10 @@ const style: cytoscape.Stylesheet[] = [
: parseInt(theme.paddingSizes.xs, 10),
},
},
// @ts-ignore DefinitelyTyped says visibility is "none" but it's
// actually "hidden"
{
selector: 'edge[isInverseEdge]',
// @ts-ignore
// @ts-ignore DefinitelyTyped says visibility is "none" but it's
// actually "hidden"
style: { visibility: 'hidden' },
},
{

View file

@ -37,7 +37,7 @@ import { useUiTracker } from '../../../../../../../../observability/public';
import { SettingFormRow } from './SettingFormRow';
import { getOptionLabel } from '../../../../../../../common/agent_configuration/all_option';
function removeEmpty<T>(obj: T): T {
function removeEmpty(obj: { [key: string]: any }) {
return Object.fromEntries(
Object.entries(obj).filter(([_, v]) => v != null && v !== '')
);

Some files were not shown because too many files have changed in this diff Show more