* bump version to 4.1.1-rc
* fix code to run kbn bootstrap
* fix errors
* DO NOT MERGE. mute errors and ping teams to fix them
* Address EuiSelectableProps configuration in discover sidebar
* use explicit type for EuiSelectable
* update to ts v4.1.2
* fix ts error in EuiSelectable
* update docs
* update prettier with ts version support
* Revert "update prettier with ts version support"
This reverts commit 3de48db3ec
.
* address another new problem
Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
# Conflicts:
# test/functional/services/remote/remote.ts
This commit is contained in:
parent
60a65a18fd
commit
e77769a9ac
|
@ -7,7 +7,7 @@
|
|||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
SearchBar: React.ComponentClass<Pick<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & {
|
||||
WrappedComponent: React.ComponentType<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated"> & ReactIntl.InjectedIntlProps>;
|
||||
SearchBar: React.ComponentClass<Pick<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "intl" | "indexPatterns" | "dataTestSubj" | "refreshInterval" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, "query" | "isLoading" | "filters" | "indexPatterns" | "dataTestSubj" | "refreshInterval" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & {
|
||||
WrappedComponent: React.ComponentType<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "intl" | "indexPatterns" | "dataTestSubj" | "refreshInterval" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated"> & ReactIntl.InjectedIntlProps>;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
"**/prismjs": "1.22.0",
|
||||
"**/request": "^2.88.2",
|
||||
"**/trim": "0.0.3",
|
||||
"**/typescript": "4.0.2"
|
||||
"**/typescript": "4.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "12.19.1",
|
||||
|
@ -824,7 +824,7 @@
|
|||
"topojson-client": "3.0.0",
|
||||
"ts-loader": "^7.0.5",
|
||||
"tsd": "^0.13.1",
|
||||
"typescript": "4.0.2",
|
||||
"typescript": "4.1.2",
|
||||
"typescript-fsa": "^3.0.0",
|
||||
"typescript-fsa-reducers": "^1.2.1",
|
||||
"unlazy-loader": "^0.1.3",
|
||||
|
|
|
@ -228,7 +228,7 @@ export function runCli() {
|
|||
output: process.stdout,
|
||||
});
|
||||
|
||||
await new Promise((resolveInput) => {
|
||||
await new Promise<void>((resolveInput) => {
|
||||
rl.question(`Press enter when you're done`, () => {
|
||||
rl.close();
|
||||
resolveInput();
|
||||
|
|
|
@ -697,7 +697,7 @@ describe('#start()', () => {
|
|||
// Create an app and a promise that allows us to control when the app completes mounting
|
||||
const createWaitingApp = (props: Partial<App>): [App, () => void] => {
|
||||
let finishMount: () => void;
|
||||
const mountPromise = new Promise((resolve) => (finishMount = resolve));
|
||||
const mountPromise = new Promise<void>((resolve) => (finishMount = resolve));
|
||||
const app = {
|
||||
id: 'some-id',
|
||||
title: 'some-title',
|
||||
|
|
|
@ -66,7 +66,7 @@ describe('ApplicationService', () => {
|
|||
const { register } = service.setup(setupDeps);
|
||||
|
||||
let resolveMount: () => void;
|
||||
const promise = new Promise((resolve) => {
|
||||
const promise = new Promise<void>((resolve) => {
|
||||
resolveMount = resolve;
|
||||
});
|
||||
|
||||
|
@ -100,7 +100,7 @@ describe('ApplicationService', () => {
|
|||
const { register } = service.setup(setupDeps);
|
||||
|
||||
let resolveMount: () => void;
|
||||
const promise = new Promise((resolve) => {
|
||||
const promise = new Promise<void>((resolve) => {
|
||||
resolveMount = resolve;
|
||||
});
|
||||
|
||||
|
@ -442,7 +442,7 @@ describe('ApplicationService', () => {
|
|||
const { register } = service.setup(setupDeps);
|
||||
|
||||
let resolveMount: () => void;
|
||||
const promise = new Promise((resolve) => {
|
||||
const promise = new Promise<void>((resolve) => {
|
||||
resolveMount = resolve;
|
||||
});
|
||||
|
||||
|
@ -480,7 +480,7 @@ describe('ApplicationService', () => {
|
|||
const { register } = service.setup(setupDeps);
|
||||
|
||||
let resolveMount: () => void;
|
||||
const promise = new Promise((resolve) => {
|
||||
const promise = new Promise<void>((resolve) => {
|
||||
resolveMount = resolve;
|
||||
});
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('AppContainer', () => {
|
|||
});
|
||||
|
||||
const flushPromises = async () => {
|
||||
await new Promise(async (resolve) => {
|
||||
await new Promise<void>(async (resolve) => {
|
||||
setImmediate(() => resolve());
|
||||
});
|
||||
};
|
||||
|
|
|
@ -70,7 +70,7 @@ export class UiSettingsApi {
|
|||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(resp);
|
||||
resolve(resp!);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -419,7 +419,7 @@ describe('ClusterClient', () => {
|
|||
let closeScopedClient: () => void;
|
||||
|
||||
internalClient.close.mockReturnValue(
|
||||
new Promise((resolve) => {
|
||||
new Promise<void>((resolve) => {
|
||||
closeInternalClient = resolve;
|
||||
}).then(() => {
|
||||
expect(clusterClientClosed).toBe(false);
|
||||
|
@ -427,7 +427,7 @@ describe('ClusterClient', () => {
|
|||
})
|
||||
);
|
||||
scopedClient.close.mockReturnValue(
|
||||
new Promise((resolve) => {
|
||||
new Promise<void>((resolve) => {
|
||||
closeScopedClient = resolve;
|
||||
}).then(() => {
|
||||
expect(clusterClientClosed).toBe(false);
|
||||
|
|
|
@ -71,7 +71,7 @@ export class FileAppender implements DisposableAppender {
|
|||
* Disposes `FileAppender`. Waits for the underlying file stream to be completely flushed and closed.
|
||||
*/
|
||||
public async dispose() {
|
||||
await new Promise((resolve) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
if (this.outputStream === undefined) {
|
||||
return resolve();
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ export class Field extends PureComponent<FieldProps> {
|
|||
|
||||
return new Promise((resolve, reject) => {
|
||||
reader.onload = () => {
|
||||
resolve(reader.result || undefined);
|
||||
resolve(reader.result!);
|
||||
};
|
||||
reader.onerror = (err) => {
|
||||
reject(err);
|
||||
|
|
|
@ -30,7 +30,7 @@ const getPromiseState = (promise: Promise<unknown>): Promise<'resolved' | 'rejec
|
|||
() => resolve('rejected')
|
||||
)
|
||||
),
|
||||
new Promise<'pending'>((resolve) => resolve()).then(() => 'pending'),
|
||||
new Promise<'pending'>((resolve) => resolve('pending')).then(() => 'pending'),
|
||||
]);
|
||||
|
||||
const isPending = (promise: Promise<unknown>): Promise<boolean> =>
|
||||
|
|
|
@ -74,7 +74,7 @@ export class LegacyCoreEditor implements CoreEditor {
|
|||
// dirty check for tokenizer state, uses a lot less cycles
|
||||
// than listening for tokenizerUpdate
|
||||
waitForLatestTokens(): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const session = this.editor.getSession();
|
||||
const checkInterval = 25;
|
||||
|
||||
|
@ -239,7 +239,7 @@ export class LegacyCoreEditor implements CoreEditor {
|
|||
|
||||
private forceRetokenize() {
|
||||
const session = this.editor.getSession();
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
// force update of tokens, but not on this thread to allow for ace rendering.
|
||||
setTimeout(function () {
|
||||
let i;
|
||||
|
|
|
@ -110,7 +110,7 @@ export const proxyRequest = ({
|
|||
if (!resolved) {
|
||||
timeoutReject(Boom.gatewayTimeout('Client request timeout'));
|
||||
} else {
|
||||
timeoutResolve();
|
||||
timeoutResolve(undefined);
|
||||
}
|
||||
}, timeout);
|
||||
});
|
||||
|
|
|
@ -20,7 +20,11 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { IEmbeddable } from '../../embeddable_plugin';
|
||||
import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
|
||||
import { DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '../embeddable';
|
||||
import {
|
||||
DASHBOARD_CONTAINER_TYPE,
|
||||
DashboardContainer,
|
||||
DashboardContainerInput,
|
||||
} from '../embeddable';
|
||||
|
||||
export const ACTION_EXPAND_PANEL = 'togglePanel';
|
||||
|
||||
|
@ -33,7 +37,9 @@ function isExpanded(embeddable: IEmbeddable) {
|
|||
throw new IncompatibleActionError();
|
||||
}
|
||||
|
||||
return embeddable.id === embeddable.parent.getInput().expandedPanelId;
|
||||
return (
|
||||
embeddable.id === (embeddable.parent.getInput() as DashboardContainerInput).expandedPanelId
|
||||
);
|
||||
}
|
||||
|
||||
export interface ExpandPanelActionContext {
|
||||
|
|
|
@ -2045,8 +2045,8 @@ export const search: {
|
|||
// Warning: (ae-missing-release-tag) "SearchBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export const SearchBar: React.ComponentClass<Pick<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & {
|
||||
WrappedComponent: React.ComponentType<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "screenTitle" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated"> & ReactIntl.InjectedIntlProps>;
|
||||
export const SearchBar: React.ComponentClass<Pick<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "intl" | "indexPatterns" | "dataTestSubj" | "refreshInterval" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, "query" | "isLoading" | "filters" | "indexPatterns" | "dataTestSubj" | "refreshInterval" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated">, any> & {
|
||||
WrappedComponent: React.ComponentType<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "intl" | "indexPatterns" | "dataTestSubj" | "refreshInterval" | "screenTitle" | "onRefresh" | "onRefreshChange" | "showQueryInput" | "showDatePicker" | "showAutoRefreshOnly" | "dateRangeFrom" | "dateRangeTo" | "isRefreshPaused" | "customSubmitButton" | "timeHistory" | "indicateNoData" | "onFiltersUpdated" | "trackUiMetric" | "savedQuery" | "showSaveQuery" | "onClearSavedQuery" | "showQueryBar" | "showFilterBar" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated"> & ReactIntl.InjectedIntlProps>;
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "SearchBarOwnProps" needs to be exported by the entry point index.d.ts
|
||||
|
|
|
@ -47,7 +47,7 @@ export function ChangeIndexPattern({
|
|||
indexPatternRefs: IndexPatternRef[];
|
||||
onChangeIndexPattern: (newId: string) => void;
|
||||
indexPatternId?: string;
|
||||
selectableProps?: EuiSelectableProps;
|
||||
selectableProps?: EuiSelectableProps<{ value: string }>;
|
||||
}) {
|
||||
const [isPopoverOpen, setPopoverIsOpen] = useState(false);
|
||||
|
||||
|
@ -86,7 +86,7 @@ export function ChangeIndexPattern({
|
|||
defaultMessage: 'Change index pattern',
|
||||
})}
|
||||
</EuiPopoverTitle>
|
||||
<EuiSelectable
|
||||
<EuiSelectable<{ value: string }>
|
||||
data-test-subj="indexPattern-switcher"
|
||||
{...selectableProps}
|
||||
searchable
|
||||
|
|
|
@ -171,7 +171,7 @@ export abstract class Container<
|
|||
return this.children[id] as TEmbeddable;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<TEmbeddable>((resolve, reject) => {
|
||||
const subscription = merge(this.getOutput$(), this.getInput$()).subscribe(() => {
|
||||
if (this.output.embeddableLoaded[id]) {
|
||||
subscription.unsubscribe();
|
||||
|
@ -181,6 +181,7 @@ export abstract class Container<
|
|||
// If we hit this, the panel was removed before the embeddable finished loading.
|
||||
if (this.input.panels[id] === undefined) {
|
||||
subscription.unsubscribe();
|
||||
// @ts-expect-error undefined in not assignable to TEmbeddable | ErrorEmbeddable
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -53,7 +53,7 @@ export function isEmbeddablePackageState(state: unknown): state is EmbeddablePac
|
|||
|
||||
function ensureFieldOfTypeExists(key: string, obj: unknown, type?: string): boolean {
|
||||
return (
|
||||
obj &&
|
||||
Boolean(obj) &&
|
||||
key in (obj as { [key: string]: unknown }) &&
|
||||
(!type || typeof (obj as { [key: string]: unknown })[key] === type)
|
||||
);
|
||||
|
|
|
@ -56,6 +56,7 @@ export class ContactCardEmbeddableFactory
|
|||
<ContactCardInitializer
|
||||
onCancel={() => {
|
||||
modalSession.close();
|
||||
// @ts-expect-error
|
||||
resolve(undefined);
|
||||
}}
|
||||
onCreate={(input: { firstName: string; lastName?: string }) => {
|
||||
|
|
|
@ -149,7 +149,7 @@ export function useForm<T extends FormData = FormData, I extends FormData = T>(
|
|||
return;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
areSomeFieldValidating = fieldsToArray().some((field) => field.isValidating);
|
||||
if (areSomeFieldValidating) {
|
||||
|
|
|
@ -44,7 +44,7 @@ export const render: ExpressionTypeDefinition<'render', ExpressionValueRender<un
|
|||
name: 'render',
|
||||
from: {
|
||||
'*': <T>(v: T): ExpressionValueRender<T> => ({
|
||||
type: name,
|
||||
type: 'render',
|
||||
as: 'debug',
|
||||
value: v,
|
||||
}),
|
||||
|
|
|
@ -129,7 +129,7 @@ describe('ExpressionRenderHandler', () => {
|
|||
it('sends a next observable once rendering is complete', () => {
|
||||
const expressionRenderHandler = new ExpressionRenderHandler(element);
|
||||
expect.assertions(1);
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
expressionRenderHandler.render$.subscribe((renderCount) => {
|
||||
expect(renderCount).toBe(1);
|
||||
resolve();
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('ensureMinimumTime', () => {
|
|||
|
||||
it('resolves in the amount of time provided, at minimum', async (done) => {
|
||||
const startTime = new Date().getTime();
|
||||
const promise = new Promise((resolve) => resolve());
|
||||
const promise = new Promise<void>((resolve) => resolve());
|
||||
await ensureMinimumTime(promise, 100);
|
||||
const endTime = new Date().getTime();
|
||||
expect(endTime - startTime).toBeGreaterThanOrEqual(100);
|
||||
|
|
|
@ -21,7 +21,7 @@ import { of } from './of';
|
|||
|
||||
describe('of()', () => {
|
||||
describe('when promise resolves', () => {
|
||||
const promise = new Promise((resolve) => resolve()).then(() => 123);
|
||||
const promise = new Promise<void>((resolve) => resolve()).then(() => 123);
|
||||
|
||||
test('first member of 3-tuple is the promise value', async () => {
|
||||
const [result] = await of(promise);
|
||||
|
@ -40,7 +40,7 @@ describe('of()', () => {
|
|||
});
|
||||
|
||||
describe('when promise rejects', () => {
|
||||
const promise = new Promise((resolve) => resolve()).then(() => {
|
||||
const promise = new Promise<void>((resolve) => resolve()).then(() => {
|
||||
// eslint-disable-next-line no-throw-literal
|
||||
throw 123;
|
||||
});
|
||||
|
|
|
@ -199,7 +199,7 @@ describe('useVisualizeAppState', () => {
|
|||
|
||||
renderHook(() => useVisualizeAppState(mockServices, eventEmitter, savedVisInstance));
|
||||
|
||||
await new Promise((res) => {
|
||||
await new Promise<void>((res) => {
|
||||
setTimeout(() => res());
|
||||
});
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ class CodeEditor extends Component<
|
|||
|
||||
public render() {
|
||||
const {
|
||||
name,
|
||||
id,
|
||||
label,
|
||||
isReadOnly,
|
||||
|
|
|
@ -71,6 +71,7 @@ class FieldText extends Component<
|
|||
|
||||
public render() {
|
||||
const {
|
||||
name,
|
||||
id,
|
||||
required,
|
||||
label,
|
||||
|
|
|
@ -73,6 +73,7 @@ class MultiFieldText extends Component<
|
|||
|
||||
public render() {
|
||||
const {
|
||||
name,
|
||||
id,
|
||||
required,
|
||||
label,
|
||||
|
|
|
@ -67,6 +67,7 @@ class FieldPassword extends Component<
|
|||
|
||||
public render() {
|
||||
const {
|
||||
name,
|
||||
id,
|
||||
required,
|
||||
label,
|
||||
|
|
|
@ -28,7 +28,7 @@ export function location(): ExpressionFunctionDefinition<'location', null, {}, P
|
|||
help,
|
||||
fn: () => {
|
||||
return new Promise((resolve) => {
|
||||
function createLocation(geoposition: Position) {
|
||||
function createLocation(geoposition: GeolocationPosition) {
|
||||
const { latitude, longitude } = geoposition.coords;
|
||||
return resolve({
|
||||
type: 'datatable',
|
||||
|
|
|
@ -21,7 +21,7 @@ export const takeMountedSnapshot = (mountedComponent: ReactWrapper<{}, {}, Compo
|
|||
};
|
||||
|
||||
export const waitFor = (fn: () => boolean, stepMs = 100, failAfterMs = 1000) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let waitForTimeout: NodeJS.Timeout;
|
||||
|
||||
const tryCondition = () => {
|
||||
|
|
|
@ -42,7 +42,7 @@ export abstract class AbstractExploreDataAction<Context extends { embeddable?: I
|
|||
|
||||
constructor(protected readonly params: Params) {}
|
||||
|
||||
protected abstract async getUrl(context: Context): Promise<KibanaURL>;
|
||||
protected abstract getUrl(context: Context): Promise<KibanaURL>;
|
||||
|
||||
public async isCompatible({ embeddable }: Context): Promise<boolean> {
|
||||
if (!embeddable) return false;
|
||||
|
|
|
@ -45,7 +45,7 @@ run(
|
|||
|
||||
while (!closing) {
|
||||
await checkin(kibanaUrl, agent, log);
|
||||
await new Promise((resolve, reject) => setTimeout(() => resolve(), CHECKIN_INTERVAL));
|
||||
await new Promise<void>((resolve, reject) => setTimeout(() => resolve(), CHECKIN_INTERVAL));
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -85,9 +85,9 @@ describe('test agent checkin new action services', () => {
|
|||
it('should not fetch actions concurrently', async () => {
|
||||
const observable = createNewActionsSharedObservable();
|
||||
|
||||
const resolves: Array<() => void> = [];
|
||||
const resolves: Array<(value?: any) => void> = [];
|
||||
getMockedNewActionSince().mockImplementation(() => {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<any>((resolve) => {
|
||||
resolves.push(resolve);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@ export function getBufferExtractor(
|
|||
function yauzlFromBuffer(buffer: Buffer, opts: yauzl.Options): Promise<yauzl.ZipFile> {
|
||||
return new Promise((resolve, reject) =>
|
||||
yauzl.fromBuffer(buffer, opts, (err?: Error, handle?: yauzl.ZipFile) =>
|
||||
err ? reject(err) : resolve(handle)
|
||||
err ? reject(err) : resolve(handle!)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ function getZipReadStream(
|
|||
): Promise<NodeJS.ReadableStream> {
|
||||
return new Promise((resolve, reject) =>
|
||||
zipfile.openReadStream(entry, (err?: Error, readStream?: NodeJS.ReadableStream) =>
|
||||
err ? reject(err) : resolve(readStream)
|
||||
err ? reject(err) : resolve(readStream!)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ export class InfraServerPlugin {
|
|||
}
|
||||
|
||||
async setup(core: CoreSetup, plugins: InfraServerPluginDeps) {
|
||||
await new Promise((resolve) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
this.config$.subscribe((configValue) => {
|
||||
this.config = configValue;
|
||||
resolve();
|
||||
|
|
|
@ -19,10 +19,9 @@ export const ConfigPanelWrapper = memo(function ConfigPanelWrapper(props: Config
|
|||
const activeVisualization = props.visualizationMap[props.activeVisualizationId || ''];
|
||||
const { visualizationState } = props;
|
||||
|
||||
return (
|
||||
activeVisualization &&
|
||||
visualizationState && <LayerPanels {...props} activeVisualization={activeVisualization} />
|
||||
);
|
||||
return activeVisualization && visualizationState ? (
|
||||
<LayerPanels {...props} activeVisualization={activeVisualization} />
|
||||
) : null;
|
||||
});
|
||||
|
||||
function LayerPanels(
|
||||
|
|
|
@ -37,9 +37,9 @@ function isConfiguration(
|
|||
value: unknown
|
||||
): value is { columnId: string; groupId: string; layerId: string } {
|
||||
return (
|
||||
value &&
|
||||
Boolean(value) &&
|
||||
typeof value === 'object' &&
|
||||
'columnId' in value &&
|
||||
'columnId' in value! &&
|
||||
'groupId' in value &&
|
||||
'layerId' in value
|
||||
);
|
||||
|
|
|
@ -110,21 +110,21 @@ export const validateDatasourceAndVisualization = (
|
|||
longMessage: string;
|
||||
}>
|
||||
| undefined => {
|
||||
const layersGroups =
|
||||
currentVisualizationState &&
|
||||
currentVisualization
|
||||
?.getLayerIds(currentVisualizationState)
|
||||
.reduce<Record<string, VisualizationDimensionGroupConfig[]>>((memo, layerId) => {
|
||||
const groups = currentVisualization?.getConfiguration({
|
||||
frame: frameAPI,
|
||||
layerId,
|
||||
state: currentVisualizationState,
|
||||
}).groups;
|
||||
if (groups) {
|
||||
memo[layerId] = groups;
|
||||
}
|
||||
return memo;
|
||||
}, {});
|
||||
const layersGroups = currentVisualizationState
|
||||
? currentVisualization
|
||||
?.getLayerIds(currentVisualizationState)
|
||||
.reduce<Record<string, VisualizationDimensionGroupConfig[]>>((memo, layerId) => {
|
||||
const groups = currentVisualization?.getConfiguration({
|
||||
frame: frameAPI,
|
||||
layerId,
|
||||
state: currentVisualizationState,
|
||||
}).groups;
|
||||
if (groups) {
|
||||
memo[layerId] = groups;
|
||||
}
|
||||
return memo;
|
||||
}, {})
|
||||
: undefined;
|
||||
|
||||
const datasourceValidationErrors = currentDatasourceState
|
||||
? currentDataSource?.getErrorMessages(currentDatasourceState, layersGroups)
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useState } from 'react';
|
||||
import { EuiPopover, EuiPopoverTitle, EuiSelectable } from '@elastic/eui';
|
||||
import { EuiSelectableProps } from '@elastic/eui/src/components/selectable/selectable';
|
||||
import { EuiPopover, EuiPopoverTitle, EuiSelectable, EuiSelectableProps } from '@elastic/eui';
|
||||
import { IndexPatternRef } from './types';
|
||||
import { trackUiEvent } from '../lens_ui_telemetry';
|
||||
import { ToolbarButtonProps, ToolbarButton } from '../shared_components';
|
||||
|
@ -63,7 +62,12 @@ export function ChangeIndexPattern({
|
|||
defaultMessage: 'Change index pattern',
|
||||
})}
|
||||
</EuiPopoverTitle>
|
||||
<EuiSelectable
|
||||
<EuiSelectable<{
|
||||
key?: string;
|
||||
label: string;
|
||||
value?: string;
|
||||
checked?: 'on' | 'off' | undefined;
|
||||
}>
|
||||
{...selectableProps}
|
||||
searchable
|
||||
singleSelection="always"
|
||||
|
|
|
@ -46,7 +46,7 @@ describe('createOnPreResponseHandler', () => {
|
|||
const license$ = new BehaviorSubject(licenseMock.createLicense({ signature: 'foo' }));
|
||||
const refresh = jest.fn().mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
license$.next(updatedLicense);
|
||||
resolve();
|
||||
|
|
|
@ -80,7 +80,7 @@ describe('useAsync', () => {
|
|||
|
||||
it('populates the loading state while the function is pending', async () => {
|
||||
let resolve: () => void;
|
||||
fn.mockImplementation(() => new Promise((_resolve) => (resolve = _resolve)));
|
||||
fn.mockImplementation(() => new Promise<void>((_resolve) => (resolve = _resolve)));
|
||||
|
||||
const { result, waitForNextUpdate } = renderHook(() => useAsync(fn));
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ export async function download(url: string, path: string, logger: GenericLevelLo
|
|||
hash.update(chunk);
|
||||
});
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
resp.data
|
||||
.on('error', (err: Error) => {
|
||||
logger.error(err);
|
||||
|
|
|
@ -24,7 +24,7 @@ import { createMockReportingCore } from '../../test_helpers';
|
|||
import { runTaskFnFactory } from './execute_job';
|
||||
import { TaskPayloadCSV } from './types';
|
||||
|
||||
const delay = (ms: number) => new Promise((resolve) => setTimeout(() => resolve(), ms));
|
||||
const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(() => resolve(), ms));
|
||||
|
||||
const puid = new Puid();
|
||||
const getRandomScrollId = () => {
|
||||
|
|
|
@ -36,7 +36,7 @@ export const waitForRenderComplete = async (
|
|||
const renderedTasks = [];
|
||||
|
||||
function waitForRender(visualization: Element) {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
visualization.addEventListener('renderComplete', () => resolve());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ const waitForRender = async (
|
|||
wrapper: ReactWrapper<any>,
|
||||
condition: (wrapper: ReactWrapper<any>) => boolean
|
||||
) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const interval = setInterval(async () => {
|
||||
await Promise.resolve();
|
||||
wrapper.update();
|
||||
|
|
|
@ -413,7 +413,7 @@ export class RoleMappingsGridPage extends Component<Props, State> {
|
|||
'xpack.security.management.roleMappings.actionDeleteAriaLabel',
|
||||
{
|
||||
defaultMessage: `Delete '{name}'`,
|
||||
values: { name },
|
||||
values: { name: record.name },
|
||||
}
|
||||
)}
|
||||
iconType="trash"
|
||||
|
|
|
@ -24,7 +24,7 @@ const waitForRender = async (
|
|||
wrapper: ReactWrapper<any>,
|
||||
condition: (wrapper: ReactWrapper<any>) => boolean
|
||||
) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const interval = setInterval(async () => {
|
||||
await Promise.resolve();
|
||||
wrapper.update();
|
||||
|
|
|
@ -34,7 +34,7 @@ afterEach(() => {
|
|||
it(`logs out 401 responses`, async () => {
|
||||
const http = setupHttp('/foo');
|
||||
const sessionExpired = new SessionExpired(`${http.basePath}/logout`, tenant);
|
||||
const logoutPromise = new Promise((resolve) => {
|
||||
const logoutPromise = new Promise<void>((resolve) => {
|
||||
jest.spyOn(sessionExpired, 'logout').mockImplementation(() => resolve());
|
||||
});
|
||||
const interceptor = new UnauthorizedResponseHttpInterceptor(sessionExpired, http.anonymousPaths);
|
||||
|
|
|
@ -11,7 +11,7 @@ export function cloneHttpFetchQuery(query: Immutable<HttpFetchQuery>): HttpFetch
|
|||
const clone: HttpFetchQuery = {};
|
||||
for (const [key, value] of Object.entries(query)) {
|
||||
if (Array.isArray(value)) {
|
||||
clone[key] = [...value];
|
||||
clone[key] = [...value] as string[] | number[] | boolean[];
|
||||
} else {
|
||||
// Array.isArray is not removing ImmutableArray from the union.
|
||||
clone[key] = value as string | number | boolean;
|
||||
|
|
|
@ -40,7 +40,7 @@ describe('AllRulesTable Columns', () => {
|
|||
test('duplicate rule onClick should call refetch after the rule is duplicated', async () => {
|
||||
(duplicateRulesAction as jest.Mock).mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) =>
|
||||
new Promise<void>((resolve) =>
|
||||
setTimeout(() => {
|
||||
results.push('duplicateRulesAction');
|
||||
resolve();
|
||||
|
@ -62,7 +62,7 @@ describe('AllRulesTable Columns', () => {
|
|||
test('delete rule onClick should call refetch after the rule is deleted', async () => {
|
||||
(deleteRulesAction as jest.Mock).mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) =>
|
||||
new Promise<void>((resolve) =>
|
||||
setTimeout(() => {
|
||||
results.push('deleteRulesAction');
|
||||
resolve();
|
||||
|
|
|
@ -136,8 +136,8 @@ export const getCurrentResourceError = <Data, Error>(
|
|||
};
|
||||
|
||||
export const isOutdatedResourceState = <Data, Error>(
|
||||
state: AsyncResourceState<Data, Error>,
|
||||
isFresh: (data: Data) => boolean
|
||||
state: Immutable<AsyncResourceState<Data, Error>>,
|
||||
isFresh: (data: Immutable<Data>) => boolean
|
||||
): boolean =>
|
||||
isUninitialisedResourceState(state) ||
|
||||
(isLoadedResourceState(state) && !isFresh(state.data)) ||
|
||||
|
|
|
@ -35,7 +35,7 @@ export const needsRefreshOfListData = (state: Immutable<TrustedAppsListPageState
|
|||
const location = state.location;
|
||||
|
||||
return (
|
||||
state.active &&
|
||||
Boolean(state.active) &&
|
||||
isOutdatedResourceState(currentPage, (data) => {
|
||||
return (
|
||||
data.pageIndex === location.page_index &&
|
||||
|
|
|
@ -202,7 +202,7 @@ export class Simulator {
|
|||
while (timeoutCount < 10) {
|
||||
timeoutCount++;
|
||||
yield mapper();
|
||||
await new Promise((resolve) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
this.forceAutoSizerOpen();
|
||||
this.wrapper.update();
|
||||
|
|
|
@ -66,7 +66,7 @@ describe('useCamera on an unpainted element', () => {
|
|||
while (timeoutCount < 10) {
|
||||
timeoutCount++;
|
||||
yield mapper();
|
||||
await new Promise((resolve) => {
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
wrapper.update();
|
||||
resolve();
|
||||
|
|
|
@ -23,6 +23,7 @@ export const Duration = React.memo<{
|
|||
}>(({ contextId, eventId, fieldName, value }) => (
|
||||
<DefaultDraggable
|
||||
id={`duration-default-draggable-${contextId}-${eventId}-${fieldName}-${value}`}
|
||||
// @ts-expect-error
|
||||
name={name}
|
||||
field={fieldName}
|
||||
tooltipContent={null}
|
||||
|
|
|
@ -52,6 +52,7 @@ export const DurationEventStartEnd = React.memo<{
|
|||
data-test-subj="event-duration"
|
||||
field={EVENT_DURATION_FIELD_NAME}
|
||||
id={`duration-event-start-end-default-draggable-${contextId}-${eventId}-${EVENT_DURATION_FIELD_NAME}-${duration}`}
|
||||
// @ts-expect-error
|
||||
name={name}
|
||||
tooltipContent={null}
|
||||
value={duration}
|
||||
|
|
|
@ -23,6 +23,7 @@ export const Bytes = React.memo<{
|
|||
}>(({ contextId, eventId, fieldName, value }) => (
|
||||
<DefaultDraggable
|
||||
id={`bytes-default-draggable-${contextId}-${eventId}-${fieldName}-${value}`}
|
||||
// @ts-expect-error
|
||||
name={name}
|
||||
field={fieldName}
|
||||
tooltipContent={null}
|
||||
|
|
|
@ -384,7 +384,7 @@ describe('Timeline QueryBar ', () => {
|
|||
[
|
||||
{
|
||||
id: `id-exists`,
|
||||
name,
|
||||
name: 'name',
|
||||
enabled: true,
|
||||
excluded: false,
|
||||
kqlQuery: '',
|
||||
|
|
|
@ -48,8 +48,8 @@ export const checkTimelinesStatus = async (
|
|||
readStream,
|
||||
<T>(timelinesFromFileSystem: T) => {
|
||||
if (Array.isArray(timelinesFromFileSystem)) {
|
||||
const parsedTimelinesFromFileSystem = timelinesFromFileSystem.map((t: string) =>
|
||||
JSON.parse(t)
|
||||
const parsedTimelinesFromFileSystem = (timelinesFromFileSystem as readonly string[]).map(
|
||||
(t) => JSON.parse(t)
|
||||
);
|
||||
const prepackagedTimelines = timeline.timeline ?? [];
|
||||
const timelinesToInstall = getTimelinesToInstall(
|
||||
|
|
|
@ -37,6 +37,7 @@ export const HDFSSettings: React.FunctionComponent<Props> = ({
|
|||
settingErrors,
|
||||
}) => {
|
||||
const {
|
||||
name,
|
||||
settings: {
|
||||
delegateType,
|
||||
uri,
|
||||
|
|
|
@ -249,7 +249,11 @@ export const RepositoryTable: React.FunctionComponent<Props> = ({
|
|||
</EuiButton>,
|
||||
<EuiButton
|
||||
key="registerRepo"
|
||||
{...reactRouterNavigate(history, linkToAddRepository(name))}
|
||||
{...reactRouterNavigate(
|
||||
history,
|
||||
// @ts-expect-error
|
||||
linkToAddRepository(name)
|
||||
)}
|
||||
fill
|
||||
iconType="plusInCircle"
|
||||
data-test-subj="registerRepositoryButton"
|
||||
|
|
|
@ -69,7 +69,7 @@ describe('Bulk Operation Buffer', () => {
|
|||
const task3 = createTask();
|
||||
const task4 = createTask();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
Promise.all([bufferedUpdate(task1), bufferedUpdate(task2)]).then((_) => {
|
||||
expect(bulkUpdate).toHaveBeenCalledTimes(1);
|
||||
expect(bulkUpdate).toHaveBeenCalledWith([task1, task2]);
|
||||
|
@ -146,7 +146,7 @@ describe('Bulk Operation Buffer', () => {
|
|||
expect(bulkUpdate).toHaveBeenCalledTimes(1);
|
||||
expect(bulkUpdate).toHaveBeenCalledWith([task1, task2]);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const futureUpdates = Promise.all([bufferedUpdate(task3), bufferedUpdate(task4)]);
|
||||
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -36,7 +36,7 @@ describe('Configuration Statistics Aggregator', () => {
|
|||
pollIntervalConfiguration$: new Subject<number>(),
|
||||
};
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
createConfigurationAggregator(configuration, managedConfig)
|
||||
.pipe(take(3), bufferCount(3))
|
||||
.subscribe(([initial, updatedWorkers, updatedInterval]) => {
|
||||
|
|
|
@ -36,7 +36,7 @@ describe('createMonitoringStatsStream', () => {
|
|||
};
|
||||
|
||||
it('returns the initial config used to configure Task Manager', async () => {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
createMonitoringStatsStream(of(), configuration)
|
||||
.pipe(take(1))
|
||||
.subscribe((firstValue) => {
|
||||
|
@ -49,7 +49,7 @@ describe('createMonitoringStatsStream', () => {
|
|||
it('incrementally updates the stats returned by the endpoint', async () => {
|
||||
const aggregatedStats$ = new Subject<AggregatedStat>();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
createMonitoringStatsStream(aggregatedStats$, configuration)
|
||||
.pipe(take(3), bufferCount(3))
|
||||
.subscribe(([initialValue, secondValue, thirdValue]) => {
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('Task Run Statistics', () => {
|
|||
});
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
taskRunAggregator
|
||||
.pipe(
|
||||
// skip initial stat which is just initialized data which
|
||||
|
@ -128,7 +128,7 @@ describe('Task Run Statistics', () => {
|
|||
}
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
taskRunAggregator
|
||||
.pipe(
|
||||
// skip initial stat which is just initialized data which
|
||||
|
@ -224,7 +224,7 @@ describe('Task Run Statistics', () => {
|
|||
runningAverageWindowSize
|
||||
);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
taskRunAggregator
|
||||
.pipe(
|
||||
// skip initial stat which is just initialized data which
|
||||
|
@ -303,7 +303,7 @@ describe('Task Run Statistics', () => {
|
|||
runningAverageWindowSize
|
||||
);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
taskRunAggregator
|
||||
.pipe(
|
||||
// skip initial stat which is just initialized data which
|
||||
|
@ -394,7 +394,7 @@ describe('Task Run Statistics', () => {
|
|||
runningAverageWindowSize
|
||||
);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
taskRunAggregator
|
||||
.pipe(
|
||||
// skip initial stat which is just initialized data which
|
||||
|
|
|
@ -86,7 +86,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe(() => {
|
||||
expect(taskStore.aggregate).toHaveBeenCalledWith({
|
||||
aggs: {
|
||||
|
@ -253,7 +253,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe((result) => {
|
||||
expect(result.key).toEqual('workload');
|
||||
expect(result.value).toMatchObject({
|
||||
|
@ -283,7 +283,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise(async (resolve) => {
|
||||
return new Promise<void>(async (resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe((result) => {
|
||||
expect(result.key).toEqual('workload');
|
||||
expect(result.value).toMatchObject({
|
||||
|
@ -319,7 +319,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe((result) => {
|
||||
expect(result.key).toEqual('workload');
|
||||
expect(result.value).toMatchObject({
|
||||
|
@ -342,7 +342,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe((result) => {
|
||||
expect(result.key).toEqual('workload');
|
||||
expect(result.value).toMatchObject({
|
||||
|
@ -370,7 +370,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe(() => {
|
||||
expect(taskStore.aggregate.mock.calls[0][0]).toMatchObject({
|
||||
aggs: {
|
||||
|
@ -408,7 +408,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
loggingSystemMock.create().get()
|
||||
);
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
workloadAggregator.pipe(first()).subscribe((result) => {
|
||||
expect(taskStore.aggregate.mock.calls[0][0]).toMatchObject({
|
||||
aggs: {
|
||||
|
@ -453,7 +453,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
const logger = loggingSystemMock.create().get();
|
||||
const workloadAggregator = createWorkloadAggregator(taskStore, of(true), 10, 3000, logger);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
workloadAggregator.pipe(take(2), bufferCount(2)).subscribe((results) => {
|
||||
expect(results[0].key).toEqual('workload');
|
||||
expect(results[0].value).toMatchObject({
|
||||
|
@ -491,7 +491,7 @@ describe('Workload Statistics Aggregator', () => {
|
|||
logger
|
||||
);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let errorWasThrowAt = 0;
|
||||
taskStore.aggregate.mockImplementation(async () => {
|
||||
if (errorWasThrowAt === 0) {
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('Poll Monitor', () => {
|
|||
|
||||
expect(instantiator).not.toHaveBeenCalled();
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const next = jest.fn();
|
||||
monitoredObservable.pipe(take(3)).subscribe({
|
||||
next,
|
||||
|
@ -45,7 +45,7 @@ describe('Poll Monitor', () => {
|
|||
const instantiator = jest.fn(() => interval(100));
|
||||
const monitoredObservable = createObservableMonitor(instantiator, { heartbeatInterval });
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const next = jest.fn();
|
||||
monitoredObservable.pipe(take(3)).subscribe({
|
||||
next,
|
||||
|
@ -79,7 +79,7 @@ describe('Poll Monitor', () => {
|
|||
const onError = jest.fn();
|
||||
const monitoredObservable = createObservableMonitor(instantiator, { onError });
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const next = jest.fn();
|
||||
const error = jest.fn();
|
||||
monitoredObservable
|
||||
|
@ -135,7 +135,7 @@ describe('Poll Monitor', () => {
|
|||
inactivityTimeout: 500,
|
||||
});
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const next = jest.fn();
|
||||
const error = jest.fn();
|
||||
monitoredObservable
|
||||
|
|
|
@ -689,7 +689,7 @@ export const waitFor = async (
|
|||
maxTimeout: number = 10000,
|
||||
timeoutWait: number = 10
|
||||
): Promise<void> => {
|
||||
await new Promise(async (resolve, reject) => {
|
||||
await new Promise<void>(async (resolve, reject) => {
|
||||
let found = false;
|
||||
let numberOfTries = 0;
|
||||
while (!found && numberOfTries < Math.floor(maxTimeout / timeoutWait)) {
|
||||
|
|
|
@ -104,7 +104,7 @@ const search = async (engineName: string): Promise<ISearchResponse> => {
|
|||
// Since the App Search API does not issue document receipts, the only way to tell whether or not documents
|
||||
// are fully indexed is to poll the search endpoint.
|
||||
export const waitForIndexedDocs = (engineName: string) => {
|
||||
return new Promise(async function (resolve) {
|
||||
return new Promise<void>(async function (resolve) {
|
||||
let isReady = false;
|
||||
while (!isReady) {
|
||||
const response = await search(engineName);
|
||||
|
|
|
@ -115,7 +115,7 @@ export const waitFor = async (
|
|||
maxTimeout: number = 5000,
|
||||
timeoutWait: number = 10
|
||||
) => {
|
||||
await new Promise(async (resolve, reject) => {
|
||||
await new Promise<void>(async (resolve, reject) => {
|
||||
let found = false;
|
||||
let numberOfTries = 0;
|
||||
while (!found && numberOfTries < Math.floor(maxTimeout / timeoutWait)) {
|
||||
|
|
|
@ -46,7 +46,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
// JSDOM doesn't support changing of `window.location` and throws an exception if script
|
||||
// tries to do that and we have to workaround this behaviour. We also need to wait until our
|
||||
// script is loaded and executed, __isScriptExecuted__ is used exactly for that.
|
||||
(window as Record<string, any>).__isScriptExecuted__ = new Promise((resolve) => {
|
||||
(window as Record<string, any>).__isScriptExecuted__ = new Promise<void>((resolve) => {
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: {
|
||||
href:
|
||||
|
|
|
@ -66,7 +66,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
|
||||
// Access token expiration is set to 15s for API integration tests.
|
||||
// Let's wait for 20s to make sure token expires.
|
||||
await new Promise((resolve) => setTimeout(() => resolve(), 20000));
|
||||
await new Promise((resolve) => setTimeout(resolve, 20000));
|
||||
|
||||
await supertest
|
||||
.get('/internal/security/me')
|
||||
|
|
|
@ -8,7 +8,7 @@ import request, { Cookie } from 'request';
|
|||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
const delay = (ms: number) => new Promise((resolve) => setTimeout(() => resolve(), ms));
|
||||
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
export default function ({ getService }: FtrProviderContext) {
|
||||
const supertest = getService('supertestWithoutAuth');
|
||||
|
|
|
@ -27828,10 +27828,10 @@ typescript-tuple@^2.2.1:
|
|||
dependencies:
|
||||
typescript-compare "^0.0.2"
|
||||
|
||||
typescript@4.0.2, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.7.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.2.tgz#7ea7c88777c723c681e33bf7988be5d008d05ac2"
|
||||
integrity sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==
|
||||
typescript@4.1.2, typescript@^3.0.3, typescript@^3.2.2, typescript@^3.3.3333, typescript@^3.4.5, typescript@~3.7.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
|
||||
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==
|
||||
|
||||
ua-parser-js@^0.7.18:
|
||||
version "0.7.22"
|
||||
|
|
Loading…
Reference in a new issue