feat(tech-insights): support registry and persistence at plugin
Support `FactRetrieverRegistry` and `PersistenceContext` at the `techInsightsPlugin` using extension points. Additionally, move `FactRetrieverRegistry` and `PersistenceContext` to `@backstage/plugin-tech-insights-node`. Original exports are marked as deprecated and re-export the moved types. Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
@@ -16,8 +16,9 @@
|
||||
|
||||
import { createExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { CheckResult } from '@backstage/plugin-tech-insights-common';
|
||||
import { FactRetriever } from './facts';
|
||||
import { FactCheckerFactory, TechInsightCheck } from './checks';
|
||||
import { FactRetriever, FactRetrieverRegistry } from './facts';
|
||||
import { PersistenceContext } from './persistence';
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -57,3 +58,37 @@ export const techInsightsFactCheckerFactoryExtensionPoint =
|
||||
createExtensionPoint<TechInsightsFactCheckerFactoryExtensionPoint>({
|
||||
id: 'tech-insights.fact-checker-factory',
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface TechInsightsFactRetrieverRegistryExtensionPoint {
|
||||
setFactRetrieverRegistry(registry: FactRetrieverRegistry): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension point that allows other plugins or modules to set a custom FactRetrieverRegistry.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const techInsightsFactRetrieverRegistryExtensionPoint =
|
||||
createExtensionPoint<TechInsightsFactRetrieverRegistryExtensionPoint>({
|
||||
id: 'tech-insights.fact-retriever-registry',
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface TechInsightsPersistenceContextExtensionPoint {
|
||||
setPersistenceContext(context: PersistenceContext): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension point that allows other plugins or modules to set a custom PersistenceContext.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const techInsightsPersistenceContextExtensionPoint =
|
||||
createExtensionPoint<TechInsightsPersistenceContextExtensionPoint>({
|
||||
id: 'tech-insights.persistence-context',
|
||||
});
|
||||
|
||||
@@ -230,3 +230,14 @@ export type FactRetrieverRegistration = {
|
||||
*/
|
||||
initialDelay?: Duration | HumanDuration;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface FactRetrieverRegistry {
|
||||
register(registration: FactRetrieverRegistration): Promise<void>;
|
||||
get(retrieverReference: string): Promise<FactRetrieverRegistration>;
|
||||
listRetrievers(): Promise<FactRetriever[]>;
|
||||
listRegistrations(): Promise<FactRetrieverRegistration[]>;
|
||||
getSchemas(): Promise<FactSchema[]>;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,15 @@ import {
|
||||
import { DateTime } from 'luxon';
|
||||
import { FactSchema } from '@backstage/plugin-tech-insights-common';
|
||||
|
||||
/**
|
||||
* A Container for persistence related components in TechInsights
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type PersistenceContext = {
|
||||
techInsightsStore: TechInsightsStore;
|
||||
};
|
||||
|
||||
/**
|
||||
* TechInsights Database
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user