Merge pull request #20002 from zcason/zcason/graphql-backend-plugin

Add support to graphql and playlist for the new backend
This commit is contained in:
Johan Haals
2023-09-26 10:20:54 +02:00
committed by GitHub
9 changed files with 86 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-playlist-backend': patch
---
Added support to the playlist plugin for the new backend
+1
View File
@@ -45,6 +45,7 @@
"@backstage/plugin-permission-backend-module-allow-all-policy": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
"@backstage/plugin-permission-node": "workspace:^",
"@backstage/plugin-playlist-backend": "workspace:^",
"@backstage/plugin-proxy-backend": "workspace:^",
"@backstage/plugin-scaffolder-backend": "workspace:^",
"@backstage/plugin-search-backend": "workspace:^",
+1
View File
@@ -32,6 +32,7 @@ backend.add(import('@backstage/plugin-entity-feedback-backend'));
backend.add(import('@backstage/plugin-kubernetes-backend/alpha'));
backend.add(import('@backstage/plugin-lighthouse-backend'));
backend.add(import('@backstage/plugin-linguist-backend'));
backend.add(import('@backstage/plugin-playlist-backend'));
backend.add(
import('@backstage/plugin-permission-backend-module-allow-all-policy'),
);
+17
View File
@@ -85,3 +85,20 @@ export default async function createPlugin(env: PluginEnvironment): Promise<Rout
policy: new BackstagePermissionPolicy(),
...
```
### New Backend System
The Playlist backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up:
In your `packages/backend/src/index.ts` make the following changes:
```diff
import { createBackend } from '@backstage/backend-defaults';
const backend = createBackend();
backend.add(import('@backstage/plugin-playlist-backend'));
// ... other feature additions
backend.start();
```
+5
View File
@@ -3,6 +3,7 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { BackendFeature } from '@backstage/backend-plugin-api';
import { BackstageIdentityResponse } from '@backstage/plugin-auth-node';
import { ConditionalPolicyDecision } from '@backstage/plugin-permission-common';
import { Conditions } from '@backstage/plugin-permission-node';
@@ -80,6 +81,10 @@ export const playlistConditions: Conditions<{
>;
}>;
// @public
const playlistPlugin: () => BackendFeature;
export default playlistPlugin;
// @public (undocumented)
export interface RouterOptions {
// (undocumented)
+1
View File
@@ -29,6 +29,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/catalog-client": "workspace:^",
"@backstage/catalog-model": "workspace:^",
"@backstage/config": "workspace:^",
+1
View File
@@ -26,3 +26,4 @@ export {
isPlaylistPermission,
playlistConditions,
} from './permissions';
export { playlistPlugin as default } from './plugin';
+53
View File
@@ -0,0 +1,53 @@
/*
* Copyright 2023 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 {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
import { createRouter } from './service';
import { loggerToWinstonLogger } from '@backstage/backend-common';
/**
* Playlist backend plugin
*
* @public
*/
export const playlistPlugin = createBackendPlugin({
pluginId: 'playlist',
register(env) {
env.registerInit({
deps: {
http: coreServices.httpRouter,
logger: coreServices.logger,
database: coreServices.database,
identity: coreServices.identity,
discovery: coreServices.discovery,
permissions: coreServices.permissions,
},
async init({ http, logger, database, identity, discovery, permissions }) {
http.use(
await createRouter({
logger: loggerToWinstonLogger(logger),
database,
identity,
discovery,
permissions,
}),
);
},
});
},
});
+2
View File
@@ -8076,6 +8076,7 @@ __metadata:
resolution: "@backstage/plugin-playlist-backend@workspace:plugins/playlist-backend"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/catalog-client": "workspace:^"
"@backstage/catalog-model": "workspace:^"
@@ -25636,6 +25637,7 @@ __metadata:
"@backstage/plugin-permission-backend-module-allow-all-policy": "workspace:^"
"@backstage/plugin-permission-common": "workspace:^"
"@backstage/plugin-permission-node": "workspace:^"
"@backstage/plugin-playlist-backend": "workspace:^"
"@backstage/plugin-proxy-backend": "workspace:^"
"@backstage/plugin-scaffolder-backend": "workspace:^"
"@backstage/plugin-search-backend": "workspace:^"