chore: updating some smaller code refactor, and updating api-report

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-02-16 17:05:04 +01:00
parent b6925bb66d
commit d93ac29500
3 changed files with 5 additions and 18 deletions
-14
View File
@@ -29,7 +29,6 @@ import { SpawnOptionsWithoutStdio } from 'child_process';
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
import { TaskSpecV1beta2 } from '@backstage/plugin-scaffolder-common';
import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
import { TemplateEntityV1beta2 } from '@backstage/plugin-scaffolder-common';
import { TemplateMetadata } from '@backstage/plugin-scaffolder-common';
import { UrlReader } from '@backstage/backend-common';
import { Writable } from 'stream';
@@ -50,19 +49,6 @@ export type ActionContext<Input extends JsonObject> = {
metadata?: TemplateMetadata;
};
// Warning: (ae-missing-release-tag) "CatalogEntityClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export class CatalogEntityClient {
constructor(catalogClient: CatalogApi);
findTemplate(
templateName: string,
options?: {
token?: string;
},
): Promise<TemplateEntityV1beta2>;
}
// @public
export type CompletedTaskState = 'failed' | 'completed';
@@ -88,7 +88,7 @@ export function getEntityBaseUrl(entity: Entity): string | undefined {
/**
* Will use the provided CatalogApi to go find the template entity ref that is provided with and additional token
* Returns the first matching template
* Returns the first matching template, throws a NotFoundError or ConflictError if 0 or multiple templates are found.
*/
export async function findTemplate({
entityRef,
@@ -99,7 +99,10 @@ export async function findTemplate({
token?: string;
catalogApi: CatalogApi;
}): Promise<TemplateEntityV1beta3 | TemplateEntityV1beta2> {
const parsedEntityRef = parseEntityRef(entityRef);
const parsedEntityRef = parseEntityRef(entityRef, {
defaultKind: 'template',
defaultNamespace: 'default',
});
const { items } = await catalogApi.getEntities(
{
filter: {
@@ -191,8 +191,6 @@ export async function createRouter(
const template = await findTemplate({
catalogApi: catalogClient,
entityRef: {
kind: 'template',
namespace: 'default',
name: templateName,
},
token: getBearerToken(req.headers.authorization),