Avoid importing core

This commit is contained in:
Erik Larsson
2021-01-27 00:10:19 +01:00
parent 3af90e2f46
commit 7d7fe3d788
2 changed files with 11 additions and 4 deletions
@@ -16,8 +16,11 @@
import { TemplateEntityV1alpha1 } from '@backstage/catalog-model';
import { CatalogClient } from '@backstage/catalog-client';
import { DiscoveryApi } from '@backstage/core';
import { ConflictError, NotFoundError } from '@backstage/backend-common';
import {
ConflictError,
NotFoundError,
PluginEndpointDiscovery,
} from '@backstage/backend-common';
/**
* A catalog client tailored for reading out entity data from the catalog.
@@ -25,7 +28,7 @@ import { ConflictError, NotFoundError } from '@backstage/backend-common';
export class CatalogEntityClient {
private readonly catalogClient: CatalogClient;
constructor(options: { discovery: DiscoveryApi }) {
constructor(options: { discovery: PluginEndpointDiscovery }) {
this.catalogClient = new CatalogClient({
discoveryApi: options.discovery,
});
@@ -15,7 +15,6 @@
*/
import { Config } from '@backstage/config';
import { BackstageIdentity } from '@backstage/core';
import Docker from 'dockerode';
import express from 'express';
import { resolve as resolvePath } from 'path';
@@ -46,6 +45,11 @@ export interface RouterOptions {
entityClient: CatalogEntityClient;
}
// Avoid import of @backstage/core
type BackstageIdentity = {
idToken: string;
};
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {