feat(tech-insights): add plugin for new backend system
A new backend plugin for the tech-insights backend
was added and exported as `default`
as well as extension points to be used by modules.
The plugin can be used like
```ts title="packages/backend/src/index.ts"
backend.add(import('@backstage/plugin-tech-insights-backend'));
```
Fact retrievers will be added
(built-in or through the extension point),
but only registered if the user adds a configuration for it
(cadence, etc.).
Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { CheckResult } from '@backstage/plugin-tech-insights-common';
|
||||
import { FactRetriever } from './facts';
|
||||
import { FactCheckerFactory, TechInsightCheck } from './checks';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface TechInsightsFactRetrieversExtensionPoint {
|
||||
addFactRetrievers(factRetrievers: Record<string, FactRetriever>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension point that allows other plugins or modules to add fact retrievers.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const techInsightsFactRetrieversExtensionPoint =
|
||||
createExtensionPoint<TechInsightsFactRetrieversExtensionPoint>({
|
||||
id: 'tech-insights.fact-retrievers',
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface TechInsightsFactCheckerFactoryExtensionPoint {
|
||||
setFactCheckerFactory<
|
||||
CheckType extends TechInsightCheck,
|
||||
CheckResultType extends CheckResult,
|
||||
>(
|
||||
factory: FactCheckerFactory<CheckType, CheckResultType>,
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension point that allows other plugins or modules to set a FactCheckerFactory.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const techInsightsFactCheckerFactoryExtensionPoint =
|
||||
createExtensionPoint<TechInsightsFactCheckerFactoryExtensionPoint>({
|
||||
id: 'tech-insights.fact-checker-factory',
|
||||
});
|
||||
@@ -15,5 +15,6 @@
|
||||
*/
|
||||
|
||||
export * from './checks';
|
||||
export * from './extensionPoints';
|
||||
export * from './facts';
|
||||
export * from './persistence';
|
||||
|
||||
Reference in New Issue
Block a user