From 8511effd11a21294a0418b7c59e15ca673973601 Mon Sep 17 00:00:00 2001 From: Julia Bardi Date: Thu, 23 Sep 2021 09:51:49 +0200 Subject: [PATCH] fixed type errors --- .../plugins/fleet/server/services/epm/packages/cleanup.ts | 8 +++++--- x-pack/plugins/fleet/server/services/package_policy.ts | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/fleet/server/services/epm/packages/cleanup.ts b/x-pack/plugins/fleet/server/services/epm/packages/cleanup.ts index bf48f207589a8..92daa79607021 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/cleanup.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/cleanup.ts @@ -25,15 +25,17 @@ export async function removeOldAssets(options: { const aggs = { versions: { terms: { field: `${ASSETS_SAVED_OBJECT_TYPE}.attributes.package_version` } }, }; - const oldVersionsAgg = (await savedObjectsClient.find({ + const oldVersionsAgg = await savedObjectsClient.find({ type: ASSETS_SAVED_OBJECT_TYPE, filter: `${ASSETS_SAVED_OBJECT_TYPE}.attributes.package_name:${pkgName} AND ${ASSETS_SAVED_OBJECT_TYPE}.attributes.package_version<${currentVersion}`, aggs, page: 0, perPage: 0, - })) as any; + }); - const oldVersions = oldVersionsAgg.aggregations.versions.buckets.map((obj) => obj.key); + const oldVersions = oldVersionsAgg.aggregations.versions.buckets.map( + (obj: { key: string }) => obj.key + ); for (const oldVersion of oldVersions) { await removeAssetsFromVersion(savedObjectsClient, pkgName, oldVersion); diff --git a/x-pack/plugins/fleet/server/services/package_policy.ts b/x-pack/plugins/fleet/server/services/package_policy.ts index 45d2f9da1eacf..638cd465e3b9e 100644 --- a/x-pack/plugins/fleet/server/services/package_policy.ts +++ b/x-pack/plugins/fleet/server/services/package_policy.ts @@ -291,8 +291,6 @@ class PackagePolicyService { })); } - i = 0; - public async list( soClient: SavedObjectsClientContract, options: ListWithKuery