diff --git a/plugins/catalog-node/src/alpha.ts b/plugins/catalog-node/src/alpha.ts index 159b642e52..63b817fbb3 100644 --- a/plugins/catalog-node/src/alpha.ts +++ b/plugins/catalog-node/src/alpha.ts @@ -14,19 +14,31 @@ * limitations under the License. */ -import { ServiceRef } from '@backstage/backend-plugin-api'; +import { + coreServices, + createServiceFactory, + createServiceRef, +} from '@backstage/backend-plugin-api'; import { catalogServiceRef as _catalogServiceRef } from './catalogService'; -import { CatalogApi } from '@backstage/catalog-client'; +import { CatalogApi, CatalogClient } from '@backstage/catalog-client'; /** * @alpha * @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead */ -export const catalogServiceRef = _catalogServiceRef as ServiceRef< - CatalogApi, - 'plugin', - 'singleton' ->; +export const catalogServiceRef = createServiceRef({ + id: 'catalog-client', + defaultFactory: async service => + createServiceFactory({ + service, + deps: { + discoveryApi: coreServices.discovery, + }, + async factory({ discoveryApi }) { + return new CatalogClient({ discoveryApi }); + }, + }), +}); export type { CatalogLocationsExtensionPoint } from './extensions'; export { catalogLocationsExtensionPoint } from './extensions';