catalog-backend: Reduce public API surface
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
f4feba8326
commit
6ee137693f
@@ -14,11 +14,8 @@ import { Config } from '@backstage/config';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityPolicy } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
import { GetEntitiesRequest } from '@backstage/catalog-client';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { Location as Location_2 } from '@backstage/catalog-client';
|
||||
import { Logger } from 'winston';
|
||||
import { Permission } from '@backstage/plugin-permission-common';
|
||||
import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
|
||||
@@ -121,10 +118,7 @@ export class CatalogBuilder {
|
||||
): void;
|
||||
addProcessor(...processors: CatalogProcessor[]): CatalogBuilder;
|
||||
build(): Promise<{
|
||||
entitiesCatalog: EntitiesCatalog;
|
||||
locationAnalyzer: LocationAnalyzer;
|
||||
processingEngine: CatalogProcessingEngine;
|
||||
locationService: LocationService;
|
||||
router: Router;
|
||||
}>;
|
||||
static create(env: CatalogEnvironment): CatalogBuilder;
|
||||
@@ -187,12 +181,6 @@ export interface CatalogProcessingEngine {
|
||||
stop(): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CatalogProcessingOrchestrator {
|
||||
// (undocumented)
|
||||
process(request: EntityProcessingRequest): Promise<EntityProcessingResult>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogProcessor = {
|
||||
getProcessorName(): string;
|
||||
@@ -320,9 +308,6 @@ export function createRandomProcessingInterval(options: {
|
||||
maxSeconds: number;
|
||||
}): ProcessingIntervalFunction;
|
||||
|
||||
// @public
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export class DefaultCatalogCollator {
|
||||
constructor(options: {
|
||||
@@ -389,22 +374,6 @@ export type DefaultCatalogCollatorFactoryOptions = {
|
||||
catalogClient?: CatalogApi;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export class DefaultCatalogProcessingOrchestrator
|
||||
implements CatalogProcessingOrchestrator
|
||||
{
|
||||
constructor(options: {
|
||||
processors: CatalogProcessor[];
|
||||
integrations: ScmIntegrationRegistry;
|
||||
logger: Logger;
|
||||
parser: CatalogProcessorParser;
|
||||
policy: EntityPolicy;
|
||||
rulesEnforcer: CatalogRulesEnforcer;
|
||||
});
|
||||
// (undocumented)
|
||||
process(request: EntityProcessingRequest): Promise<EntityProcessingResult>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
|
||||
constructor(rules: CatalogRule[]);
|
||||
@@ -504,27 +473,6 @@ export type EntityPagination = {
|
||||
after?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type EntityProcessingRequest = {
|
||||
entity: Entity;
|
||||
state?: JsonObject;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type EntityProcessingResult =
|
||||
| {
|
||||
ok: true;
|
||||
state: JsonObject;
|
||||
completedEntity: Entity;
|
||||
deferredEntities: DeferredEntity[];
|
||||
relations: EntityRelationSpec[];
|
||||
errors: Error[];
|
||||
}
|
||||
| {
|
||||
ok: false;
|
||||
errors: Error[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface EntityProvider {
|
||||
connect(connection: EntityProviderConnection): Promise<void>;
|
||||
@@ -593,48 +541,6 @@ export type LocationEntityProcessorOptions = {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface LocationInput {
|
||||
// (undocumented)
|
||||
target: string;
|
||||
// (undocumented)
|
||||
type: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface LocationService {
|
||||
// (undocumented)
|
||||
createLocation(
|
||||
location: LocationInput,
|
||||
dryRun: boolean,
|
||||
options?: {
|
||||
authorizationToken?: string;
|
||||
},
|
||||
): Promise<{
|
||||
location: Location_2;
|
||||
entities: Entity[];
|
||||
exists?: boolean;
|
||||
}>;
|
||||
// (undocumented)
|
||||
deleteLocation(
|
||||
id: string,
|
||||
options?: {
|
||||
authorizationToken?: string;
|
||||
},
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
getLocation(
|
||||
id: string,
|
||||
options?: {
|
||||
authorizationToken?: string;
|
||||
},
|
||||
): Promise<Location_2>;
|
||||
// (undocumented)
|
||||
listLocations(options?: {
|
||||
authorizationToken?: string;
|
||||
}): Promise<Location_2[]>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type LocationSpec = {
|
||||
type: string;
|
||||
@@ -642,18 +548,6 @@ export type LocationSpec = {
|
||||
presence?: 'optional' | 'required';
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface LocationStore {
|
||||
// (undocumented)
|
||||
createLocation(location: LocationInput): Promise<Location_2>;
|
||||
// (undocumented)
|
||||
deleteLocation(id: string): Promise<void>;
|
||||
// (undocumented)
|
||||
getLocation(id: string): Promise<Location_2>;
|
||||
// (undocumented)
|
||||
listLocations(): Promise<Location_2[]>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type PageInfo =
|
||||
| {
|
||||
@@ -760,35 +654,6 @@ export const processingResult: Readonly<{
|
||||
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
||||
}>;
|
||||
|
||||
// @public
|
||||
export type RefreshOptions = {
|
||||
entityRef: string;
|
||||
authorizationToken?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface RefreshService {
|
||||
refresh(options: RefreshOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
// (undocumented)
|
||||
entitiesCatalog?: EntitiesCatalog;
|
||||
// (undocumented)
|
||||
locationAnalyzer?: LocationAnalyzer;
|
||||
// (undocumented)
|
||||
locationService: LocationService;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
// (undocumented)
|
||||
permissionIntegrationRouter?: express.Router;
|
||||
// (undocumented)
|
||||
refreshService?: RefreshService;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export class UrlReaderProcessor implements CatalogProcessor {
|
||||
constructor(options: { reader: UrlReader; logger: Logger });
|
||||
|
||||
@@ -22,7 +22,7 @@ import { DbLocationsRow } from '../../database/tables';
|
||||
import { getEntityLocationRef } from '../../processing/util';
|
||||
import { EntityProvider, EntityProviderConnection } from '../../api';
|
||||
import { locationSpecToLocationEntity } from '../../util/conversion';
|
||||
import { LocationInput, LocationStore } from '../../service';
|
||||
import { LocationInput, LocationStore } from '../../service/types';
|
||||
|
||||
export class DefaultLocationStore implements LocationStore, EntityProvider {
|
||||
private _connection: EntityProviderConnection | undefined;
|
||||
|
||||
@@ -14,14 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type {
|
||||
CatalogProcessingOrchestrator,
|
||||
CatalogProcessingEngine,
|
||||
EntityProcessingRequest,
|
||||
EntityProcessingResult,
|
||||
DeferredEntity,
|
||||
} from './types';
|
||||
export { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator';
|
||||
export type { CatalogProcessingEngine, DeferredEntity } from './types';
|
||||
|
||||
export { createRandomProcessingInterval } from './refresh';
|
||||
export type { ProcessingIntervalFunction } from './refresh';
|
||||
|
||||
@@ -32,7 +32,7 @@ import { ScmIntegrations } from '@backstage/integration';
|
||||
import { createHash } from 'crypto';
|
||||
import { Router } from 'express';
|
||||
import lodash, { keyBy } from 'lodash';
|
||||
import { EntitiesCatalog, EntitiesSearchFilter } from '../catalog';
|
||||
import { EntitiesSearchFilter } from '../catalog';
|
||||
|
||||
import {
|
||||
CatalogProcessor,
|
||||
@@ -76,7 +76,6 @@ import { AuthorizedRefreshService } from './AuthorizedRefreshService';
|
||||
import { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules';
|
||||
import { Config } from '@backstage/config';
|
||||
import { Logger } from 'winston';
|
||||
import { LocationService } from './types';
|
||||
import { connectEntityProviders } from '../processing/connectEntityProviders';
|
||||
import { permissionRules as catalogPermissionRules } from '../permissions/rules';
|
||||
import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
|
||||
@@ -355,10 +354,7 @@ export class CatalogBuilder {
|
||||
* Wires up and returns all of the component parts of the catalog
|
||||
*/
|
||||
async build(): Promise<{
|
||||
entitiesCatalog: EntitiesCatalog;
|
||||
locationAnalyzer: LocationAnalyzer;
|
||||
processingEngine: CatalogProcessingEngine;
|
||||
locationService: LocationService;
|
||||
router: Router;
|
||||
}> {
|
||||
const { config, database, logger, permissions } = this.env;
|
||||
@@ -460,10 +456,7 @@ export class CatalogBuilder {
|
||||
await connectEntityProviders(processingDatabase, entityProviders);
|
||||
|
||||
return {
|
||||
entitiesCatalog,
|
||||
locationAnalyzer,
|
||||
processingEngine,
|
||||
locationService,
|
||||
router,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,14 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type {
|
||||
LocationService,
|
||||
RefreshService,
|
||||
RefreshOptions,
|
||||
LocationStore,
|
||||
LocationInput,
|
||||
} from './types';
|
||||
export { createRouter } from './createRouter';
|
||||
export type { RouterOptions } from './createRouter';
|
||||
export type { CatalogEnvironment } from './CatalogBuilder';
|
||||
export { CatalogBuilder } from './CatalogBuilder';
|
||||
|
||||
Reference in New Issue
Block a user