catalog-backend: export and rename refreshOptions
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com> Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -27,6 +27,7 @@ import { Organizations } from 'aws-sdk';
|
||||
import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { ResourceEntityV1alpha1 } from '@backstage/catalog-model';
|
||||
import { Router } from 'express';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
@@ -269,12 +270,19 @@ export type CatalogEnvironment = {
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface CatalogProcessingEngine {
|
||||
// (undocumented)
|
||||
refresh(options: CatalogProcessingEngineRefreshOptions): Promise<void>;
|
||||
// (undocumented)
|
||||
start(): Promise<void>;
|
||||
// (undocumented)
|
||||
stop(): Promise<void>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogProcessingEngineRefreshOptions = {
|
||||
entityRef: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "CatalogProcessingOrchestrator" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -1194,6 +1202,7 @@ export class NextCatalogBuilder {
|
||||
locationAnalyzer: LocationAnalyzer;
|
||||
processingEngine: CatalogProcessingEngine;
|
||||
locationService: LocationService;
|
||||
router: Router;
|
||||
}>;
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
replaceEntityPolicies(policies: EntityPolicy[]): NextCatalogBuilder;
|
||||
@@ -1229,6 +1238,8 @@ export interface NextRouterOptions {
|
||||
locationService: LocationService;
|
||||
// (undocumented)
|
||||
logger: Logger_2;
|
||||
// (undocumented)
|
||||
processingEngine?: CatalogProcessingEngine;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "notFoundError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
@@ -1384,6 +1395,8 @@ export interface RouterOptions {
|
||||
locationService?: LocationService;
|
||||
// (undocumented)
|
||||
logger: Logger_2;
|
||||
// (undocumented)
|
||||
processingEngine?: CatalogProcessingEngine;
|
||||
}
|
||||
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
|
||||
@@ -36,7 +36,7 @@ import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
EntityProviderMutation,
|
||||
EntityRefreshOptions,
|
||||
CatalogProcessingEngineRefreshOptions,
|
||||
} from './types';
|
||||
|
||||
class Connection implements EntityProviderConnection {
|
||||
@@ -240,7 +240,7 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine {
|
||||
}
|
||||
}
|
||||
|
||||
async refresh(options: EntityRefreshOptions) {
|
||||
async refresh(options: CatalogProcessingEngineRefreshOptions) {
|
||||
await this.processingDatabase.transaction(async tx => {
|
||||
const { entityRefs } = await this.processingDatabase.listAncestors(tx, {
|
||||
entityRef: options.entityRef,
|
||||
|
||||
@@ -37,7 +37,7 @@ import { disallowReadonlyMode, validateRequestBody } from '../service/util';
|
||||
import {
|
||||
CatalogProcessingEngine,
|
||||
LocationService,
|
||||
EntityRefreshOptions,
|
||||
CatalogProcessingEngineRefreshOptions,
|
||||
} from './types';
|
||||
|
||||
export interface NextRouterOptions {
|
||||
@@ -72,7 +72,7 @@ export async function createNextRouter(
|
||||
|
||||
if (processingEngine) {
|
||||
router.post('/refresh', async (req, res) => {
|
||||
const refreshOptions: EntityRefreshOptions = req.body;
|
||||
const refreshOptions: CatalogProcessingEngineRefreshOptions = req.body;
|
||||
await processingEngine.refresh(refreshOptions);
|
||||
res.status(200).send();
|
||||
});
|
||||
|
||||
@@ -28,4 +28,5 @@ export type {
|
||||
CatalogProcessingEngine,
|
||||
LocationService,
|
||||
LocationStore,
|
||||
CatalogProcessingEngineRefreshOptions,
|
||||
} from './types';
|
||||
|
||||
@@ -37,10 +37,11 @@ export interface LocationStore {
|
||||
export interface CatalogProcessingEngine {
|
||||
start(): Promise<void>;
|
||||
stop(): Promise<void>;
|
||||
refresh(options: EntityRefreshOptions): Promise<void>;
|
||||
refresh(options: CatalogProcessingEngineRefreshOptions): Promise<void>;
|
||||
}
|
||||
|
||||
export type EntityRefreshOptions = { entityRef: string };
|
||||
/** @public */
|
||||
export type CatalogProcessingEngineRefreshOptions = { entityRef: string };
|
||||
|
||||
export type EntityProviderMutation =
|
||||
| { type: 'full'; entities: DeferredEntity[] }
|
||||
|
||||
@@ -31,7 +31,7 @@ import { HigherOrderOperation, LocationAnalyzer } from '../ingestion/types';
|
||||
import {
|
||||
LocationService,
|
||||
CatalogProcessingEngine,
|
||||
EntityRefreshOptions,
|
||||
CatalogProcessingEngineRefreshOptions,
|
||||
} from '../next/types';
|
||||
import {
|
||||
basicEntityFilter,
|
||||
@@ -81,7 +81,7 @@ export async function createRouter(
|
||||
|
||||
if (processingEngine) {
|
||||
router.post('/refresh', async (req, res) => {
|
||||
const refreshOptions: EntityRefreshOptions = req.body;
|
||||
const refreshOptions: CatalogProcessingEngineRefreshOptions = req.body;
|
||||
await processingEngine.refresh(refreshOptions);
|
||||
res.status(200).send();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user