Skip to content

Commit dfb9627

Browse files
committed
fix typecheck errors
1 parent 0e61d00 commit dfb9627

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

x-pack/plugins/security_solution/common/endpoint/index_data.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ const fleetEnrollAgentForHost = async (
350350

351351
if (res) {
352352
const enrollObj: PostAgentEnrollResponse = await res.json();
353-
if (!enrollObj.success) {
353+
if (!res.ok) {
354354
// eslint-disable-next-line no-console
355355
console.error(enrollObj);
356356
return;
@@ -396,7 +396,7 @@ const fleetEnrollAgentForHost = async (
396396
}
397397

398398
const checkinObj: PostAgentCheckinResponse = await checkinRes.json();
399-
if (!checkinObj.success) {
399+
if (!checkinRes.ok) {
400400
// eslint-disable-next-line no-console
401401
console.error(
402402
`failed to checkin agent [${enrollObj.item.id}] for endpoint [${endpointHost.host.id}]`
@@ -438,7 +438,7 @@ const fleetEnrollAgentForHost = async (
438438
);
439439

440440
const ackActionObj: PostAgentAcksResponse = await ackActionResp.json();
441-
if (!ackActionObj.success) {
441+
if (!ackActionResp.ok) {
442442
// eslint-disable-next-line no-console
443443
console.error(
444444
`failed to ACK Actions provided to agent [${enrollObj.item.id}] for endpoint [${endpointHost.host.id}]`

x-pack/plugins/security_solution/scripts/endpoint/resolver_generator_script.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ResponseError } from '@elastic/elasticsearch/lib/errors';
1010
import { KbnClient, ToolingLog } from '@kbn/dev-utils';
1111
import { AxiosResponse } from 'axios';
1212
import { KibanaConfig } from '@kbn/dev-utils/target/kbn_client/kbn_client_requester';
13-
import fetch from 'node-fetch';
13+
import fetch, { RequestInit as FetchRequestInit } from 'node-fetch';
1414
import { indexHostsAndAlerts } from '../../common/endpoint/index_data';
1515
import { ANCESTRY_LIMIT } from '../../common/endpoint/generate_data';
1616
import { FLEET_SETUP_API_ROUTES, SETUP_API_ROUTE } from '../../../ingest_manager/common/constants';
@@ -29,8 +29,11 @@ class KbnClientWithApiKeySupport extends KbnClient {
2929
// strip auth from url
3030
this.kibanaUrlNoAuth = matches && matches.length === 3 ? matches[1] + matches[3] : kibanaUrl;
3131
}
32-
requestWithApiKey(path: string, init?: RequestInit | undefined) {
33-
return fetch(`${this.kibanaUrlNoAuth}/${path}`, init);
32+
requestWithApiKey(path: string, init?: RequestInit | undefined): Promise<Response> {
33+
return (fetch(
34+
`${this.kibanaUrlNoAuth}/${path}`,
35+
init as FetchRequestInit
36+
) as unknown) as Promise<Response>;
3437
}
3538
}
3639

0 commit comments

Comments
 (0)