diff --git a/.changeset/chilled-cameras-change.md b/.changeset/chilled-cameras-change.md new file mode 100644 index 0000000000..8491761594 --- /dev/null +++ b/.changeset/chilled-cameras-change.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-gitlab': patch +--- + +Internal update to use the new cache manager diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index 450bee9063..4a59277e37 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -65,10 +65,15 @@ export type CacheClientOptions = CacheServiceOptions; // @public @deprecated (undocumented) export type CacheClientSetOptions = CacheServiceSetOptions; -// Warning: (ae-forgotten-export) The symbol "CacheManager_2" needs to be exported by the entry point index.d.ts -// // @public @deprecated (undocumented) -export class CacheManager extends CacheManager_2 {} +export class CacheManager { + // (undocumented) + forPlugin(pluginId: string): PluginCacheManager; + static fromConfig( + config: RootConfigService, + options?: CacheManagerOptions, + ): CacheManager; +} // Warning: (ae-forgotten-export) The symbol "CacheManagerOptions_2" needs to be exported by the entry point index.d.ts // @@ -411,10 +416,10 @@ export function makeLegacyPlugin< // @public @deprecated export function notFoundHandler(): RequestHandler; -// Warning: (ae-forgotten-export) The symbol "PluginCacheManager_2" needs to be exported by the entry point index.d.ts -// // @public @deprecated (undocumented) -export type PluginCacheManager = PluginCacheManager_2; +export type PluginCacheManager = { + getClient(options?: CacheServiceOptions): CacheService; +}; // @public @deprecated (undocumented) export type PluginDatabaseManager = DatabaseService; diff --git a/plugins/catalog-backend-module-gitlab/src/GitLabDiscoveryProcessor.ts b/plugins/catalog-backend-module-gitlab/src/GitLabDiscoveryProcessor.ts index 29914db705..01e8018845 100644 --- a/plugins/catalog-backend-module-gitlab/src/GitLabDiscoveryProcessor.ts +++ b/plugins/catalog-backend-module-gitlab/src/GitLabDiscoveryProcessor.ts @@ -27,10 +27,7 @@ import { } from '@backstage/plugin-catalog-node'; import { GitLabClient, GitLabProject, paginated } from './lib'; import { CacheService, LoggerService } from '@backstage/backend-plugin-api'; -import { - CacheManager, - PluginCacheManager, -} from '@backstage/backend-defaults/cache'; +import { CacheManager } from '@backstage/backend-defaults/cache'; /** * Extracts repositories out of an GitLab instance. @@ -64,13 +61,13 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor { private constructor(options: { integrations: ScmIntegrationRegistry; - pluginCache: PluginCacheManager; + pluginCache: CacheService; logger: LoggerService; skipReposWithoutExactFileMatch?: boolean; skipForkedRepos?: boolean; }) { this.integrations = options.integrations; - this.cache = options.pluginCache.getClient(); + this.cache = options.pluginCache; this.logger = options.logger; this.skipReposWithoutExactFileMatch = options.skipReposWithoutExactFileMatch || false; diff --git a/plugins/techdocs-backend/src/service/router.test.ts b/plugins/techdocs-backend/src/service/router.test.ts index 5b5fc52741..631efe06ea 100644 --- a/plugins/techdocs-backend/src/service/router.test.ts +++ b/plugins/techdocs-backend/src/service/router.test.ts @@ -14,7 +14,10 @@ * limitations under the License. */ -import { loggerToWinstonLogger } from '@backstage/backend-common'; +import { + PluginCacheManager, + loggerToWinstonLogger, +} from '@backstage/backend-common'; import { ConfigReader } from '@backstage/config'; import { DocsBuildStrategy, @@ -30,7 +33,6 @@ import { createEventStream, createRouter, RouterOptions } from './router'; import { TechDocsCache } from '../cache'; import { mockErrorHandler, mockServices } from '@backstage/backend-test-utils'; import { DiscoveryService } from '@backstage/backend-plugin-api'; -import { PluginCacheManager } from '@backstage/backend-defaults/cache'; jest.mock('@backstage/catalog-client'); jest.mock('@backstage/config');