feat(catalog): update dependent plugins; generate api reports

Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
Benjamin Janssens
2025-07-07 14:27:11 +02:00
parent 6b608e77bf
commit 3f4da3910d
11 changed files with 78 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-react': minor
---
Added the analyzeLocation method to catalogApiMock
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-node': minor
---
Added the analyze-location endpoint to the CatalogService
@@ -5,6 +5,8 @@
```ts
import { AddLocationRequest } from '@backstage/catalog-client';
import { AddLocationResponse } from '@backstage/catalog-client';
import type { AnalyzeLocationRequest } from '@backstage/plugin-catalog-common';
import type { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';
import { CatalogApi } from '@backstage/catalog-client';
import { CompoundEntityRef } from '@backstage/catalog-model';
import { Entity } from '@backstage/catalog-model';
@@ -28,6 +30,10 @@ export class InMemoryCatalogClient implements CatalogApi {
// (undocumented)
addLocation(_location: AddLocationRequest): Promise<AddLocationResponse>;
// (undocumented)
analyzeLocation(
_location: AnalyzeLocationRequest,
): Promise<AnalyzeLocationResponse>;
// (undocumented)
getEntities(request?: GetEntitiesRequest): Promise<GetEntitiesResponse>;
// (undocumented)
getEntitiesByRefs(
+10
View File
@@ -3,6 +3,8 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import type { AnalyzeLocationRequest } from '@backstage/plugin-catalog-common';
import type { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';
import { CompoundEntityRef } from '@backstage/catalog-model';
import { Entity } from '@backstage/catalog-model';
import { SerializedError } from '@backstage/errors';
@@ -30,6 +32,10 @@ export interface CatalogApi {
location: AddLocationRequest,
options?: CatalogRequestOptions,
): Promise<AddLocationResponse>;
analyzeLocation(
location: AnalyzeLocationRequest,
options?: CatalogRequestOptions,
): Promise<AnalyzeLocationResponse>;
getEntities(
request?: GetEntitiesRequest,
options?: CatalogRequestOptions,
@@ -103,6 +109,10 @@ export class CatalogClient implements CatalogApi {
request: AddLocationRequest,
options?: CatalogRequestOptions,
): Promise<AddLocationResponse>;
analyzeLocation(
request: AnalyzeLocationRequest,
options?: CatalogRequestOptions,
): Promise<AnalyzeLocationResponse>;
getEntities(
request?: GetEntitiesRequest,
options?: CatalogRequestOptions,
@@ -44,6 +44,10 @@ import {
import { NotFoundError, NotImplementedError } from '@backstage/errors';
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
import { traverse } from '../../../../plugins/catalog-backend/src/database/operations/stitcher/buildEntitySearch';
import type {
AnalyzeLocationRequest,
AnalyzeLocationResponse,
} from '@backstage/plugin-catalog-common';
function buildEntitySearch(entity: Entity) {
const rows = traverse(entity);
@@ -269,6 +273,12 @@ export class InMemoryCatalogClient implements CatalogApi {
throw new NotImplementedError('Method not implemented.');
}
async analyzeLocation(
_location: AnalyzeLocationRequest,
): Promise<AnalyzeLocationResponse> {
throw new NotImplementedError('Method not implemented.');
}
#createEntityRefMap() {
return new Map(this.#entities.map(e => [stringifyEntityRef(e), e]));
}
@@ -5,6 +5,8 @@
```ts
import { AddLocationRequest } from '@backstage/catalog-client';
import { AddLocationResponse } from '@backstage/catalog-client';
import { AnalyzeLocationRequest } from '@backstage/plugin-catalog-common';
import { AnalyzeLocationResponse } from '@backstage/plugin-catalog-common';
import { CatalogApi } from '@backstage/catalog-client';
import { CatalogRequestOptions } from '@backstage/catalog-client';
import { CatalogService } from '@backstage/plugin-catalog-node';
@@ -35,6 +37,11 @@ export interface CatalogServiceMock extends CatalogService, CatalogApi {
options?: CatalogServiceRequestOptions | CatalogRequestOptions,
): Promise<AddLocationResponse>;
// (undocumented)
analyzeLocation(
location: AnalyzeLocationRequest,
options?: CatalogServiceRequestOptions | CatalogRequestOptions,
): Promise<AnalyzeLocationResponse>;
// (undocumented)
getEntities(
request?: GetEntitiesRequest,
options?: CatalogServiceRequestOptions | CatalogRequestOptions,
+5
View File
@@ -125,6 +125,11 @@ export interface CatalogService {
options: CatalogServiceRequestOptions,
): Promise<AddLocationResponse>;
// (undocumented)
analyzeLocation(
location: AnalyzeLocationRequest,
options: CatalogServiceRequestOptions,
): Promise<AnalyzeLocationResponse>;
// (undocumented)
getEntities(
request: GetEntitiesRequest | undefined,
options: CatalogServiceRequestOptions,
@@ -42,6 +42,10 @@ import {
ValidateEntityResponse,
} from '@backstage/catalog-client';
import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
import {
AnalyzeLocationRequest,
AnalyzeLocationResponse,
} from '@backstage/plugin-catalog-common';
/**
* @public
@@ -132,6 +136,11 @@ export interface CatalogService {
locationRef: string,
options: CatalogServiceRequestOptions,
): Promise<ValidateEntityResponse>;
analyzeLocation(
location: AnalyzeLocationRequest,
options: CatalogServiceRequestOptions,
): Promise<AnalyzeLocationResponse>;
}
class DefaultCatalogService implements CatalogService {
@@ -301,6 +310,16 @@ class DefaultCatalogService implements CatalogService {
);
}
async analyzeLocation(
location: AnalyzeLocationRequest,
options: CatalogServiceRequestOptions,
): Promise<AnalyzeLocationResponse> {
return this.#catalogApi.analyzeLocation(
location,
await this.#getOptions(options),
);
}
async #getOptions(
options: CatalogServiceRequestOptions,
): Promise<CatalogRequestOptions> {
@@ -102,5 +102,6 @@ export namespace catalogServiceMock {
removeLocationById: jest.fn(),
getLocationByEntity: jest.fn(),
validateEntity: jest.fn(),
analyzeLocation: jest.fn(),
}));
}
@@ -34,6 +34,10 @@ import {
ValidateEntityResponse,
} from '@backstage/catalog-client';
import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
import {
AnalyzeLocationRequest,
AnalyzeLocationResponse,
} from '@backstage/plugin-catalog-common';
import {
CatalogService,
CatalogServiceRequestOptions,
@@ -126,4 +130,9 @@ export interface CatalogServiceMock extends CatalogService, CatalogApi {
locationRef: string,
options?: CatalogServiceRequestOptions | CatalogRequestOptions,
): Promise<ValidateEntityResponse>;
analyzeLocation(
location: AnalyzeLocationRequest,
options?: CatalogServiceRequestOptions | CatalogRequestOptions,
): Promise<AnalyzeLocationResponse>;
}
@@ -101,5 +101,6 @@ export namespace catalogApiMock {
removeLocationById: jest.fn(),
getLocationByEntity: jest.fn(),
validateEntity: jest.fn(),
analyzeLocation: jest.fn(),
}));
}