diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts index 129e92cc0e..1e96c13dc5 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts @@ -24,7 +24,6 @@ import { DateTime } from 'luxon'; import { applyDatabaseMigrations } from './migrations'; import { DefaultProcessingDatabase } from './DefaultProcessingDatabase'; import { - DbRefreshKeysRow, DbRefreshStateReferencesRow, DbRefreshStateRow, DbRelationsRow, @@ -68,10 +67,6 @@ describe('Default Processing Database', () => { await db('refresh_state').insert(ref); }; - const insertRefreshKeysRow = async (db: Knex, ref: DbRefreshKeysRow) => { - await db('refresh_keys').insert(ref); - }; - describe('updateProcessedEntity', () => { let id: string; let processedEntity: Entity; @@ -103,6 +98,7 @@ describe('Default Processing Database', () => { resultHash: '', relations: [], deferredEntities: [], + refreshKeys: [], }), ).rejects.toThrow( `Conflicting write of processing result for ${id} with location key 'undefined'`, @@ -122,6 +118,7 @@ describe('Default Processing Database', () => { relations: [], deferredEntities: [], locationKey: 'key', + refreshKeys: [], errors: "['something broke']", }; const { knex, db } = await createDatabase(databaseId); @@ -148,6 +145,7 @@ describe('Default Processing Database', () => { ...options, resultHash: '', locationKey: 'fail', + refreshKeys: [], }), ).rejects.toThrow( `Conflicting write of processing result for ${id} with location key 'fail'`, @@ -179,6 +177,7 @@ describe('Default Processing Database', () => { relations: [], deferredEntities: [], locationKey: 'key', + refreshKeys: [], errors: "['something broke']", }), ); @@ -233,6 +232,7 @@ describe('Default Processing Database', () => { resultHash: '', relations: relations, deferredEntities: [], + refreshKeys: [], }), ); @@ -255,6 +255,7 @@ describe('Default Processing Database', () => { resultHash: '', relations: relations, deferredEntities: [], + refreshKeys: [], }), ); @@ -314,6 +315,7 @@ describe('Default Processing Database', () => { resultHash: '', relations: [], deferredEntities, + refreshKeys: [], }), ); @@ -405,6 +407,7 @@ describe('Default Processing Database', () => { processedEntity, resultHash: '', relations: [], + refreshKeys: [], deferredEntities: [ { entity: { @@ -1402,55 +1405,4 @@ describe('Default Processing Database', () => { }, ); }); - - describe('setRefreshKeys', () => { - it.each(databases.eachSupportedId())( - 'should set keys, %p', - async databaseId => { - const { knex, db } = await createDatabase(databaseId); - - await db.transaction(async tx => - db.setRefreshKeys(tx, { - refreshKeys: [{ entityRef: 'location:default/root-1', key: 'foo' }], - }), - ); - - const rows = await knex('refresh_keys').select(); - - expect(rows.length).toBe(1); - expect(rows[0]).toEqual({ - entity_ref: 'location:default/root-1', - key: 'foo', - }); - }, - ); - }); - - describe('deleteRefreshKeys', () => { - it.each(databases.eachSupportedId())( - 'should delete keys, %p', - async databaseId => { - const { knex, db } = await createDatabase(databaseId); - - await insertRefreshKeysRow(knex, { - entity_ref: 'location:default/root-1', - key: 'foo', - }); - - let rows = await knex('refresh_keys').select(); - - expect(rows.length).toBe(1); - - await db.transaction(async tx => - db.deleteRefreshKey(tx, { - key: 'foo', - }), - ); - - rows = await knex('refresh_keys').select(); - - expect(rows.length).toBe(0); - }, - ); - }); }); diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts index de8d18aad6..11b723a117 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts @@ -33,7 +33,6 @@ import { UpdateEntityCacheOptions, ListParentsOptions, ListParentsResult, - RefreshKeyOptions, RefreshByKeyOptions, } from './types'; import { DeferredEntity } from '../processing/types'; diff --git a/plugins/catalog-backend/src/modules/core/FileReaderProcessor.ts b/plugins/catalog-backend/src/modules/core/FileReaderProcessor.ts index 1763a17acb..59795589b2 100644 --- a/plugins/catalog-backend/src/modules/core/FileReaderProcessor.ts +++ b/plugins/catalog-backend/src/modules/core/FileReaderProcessor.ts @@ -25,7 +25,6 @@ import { LocationSpec, processingResult, } from '../../api'; -import { stringifyEntityRef } from '@backstage/catalog-model'; const glob = promisify(g); diff --git a/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts b/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts index 5b6ed31f4d..8a1891fe0c 100644 --- a/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts +++ b/plugins/catalog-backend/src/modules/core/PlaceholderProcessor.ts @@ -15,7 +15,7 @@ */ import { UrlReader } from '@backstage/backend-common'; -import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; +import { Entity } from '@backstage/catalog-model'; import { JsonValue } from '@backstage/types'; import { ScmIntegrationRegistry } from '@backstage/integration'; import yaml from 'yaml'; diff --git a/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts b/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts index 61bb8fed99..7b62690341 100644 --- a/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts +++ b/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts @@ -15,7 +15,7 @@ */ import { UrlReader } from '@backstage/backend-common'; -import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; +import { Entity } from '@backstage/catalog-model'; import { assertError } from '@backstage/errors'; import parseGitUrl from 'git-url-parse'; import limiterFactory from 'p-limit'; @@ -30,7 +30,6 @@ import { LocationSpec, processingResult, } from '../../api'; -import { locationSpecToLocationEntity } from '../../util'; const CACHE_KEY = 'v1'; diff --git a/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts b/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts index 56988569cf..033dfd4ae3 100644 --- a/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts +++ b/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts @@ -119,7 +119,7 @@ export class ProcessorOutputCollector { } else if (i.type === 'error') { this.errors.push(i.error); } else if (i.type === 'refresh') { - this.refreshKeys.push({ key: i.key, entityRef: i.entityRef }); + this.refreshKeys.push({ key: i.key }); } } }