Move shared types into catalog-node package

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-07-06 16:08:25 +02:00
committed by Patrik Oldsberg
parent 699881cdd9
commit 4ba38d1f27
10 changed files with 82 additions and 195 deletions
@@ -17,32 +17,20 @@ import { loggerToWinstonLogger } from '@backstage/backend-app-api';
import {
configServiceRef,
createBackendPlugin,
createServiceRef,
databaseServiceRef,
loggerServiceRef,
permissionsServiceRef,
urlReaderServiceRef,
httpRouterServiceRef,
} from '@backstage/backend-plugin-api';
import { CatalogProcessor } from '../api/processor';
import { CatalogProcessor } from '@backstage/plugin-catalog-node';
import { CatalogBuilder } from './CatalogBuilder';
import {
CatalogProcessingExtensionPoint,
catalogProcessingExtentionPoint,
} from '@backstage/plugin-catalog-node';
/**
* @alpha
*/
export interface CatalogProcessingInitApi {
addProcessor(processor: CatalogProcessor): void;
}
/**
* @alpha
*/
export const catalogProcessingInitApiRef =
createServiceRef<CatalogProcessingInitApi>({
id: 'catalog.processing',
});
class CatalogExtensionPointImpl implements CatalogProcessingInitApi {
class CatalogExtensionPointImpl implements CatalogProcessingExtensionPoint {
#processors = new Array<CatalogProcessor>();
addProcessor(processor: CatalogProcessor): void {
@@ -64,7 +52,7 @@ export const catalogPlugin = createBackendPlugin({
const processingExtensions = new CatalogExtensionPointImpl();
// plugins depending on this API will be initialized before this plugins init method is executed.
env.registerExtensionPoint(
catalogProcessingInitApiRef,
catalogProcessingExtentionPoint,
processingExtensions,
);
+1 -3
View File
@@ -16,6 +16,4 @@
export type { CatalogEnvironment } from './CatalogBuilder';
export { CatalogBuilder } from './CatalogBuilder';
export type { CatalogProcessingInitApi } from './CatalogPlugin';
export { catalogPlugin, catalogProcessingInitApiRef } from './CatalogPlugin';
export { catalogPlugin } from './CatalogPlugin';
+10
View File
@@ -8,6 +8,16 @@
import { CompoundEntityRef } from '@backstage/catalog-model';
import { Entity } from '@backstage/catalog-model';
import { JsonValue } from '@backstage/types';
import { ServiceRef } from '@backstage/backend-plugin-api';
// @alpha (undocumented)
export interface CatalogProcessingExtensionPoint {
// (undocumented)
addProcessor(processor: CatalogProcessor): void;
}
// @alpha (undocumented)
export const catalogProcessingExtentionPoint: ServiceRef<CatalogProcessingExtensionPoint>;
// @public (undocumented)
export type CatalogProcessor = {
+1
View File
@@ -25,6 +25,7 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-plugin-api": "^0.0.0",
"@backstage/catalog-model": "^1.1.0-next.2",
"@backstage/errors": "1.1.0-next.0",
"@backstage/types": "^1.0.0"
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright 2022 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 { createServiceRef } from '@backstage/backend-plugin-api';
import { CatalogProcessor } from './api/processor';
/**
* @alpha
*/
export interface CatalogProcessingExtensionPoint {
addProcessor(processor: CatalogProcessor): void;
}
/**
* @alpha
*/
export const catalogProcessingExtentionPoint =
createServiceRef<CatalogProcessingExtensionPoint>({
id: 'catalog.processing',
});
+2
View File
@@ -20,5 +20,7 @@
* @packageDocumentation
*/
export type { CatalogProcessingExtensionPoint } from './extensions';
export { catalogProcessingExtentionPoint } from './extensions';
export * from './api';
export * from './processing';