Merge pull request #29635 from awanlin/unprocessed-entities/remove-backend-common
unprocessed entities - removed legacy and backend-common
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-unprocessed': minor
|
||||
---
|
||||
|
||||
**BREAKING** Removed support for the legacy backend and removed references to `@backstage/backend-common`, please [migrate to the new backend system](https://backstage.io/docs/backend-system/building-plugins-and-modules/migrating)
|
||||
@@ -38,7 +38,6 @@
|
||||
"@backstage/plugin-auth-node": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "workspace:^",
|
||||
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^",
|
||||
"@backstage/plugin-catalog-node": "workspace:^",
|
||||
"@backstage/plugin-events-backend": "workspace:^",
|
||||
"@backstage/plugin-events-node": "workspace:^",
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { CatalogBuilder } from '@backstage/plugin-catalog-backend';
|
||||
import { ScaffolderEntitiesProcessor } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';
|
||||
import { UnprocessedEntitiesModule } from '@backstage/plugin-catalog-backend-module-unprocessed';
|
||||
import { Router } from 'express';
|
||||
import { PluginEnvironment } from '../types';
|
||||
import { DemoEventBasedEntityProvider } from './DemoEventBasedEntityProvider';
|
||||
@@ -37,15 +36,6 @@ export default async function createPlugin(
|
||||
|
||||
const { processingEngine, router } = await builder.build();
|
||||
|
||||
const unprocessed = UnprocessedEntitiesModule.create({
|
||||
database: await env.database.getClient(),
|
||||
router,
|
||||
permissions: env.permissions,
|
||||
discovery: env.discovery,
|
||||
});
|
||||
|
||||
unprocessed.registerRoutes();
|
||||
|
||||
await processingEngine.start();
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -19,19 +19,3 @@ In `packages/backend/src/index.ts` add the module:
|
||||
```ts title="packages/backend/src/index.ts"
|
||||
backend.add(import('@backstage/plugin-catalog-backend-module-unprocessed'));
|
||||
```
|
||||
|
||||
### Legacy Backend
|
||||
|
||||
In `packages/backend/src/plugins/catalog.ts` import the module and initialize it after invoking `CatalogBuilder.build()`:
|
||||
|
||||
```ts title="packages/backend/src/plugins/catalog.ts"
|
||||
import { UnprocessedEntitiesModule } from '@backstage/plugin-catalog-backend-module-unprocessed';
|
||||
|
||||
//...
|
||||
|
||||
const unprocessed = new UnprocessedEntitiesModule(
|
||||
await env.database.getClient(),
|
||||
router,
|
||||
);
|
||||
unprocessed.registerRoutes();
|
||||
```
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
"test": "backstage-cli package test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "^0.25.0",
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
|
||||
@@ -4,27 +4,8 @@
|
||||
|
||||
```ts
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
import { HttpAuthService } from '@backstage/backend-plugin-api';
|
||||
import { HttpRouterService } from '@backstage/backend-plugin-api';
|
||||
import { Knex } from 'knex';
|
||||
import { PermissionsService } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public
|
||||
const catalogModuleUnprocessedEntities: BackendFeature;
|
||||
export default catalogModuleUnprocessedEntities;
|
||||
|
||||
// @public
|
||||
export class UnprocessedEntitiesModule {
|
||||
// (undocumented)
|
||||
static create(options: {
|
||||
router: Pick<HttpRouterService, 'use'>;
|
||||
database: Knex;
|
||||
discovery: DiscoveryService;
|
||||
permissions: PermissionsService;
|
||||
httpAuth?: HttpAuthService;
|
||||
}): UnprocessedEntitiesModule;
|
||||
// (undocumented)
|
||||
registerRoutes(): void;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
} from './types';
|
||||
import { Knex } from 'knex';
|
||||
import {
|
||||
DiscoveryService,
|
||||
HttpAuthService,
|
||||
HttpRouterService,
|
||||
PermissionsService,
|
||||
@@ -36,12 +35,11 @@ import {
|
||||
} from '@backstage/plugin-permission-common';
|
||||
import { unprocessedEntitiesDeletePermission } from '@backstage/plugin-catalog-unprocessed-entities-common';
|
||||
import { NotAllowedError } from '@backstage/errors';
|
||||
import { createLegacyAuthAdapters } from '@backstage/backend-common';
|
||||
|
||||
/**
|
||||
* Module providing Unprocessed Entities API endpoints
|
||||
*
|
||||
* @public
|
||||
* @internal
|
||||
*/
|
||||
export class UnprocessedEntitiesModule {
|
||||
private readonly moduleRouter;
|
||||
@@ -52,30 +50,24 @@ export class UnprocessedEntitiesModule {
|
||||
private readonly database: Knex,
|
||||
private readonly router: Pick<HttpRouterService, 'use'>,
|
||||
private readonly permissions: PermissionsService,
|
||||
discovery: DiscoveryService,
|
||||
httpAuth?: HttpAuthService,
|
||||
httpAuth: HttpAuthService,
|
||||
) {
|
||||
this.moduleRouter = Router();
|
||||
this.router.use(this.moduleRouter);
|
||||
|
||||
this.httpAuth = createLegacyAuthAdapters({
|
||||
discovery,
|
||||
httpAuth,
|
||||
}).httpAuth;
|
||||
this.httpAuth = httpAuth;
|
||||
}
|
||||
|
||||
static create(options: {
|
||||
router: Pick<HttpRouterService, 'use'>;
|
||||
database: Knex;
|
||||
discovery: DiscoveryService;
|
||||
permissions: PermissionsService;
|
||||
httpAuth?: HttpAuthService;
|
||||
httpAuth: HttpAuthService;
|
||||
}) {
|
||||
return new UnprocessedEntitiesModule(
|
||||
options.database,
|
||||
options.router,
|
||||
options.permissions,
|
||||
options.discovery,
|
||||
options.httpAuth,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,4 +21,3 @@
|
||||
*/
|
||||
|
||||
export { catalogModuleUnprocessedEntities as default } from './module';
|
||||
export * from './UnprocessedEntitiesModule';
|
||||
|
||||
@@ -36,7 +36,6 @@ export const catalogModuleUnprocessedEntities = createBackendModule({
|
||||
router: coreServices.httpRouter,
|
||||
logger: coreServices.logger,
|
||||
httpAuth: coreServices.httpAuth,
|
||||
discovery: coreServices.discovery,
|
||||
permissions: coreServices.permissions,
|
||||
permissionsRegistry: coreServices.permissionsRegistry,
|
||||
},
|
||||
@@ -46,14 +45,12 @@ export const catalogModuleUnprocessedEntities = createBackendModule({
|
||||
logger,
|
||||
permissions,
|
||||
httpAuth,
|
||||
discovery,
|
||||
permissionsRegistry,
|
||||
}) {
|
||||
const module = UnprocessedEntitiesModule.create({
|
||||
database: await database.getClient(),
|
||||
router,
|
||||
permissions,
|
||||
discovery,
|
||||
httpAuth,
|
||||
});
|
||||
|
||||
|
||||
@@ -5784,7 +5784,6 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-catalog-backend-module-unprocessed@workspace:plugins/catalog-backend-module-unprocessed"
|
||||
dependencies:
|
||||
"@backstage/backend-common": "npm:^0.25.0"
|
||||
"@backstage/backend-plugin-api": "workspace:^"
|
||||
"@backstage/catalog-model": "workspace:^"
|
||||
"@backstage/cli": "workspace:^"
|
||||
@@ -28965,7 +28964,6 @@ __metadata:
|
||||
"@backstage/plugin-auth-node": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "workspace:^"
|
||||
"@backstage/plugin-catalog-backend-module-unprocessed": "workspace:^"
|
||||
"@backstage/plugin-catalog-node": "workspace:^"
|
||||
"@backstage/plugin-events-backend": "workspace:^"
|
||||
"@backstage/plugin-events-node": "workspace:^"
|
||||
|
||||
Reference in New Issue
Block a user