chore: fix changese and updating things
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -4,13 +4,25 @@
|
||||
'@backstage/plugin-catalog-unprocessed-entities-common': patch
|
||||
---
|
||||
|
||||
**BREAKING**- the `@backstage/plugin-catalog-backend-module-unprocessed` now requires the `permissionsApi`.
|
||||
If you're using this module in the old backend system you'll need to pass the `permissions` object to the `registerRoutes` method in `packages/backend/src/plugins/catalog.ts`.
|
||||
**BREAKING**- the `@backstage/plugin-catalog-backend-module-unprocessed` constructor is now private, and have been moved to using the static `.create` method instead which now requires a `PermissionService` and `DiscoveryService`.
|
||||
|
||||
If you're using this module in the old backend system you'll need to migrate to using the `.create` method and pass in the new required parameters in `packages/backend/src/plugins/catalog.ts`.
|
||||
|
||||
No changes should be required if you're using the new backend system.
|
||||
|
||||
```diff
|
||||
- unprocessed.registerRoutes();
|
||||
+ unprocessed.registerRoutes({ permissions: env.permissions });
|
||||
- const unprocessed = new UnprocessedEntitiesModule(
|
||||
- await env.database.getClient(),
|
||||
- router,
|
||||
- );
|
||||
+ const unprocessed = UnprocessedEntitiesModule.create({
|
||||
+ database: await env.database.getClient(),
|
||||
+ router,
|
||||
+ permissions: env.permissions,
|
||||
+ discovery: env.discovery,
|
||||
+ });
|
||||
|
||||
unprocessed.registerRoutes();
|
||||
```
|
||||
|
||||
Adds the ability to delete an unprocessed entity from the `refresh_state` table. This change requires enabling permissions for your Backstage instance.
|
||||
|
||||
@@ -37,12 +37,14 @@ export default async function createPlugin(
|
||||
|
||||
const { processingEngine, router } = await builder.build();
|
||||
|
||||
const unprocessed = new UnprocessedEntitiesModule(
|
||||
await env.database.getClient(),
|
||||
const unprocessed = UnprocessedEntitiesModule.create({
|
||||
database: await env.database.getClient(),
|
||||
router,
|
||||
);
|
||||
permissions: env.permissions,
|
||||
discovery: env.discovery,
|
||||
});
|
||||
|
||||
unprocessed.registerRoutes({ permissions: env.permissions });
|
||||
unprocessed.registerRoutes();
|
||||
|
||||
await processingEngine.start();
|
||||
return router;
|
||||
|
||||
@@ -49,7 +49,7 @@ export class UnprocessedEntitiesModule {
|
||||
|
||||
private readonly httpAuth: HttpAuthService;
|
||||
|
||||
constructor(
|
||||
private constructor(
|
||||
private readonly database: Knex,
|
||||
private readonly router: Pick<HttpRouterService, 'use'>,
|
||||
private readonly permissions: PermissionsService,
|
||||
@@ -65,6 +65,22 @@ export class UnprocessedEntitiesModule {
|
||||
}).httpAuth;
|
||||
}
|
||||
|
||||
static create(options: {
|
||||
router: Pick<HttpRouterService, 'use'>;
|
||||
database: Knex;
|
||||
discovery: DiscoveryService;
|
||||
permissions: PermissionsService;
|
||||
httpAuth?: HttpAuthService;
|
||||
}) {
|
||||
return new UnprocessedEntitiesModule(
|
||||
options.database,
|
||||
options.router,
|
||||
options.permissions,
|
||||
options.discovery,
|
||||
options.httpAuth,
|
||||
);
|
||||
}
|
||||
|
||||
private async unprocessed(
|
||||
request: UnprocessedEntitiesRequest,
|
||||
): Promise<UnprocessedEntitiesResponse> {
|
||||
|
||||
@@ -46,13 +46,13 @@ export const catalogModuleUnprocessedEntities = createBackendModule({
|
||||
httpAuth,
|
||||
discovery,
|
||||
}) {
|
||||
const module = new UnprocessedEntitiesModule(
|
||||
await database.getClient(),
|
||||
const module = UnprocessedEntitiesModule.create({
|
||||
database: await database.getClient(),
|
||||
router,
|
||||
permissions,
|
||||
discovery,
|
||||
httpAuth,
|
||||
);
|
||||
});
|
||||
|
||||
module.registerRoutes();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user