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