Merge pull request #9477 from backstage/freben/catalog-client-1
catalog-client: api cleanup
This commit is contained in:
@@ -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.
|
||||
@@ -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;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user