@@ -0,0 +1,44 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': minor
|
||||
---
|
||||
|
||||
**BREAKING**: A number of types and classes have been removed, without a prior deprecation period. These were all very internal, essentially unused by the vast majority of users, and their being exposed was leading to excessive breaking of public interfaces for little-to-zero benefit. So for the 1.0 release of the catalog, the following interface changes have been made (but should have no effect on most users):
|
||||
|
||||
- The return type of `CatalogBuilder.build()` now only has the fields `processingEngine` and `router` which is what most users actually consume; the other three fields (`entitiesCatalog`, `locationAnalyzer`, `locationService`) that see very little use have been removed
|
||||
|
||||
- The function `createRouter` is removed; use `CatalogBuilder` as follows instead:
|
||||
|
||||
```ts
|
||||
const builder = await CatalogBuilder.create(env);
|
||||
// add things as needed, e.g builder.addProcessor(new ScaffolderEntitiesProcessor());
|
||||
const { processingEngine, router } = await builder.build();
|
||||
await processingEngine.start();
|
||||
return router;
|
||||
```
|
||||
|
||||
- The following types were removed:
|
||||
|
||||
- `CatalogProcessingOrchestrator`
|
||||
- `CatalogRule`
|
||||
- `CatalogRulesEnforcer`
|
||||
- `EntityAncestryResponse`
|
||||
- `EntityFacetsRequest`
|
||||
- `EntityFacetsResponse`
|
||||
- `EntityPagination`
|
||||
- `EntityProcessingRequest`
|
||||
- `EntityProcessingResult`
|
||||
- `EntitiesCatalog`
|
||||
- `EntitiesRequest`
|
||||
- `EntitiesResponse`
|
||||
- `LocationService`
|
||||
- `LocationInput`
|
||||
- `LocationStore`
|
||||
- `PageInfo`
|
||||
- `RefreshOptions`
|
||||
- `RefreshService`
|
||||
- `RouterOptions`
|
||||
|
||||
- The following classes were removed:
|
||||
|
||||
- `DefaultCatalogProcessingOrchestrator`
|
||||
- `DefaultCatalogRulesEnforcer`
|
||||
@@ -255,22 +255,6 @@ export type CatalogProcessorResult =
|
||||
| CatalogProcessorRelationResult
|
||||
| CatalogProcessorErrorResult;
|
||||
|
||||
// @public
|
||||
export type CatalogRule = {
|
||||
allow: Array<{
|
||||
kind: string;
|
||||
}>;
|
||||
locations?: Array<{
|
||||
target?: string;
|
||||
type: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type CatalogRulesEnforcer = {
|
||||
isAllowed(entity: Entity, location: LocationSpec): boolean;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export class CodeOwnersProcessor implements CatalogProcessor {
|
||||
constructor(options: {
|
||||
@@ -374,85 +358,18 @@ export type DefaultCatalogCollatorFactoryOptions = {
|
||||
catalogClient?: CatalogApi;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
|
||||
constructor(rules: CatalogRule[]);
|
||||
static readonly defaultRules: CatalogRule[];
|
||||
static fromConfig(config: Config): DefaultCatalogRulesEnforcer;
|
||||
isAllowed(entity: Entity, location: LocationSpec): boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type DeferredEntity = {
|
||||
entity: Entity;
|
||||
locationKey?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EntitiesCatalog = {
|
||||
entities(request?: EntitiesRequest): Promise<EntitiesResponse>;
|
||||
removeEntityByUid(
|
||||
uid: string,
|
||||
options?: {
|
||||
authorizationToken?: string;
|
||||
},
|
||||
): Promise<void>;
|
||||
entityAncestry(
|
||||
entityRef: string,
|
||||
options?: {
|
||||
authorizationToken?: string;
|
||||
},
|
||||
): Promise<EntityAncestryResponse>;
|
||||
facets(request: EntityFacetsRequest): Promise<EntityFacetsResponse>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EntitiesRequest = {
|
||||
filter?: EntityFilter;
|
||||
fields?: (entity: Entity) => Entity;
|
||||
pagination?: EntityPagination;
|
||||
authorizationToken?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EntitiesResponse = {
|
||||
entities: Entity[];
|
||||
pageInfo: PageInfo;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type EntitiesSearchFilter = {
|
||||
key: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EntityAncestryResponse = {
|
||||
rootEntityRef: string;
|
||||
items: Array<{
|
||||
entity: Entity;
|
||||
parentEntityRefs: string[];
|
||||
}>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface EntityFacetsRequest {
|
||||
authorizationToken?: string;
|
||||
facets: string[];
|
||||
filter?: EntityFilter;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface EntityFacetsResponse {
|
||||
facets: Record<
|
||||
string,
|
||||
Array<{
|
||||
value: string;
|
||||
count: number;
|
||||
}>
|
||||
>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type EntityFilter =
|
||||
| {
|
||||
@@ -466,13 +383,6 @@ export type EntityFilter =
|
||||
}
|
||||
| EntitiesSearchFilter;
|
||||
|
||||
// @public
|
||||
export type EntityPagination = {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
after?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface EntityProvider {
|
||||
connect(connection: EntityProviderConnection): Promise<void>;
|
||||
@@ -548,16 +458,6 @@ export type LocationSpec = {
|
||||
presence?: 'optional' | 'required';
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type PageInfo =
|
||||
| {
|
||||
hasNextPage: false;
|
||||
}
|
||||
| {
|
||||
hasNextPage: true;
|
||||
endCursor: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export function parseEntityYaml(
|
||||
data: Buffer,
|
||||
|
||||
@@ -14,15 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type {
|
||||
EntitiesCatalog,
|
||||
EntitiesRequest,
|
||||
EntitiesResponse,
|
||||
EntitiesSearchFilter,
|
||||
EntityAncestryResponse,
|
||||
EntityFacetsRequest,
|
||||
EntityFacetsResponse,
|
||||
EntityFilter,
|
||||
EntityPagination,
|
||||
PageInfo,
|
||||
} from './types';
|
||||
export type { EntitiesSearchFilter, EntityFilter } from './types';
|
||||
|
||||
@@ -31,7 +31,6 @@ export type EntityFilter =
|
||||
|
||||
/**
|
||||
* A pagination rule for entities.
|
||||
* @public
|
||||
*/
|
||||
export type EntityPagination = {
|
||||
limit?: number;
|
||||
@@ -60,7 +59,6 @@ export type EntitiesSearchFilter = {
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type PageInfo =
|
||||
| {
|
||||
hasNextPage: false;
|
||||
@@ -70,7 +68,6 @@ export type PageInfo =
|
||||
endCursor: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type EntitiesRequest = {
|
||||
filter?: EntityFilter;
|
||||
fields?: (entity: Entity) => Entity;
|
||||
@@ -78,13 +75,11 @@ export type EntitiesRequest = {
|
||||
authorizationToken?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type EntitiesResponse = {
|
||||
entities: Entity[];
|
||||
pageInfo: PageInfo;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type EntityAncestryResponse = {
|
||||
rootEntityRef: string;
|
||||
items: Array<{
|
||||
@@ -95,8 +90,6 @@ export type EntityAncestryResponse = {
|
||||
|
||||
/**
|
||||
* The request shape for {@link EntitiesCatalog.facets}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface EntityFacetsRequest {
|
||||
/**
|
||||
@@ -121,8 +114,6 @@ export interface EntityFacetsRequest {
|
||||
|
||||
/**
|
||||
* The response shape for {@link EntitiesCatalog.facets}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface EntityFacetsResponse {
|
||||
/**
|
||||
@@ -131,8 +122,7 @@ export interface EntityFacetsResponse {
|
||||
facets: Record<string, Array<{ value: string; count: number }>>;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export type EntitiesCatalog = {
|
||||
export interface EntitiesCatalog {
|
||||
/**
|
||||
* Fetch entities.
|
||||
*
|
||||
@@ -167,4 +157,4 @@ export type EntitiesCatalog = {
|
||||
* @param request - Request options
|
||||
*/
|
||||
facets(request: EntityFacetsRequest): Promise<EntityFacetsResponse>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ import { LocationSpec } from '../api';
|
||||
* Rules to apply to catalog entities.
|
||||
*
|
||||
* An undefined list of matchers means match all, an empty list of matchers means match none.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type CatalogRule = {
|
||||
allow: Array<{
|
||||
@@ -39,8 +37,6 @@ export type CatalogRule = {
|
||||
/**
|
||||
* Decides whether an entity from a given location is allowed to enter the
|
||||
* catalog, according to some rule set.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type CatalogRulesEnforcer = {
|
||||
isAllowed(entity: Entity, location: LocationSpec): boolean;
|
||||
@@ -49,8 +45,6 @@ export type CatalogRulesEnforcer = {
|
||||
/**
|
||||
* Implements the default catalog rule set, consuming the config keys
|
||||
* `catalog.rules` and `catalog.locations.[].rules`.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
|
||||
/**
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { DefaultCatalogRulesEnforcer } from './CatalogRules';
|
||||
export type { CatalogRule, CatalogRulesEnforcer } from './CatalogRules';
|
||||
export type {
|
||||
AnalyzeLocationEntityField,
|
||||
AnalyzeLocationExistingEntity,
|
||||
|
||||
@@ -21,7 +21,7 @@ import type { Location } from '@backstage/catalog-client';
|
||||
import type { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { EntitiesCatalog } from '../catalog';
|
||||
import { EntitiesCatalog } from '../catalog/types';
|
||||
import { LocationInput, LocationService, RefreshService } from './types';
|
||||
import { basicEntityFilter } from './request';
|
||||
import { createRouter } from './createRouter';
|
||||
|
||||
@@ -22,7 +22,7 @@ import express from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { Logger } from 'winston';
|
||||
import yn from 'yn';
|
||||
import { EntitiesCatalog } from '../catalog';
|
||||
import { EntitiesCatalog } from '../catalog/types';
|
||||
import { LocationAnalyzer } from '../ingestion/types';
|
||||
import {
|
||||
basicEntityFilter,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { EntityPagination } from '../../catalog';
|
||||
import { EntityPagination } from '../../catalog/types';
|
||||
import { parseIntegerParam, parseStringParam } from './common';
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user