catalog-client: api cleanup

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-02-11 14:08:44 +01:00
parent 66494da41a
commit 8eda0e7a9c
5 changed files with 25 additions and 15 deletions
+9
View File
@@ -0,0 +1,9 @@
---
'@backstage/catalog-client': minor
---
**BREAKING**: Removed the explicit `DiscoveryApi` and `FetchApi` export symbols,
which were unnecessary duplicates from the well known core ones.
The `CATALOG_FILTER_EXISTS` symbol's value has changed. However, this should not
affect any code in practice.
+8 -11
View File
@@ -71,7 +71,14 @@ export interface CatalogApi {
// @public
export class CatalogClient implements CatalogApi {
constructor(options: { discoveryApi: DiscoveryApi; fetchApi?: FetchApi });
constructor(options: {
discoveryApi: {
getBaseUrl(pluginId: string): Promise<string>;
};
fetchApi?: {
fetch: typeof fetch;
};
});
addLocation(
{ type, target, dryRun, presence }: AddLocationRequest,
options?: CatalogRequestOptions,
@@ -150,17 +157,7 @@ export type CatalogRequestOptions = {
token?: string;
};
// @public
export type DiscoveryApi = {
getBaseUrl(pluginId: string): Promise<string>;
};
// @public
export const ENTITY_STATUS_CATALOG_PROCESSING_TYPE =
'backstage.io/catalog-processing';
// @public
export type FetchApi = {
fetch: typeof fetch;
};
```
+4 -1
View File
@@ -49,7 +49,10 @@ export class CatalogClient implements CatalogApi {
private readonly discoveryApi: DiscoveryApi;
private readonly fetchApi: FetchApi;
constructor(options: { discoveryApi: DiscoveryApi; fetchApi?: FetchApi }) {
constructor(options: {
discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };
fetchApi?: { fetch: typeof fetch };
}) {
this.discoveryApi = options.discoveryApi;
this.fetchApi = options.fetchApi || { fetch: crossFetch };
}
+4 -1
View File
@@ -21,7 +21,10 @@ import { Entity, EntityName, Location } from '@backstage/catalog-model';
*
* @public
*/
export const CATALOG_FILTER_EXISTS = Symbol('CATALOG_FILTER_EXISTS');
export const CATALOG_FILTER_EXISTS = Symbol.for(
// Random UUID to ensure no collisions
'CATALOG_FILTER_EXISTS_0e15b590c0b343a2bae3e787e84c2111',
);
/**
* A request type for retrieving catalog Entities.
@@ -24,7 +24,5 @@ export type {
CatalogEntityAncestorsRequest,
CatalogEntityAncestorsResponse,
} from './api';
export type { DiscoveryApi } from './discovery';
export type { FetchApi } from './fetch';
export { CATALOG_FILTER_EXISTS } from './api';
export { ENTITY_STATUS_CATALOG_PROCESSING_TYPE } from './status';