@backstage-community/plugin-explore-backend 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +876 -0
- package/README.md +222 -0
- package/config.d.ts +31 -0
- package/dist/index.cjs.js +180 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +75 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# explore-backend
|
|
2
|
+
|
|
3
|
+
The `explore-backend` plugin provides a backend service for the Explore plugin.
|
|
4
|
+
This allows your organizations tools to be surfaced in the Explore plugin
|
|
5
|
+
through an API. It also provides a search collator to make it possible to search
|
|
6
|
+
for these tools.
|
|
7
|
+
|
|
8
|
+
## Getting started
|
|
9
|
+
|
|
10
|
+
### Adding the plugin to your `packages/backend`
|
|
11
|
+
|
|
12
|
+
Install dependencies
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# From your Backstage root directory
|
|
16
|
+
yarn --cwd packages/backend add @backstage-community/plugin-explore-backend
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Add feature
|
|
20
|
+
|
|
21
|
+
```ts title="packages/backend/src/index.ts"
|
|
22
|
+
backend.add(import('@backstage-community/plugin-explore-backend'));
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Config:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
explore:
|
|
29
|
+
tools:
|
|
30
|
+
- title: New Relic
|
|
31
|
+
description: new relic plugin
|
|
32
|
+
url: /newrelic
|
|
33
|
+
image: https://i.imgur.com/L37ikrX.jpg
|
|
34
|
+
tags:
|
|
35
|
+
- newrelic
|
|
36
|
+
- proxy
|
|
37
|
+
- nerdGraph
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Adding the plugin to your `packages/backend` (old)
|
|
41
|
+
|
|
42
|
+
#### Tools as Config
|
|
43
|
+
|
|
44
|
+
Install dependencies
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# From your Backstage root directory
|
|
48
|
+
yarn --cwd packages/backend add @backstage-community/plugin-explore-backend
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
You'll need to add the plugin to the router in your `backend` package. You can
|
|
52
|
+
do this by creating a file called `packages/backend/src/plugins/explore.ts` with the following content:
|
|
53
|
+
|
|
54
|
+
```ts title="packages/backend/src/plugins/explore.ts"
|
|
55
|
+
import {
|
|
56
|
+
createRouter,
|
|
57
|
+
StaticExploreToolProvider,
|
|
58
|
+
} from '@backstage-community/plugin-explore-backend';
|
|
59
|
+
import { Router } from 'express';
|
|
60
|
+
import { PluginEnvironment } from '../types';
|
|
61
|
+
|
|
62
|
+
export default async function createPlugin(
|
|
63
|
+
env: PluginEnvironment,
|
|
64
|
+
): Promise<Router> {
|
|
65
|
+
return await createRouter({
|
|
66
|
+
logger: env.logger,
|
|
67
|
+
toolProvider: StaticExploreToolProvider.fromConfig(env.config),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Config:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
explore:
|
|
76
|
+
tools:
|
|
77
|
+
- title: New Relic
|
|
78
|
+
description: new relic plugin
|
|
79
|
+
url: /newrelic
|
|
80
|
+
image: https://i.imgur.com/L37ikrX.jpg
|
|
81
|
+
tags:
|
|
82
|
+
- newrelic
|
|
83
|
+
- proxy
|
|
84
|
+
- nerdGraph
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Tools as Code
|
|
88
|
+
|
|
89
|
+
Install dependencies
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# From your Backstage root directory
|
|
93
|
+
yarn --cwd packages/backend add @backstage-community/plugin-explore-backend @backstage-community/plugin-explore-common
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
You'll need to add the plugin to the router in your `backend` package. You can
|
|
97
|
+
do this by creating a file called `packages/backend/src/plugins/explore.ts` with the following content:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import {
|
|
101
|
+
createRouter,
|
|
102
|
+
StaticExploreToolProvider,
|
|
103
|
+
} from '@backstage-community/plugin-explore-backend';
|
|
104
|
+
import { ExploreTool } from '@backstage-community/plugin-explore-common';
|
|
105
|
+
import { Router } from 'express';
|
|
106
|
+
import { PluginEnvironment } from '../types';
|
|
107
|
+
|
|
108
|
+
// List of tools you want to surface in the Explore plugin "Tools" page.
|
|
109
|
+
const exploreTools: ExploreTool[] = [
|
|
110
|
+
{
|
|
111
|
+
title: 'New Relic',
|
|
112
|
+
description: 'new relic plugin',
|
|
113
|
+
url: '/newrelic',
|
|
114
|
+
image: 'https://i.imgur.com/L37ikrX.jpg',
|
|
115
|
+
tags: ['newrelic', 'proxy', 'nerdGraph'],
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
export default async function createPlugin(
|
|
120
|
+
env: PluginEnvironment,
|
|
121
|
+
): Promise<Router> {
|
|
122
|
+
return await createRouter({
|
|
123
|
+
logger: env.logger,
|
|
124
|
+
toolProvider: StaticExploreToolProvider.fromData(exploreTools),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Register the plugin router
|
|
130
|
+
|
|
131
|
+
With the `explore.ts` router setup in place, add the router to
|
|
132
|
+
`packages/backend/src/index.ts`:
|
|
133
|
+
|
|
134
|
+
```diff
|
|
135
|
+
+import explore from './plugins/explore';
|
|
136
|
+
|
|
137
|
+
async function main() {
|
|
138
|
+
...
|
|
139
|
+
const createEnv = makeCreateEnv(config);
|
|
140
|
+
|
|
141
|
+
const catalogEnv = useHotMemoize(module, () => createEnv('catalog'));
|
|
142
|
+
+ const exploreEnv = useHotMemoize(module, () => createEnv('explore'));
|
|
143
|
+
|
|
144
|
+
const apiRouter = Router();
|
|
145
|
+
+ apiRouter.use('/explore', await explore(exploreEnv));
|
|
146
|
+
...
|
|
147
|
+
apiRouter.use(notFoundHandler());
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Wire up Search Indexing
|
|
151
|
+
|
|
152
|
+
To index explore tools you will need to register the search collator in the
|
|
153
|
+
`packages/backend/src/plugins/search.ts` file.
|
|
154
|
+
|
|
155
|
+
```diff
|
|
156
|
+
+import { ToolDocumentCollatorFactory } from '@backstage-community/plugin-explore-backend';
|
|
157
|
+
|
|
158
|
+
...
|
|
159
|
+
|
|
160
|
+
+ // collator gathers entities from explore.
|
|
161
|
+
+ indexBuilder.addCollator({
|
|
162
|
+
+ schedule,
|
|
163
|
+
+ factory: ToolDocumentCollatorFactory.fromConfig(env.config, {
|
|
164
|
+
+ discovery: env.discovery,
|
|
165
|
+
+ logger: env.logger,
|
|
166
|
+
+ }),
|
|
167
|
+
+ });
|
|
168
|
+
|
|
169
|
+
...
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Wire up the Frontend
|
|
173
|
+
|
|
174
|
+
See [the explore plugin README](../explore/README.md) for more information.
|
|
175
|
+
|
|
176
|
+
## Explore Tool Customization
|
|
177
|
+
|
|
178
|
+
The `explore-backend` uses the `ExploreToolProvider` interface to provide a list
|
|
179
|
+
of tools used in your organization and/or within your Backstage instance. This
|
|
180
|
+
can be customized to provide tools from any source. For example you could create
|
|
181
|
+
a `CustomExploreToolProvider` that queries an internal for tools in your
|
|
182
|
+
`packages/backend/src/plugins/explore.ts` file.
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import {
|
|
186
|
+
createRouter,
|
|
187
|
+
StaticExploreToolProvider,
|
|
188
|
+
} from '@backstage-community/plugin-explore-backend';
|
|
189
|
+
import { Router } from 'express';
|
|
190
|
+
import { PluginEnvironment } from '../types';
|
|
191
|
+
|
|
192
|
+
class CustomExploreToolProvider implements ExploreToolProvider {
|
|
193
|
+
async getTools(
|
|
194
|
+
request: GetExploreToolsRequest,
|
|
195
|
+
): Promise<GetExploreToolsResponse> {
|
|
196
|
+
const externalTools = await queryExternalTools(request);
|
|
197
|
+
|
|
198
|
+
const tools: ExploreTool[] = [
|
|
199
|
+
...externalTools,
|
|
200
|
+
// Backstage Tools
|
|
201
|
+
{
|
|
202
|
+
title: 'New Relic',
|
|
203
|
+
description: 'new relic plugin',
|
|
204
|
+
url: '/newrelic',
|
|
205
|
+
image: 'https://i.imgur.com/L37ikrX.jpg',
|
|
206
|
+
tags: ['newrelic', 'proxy', 'nerdGraph'],
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
return { tools };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export default async function createPlugin(
|
|
215
|
+
env: PluginEnvironment,
|
|
216
|
+
): Promise<Router> {
|
|
217
|
+
return await createRouter({
|
|
218
|
+
logger: env.logger,
|
|
219
|
+
toolProvider: new CustomExploreToolProvider(),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
```
|
package/config.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 The Backstage Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface Config {
|
|
18
|
+
explore?: {
|
|
19
|
+
/**
|
|
20
|
+
* Tools to be used for the explore tool provider.
|
|
21
|
+
*/
|
|
22
|
+
tools?: Array<{
|
|
23
|
+
title: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
url: string;
|
|
26
|
+
image: string;
|
|
27
|
+
tags?: string[];
|
|
28
|
+
lifecycle?: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
+
var backendCommon = require('@backstage/backend-common');
|
|
7
|
+
var express = require('express');
|
|
8
|
+
var Router = require('express-promise-router');
|
|
9
|
+
var lodash = require('lodash');
|
|
10
|
+
var pluginSearchBackendModuleExplore = require('@backstage/plugin-search-backend-module-explore');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var express__default = /*#__PURE__*/_interopDefaultCompat(express);
|
|
15
|
+
var Router__default = /*#__PURE__*/_interopDefaultCompat(Router);
|
|
16
|
+
|
|
17
|
+
async function createRouter(options) {
|
|
18
|
+
const { toolProvider } = options;
|
|
19
|
+
const router = Router__default.default();
|
|
20
|
+
router.use(express__default.default.json());
|
|
21
|
+
router.get("/tools", async (request, response) => {
|
|
22
|
+
const requestQuery = parseExploreToolRequestQuery(request.query);
|
|
23
|
+
const result = await toolProvider.getTools(requestQuery);
|
|
24
|
+
response.json(result);
|
|
25
|
+
});
|
|
26
|
+
router.use(backendCommon.errorHandler());
|
|
27
|
+
return router;
|
|
28
|
+
}
|
|
29
|
+
function parseExploreToolRequestQuery(params) {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return {
|
|
32
|
+
filter: {
|
|
33
|
+
tags: [...[(_a = params == null ? void 0 : params.tag) != null ? _a : []]].flat(),
|
|
34
|
+
lifecycle: [...[(_b = params == null ? void 0 : params.lifecycle) != null ? _b : []]].flat()
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var __defProp = Object.defineProperty;
|
|
40
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
41
|
+
var __publicField = (obj, key, value) => {
|
|
42
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
43
|
+
return value;
|
|
44
|
+
};
|
|
45
|
+
const anyOf = (prop, matches) => {
|
|
46
|
+
var _a;
|
|
47
|
+
return lodash.isEmpty(matches) ? true : ((_a = lodash.intersection([...[prop]].flat(), matches)) == null ? void 0 : _a.length) > 0;
|
|
48
|
+
};
|
|
49
|
+
class StaticExploreToolProvider {
|
|
50
|
+
constructor(tools) {
|
|
51
|
+
__publicField(this, "tools");
|
|
52
|
+
this.tools = tools;
|
|
53
|
+
}
|
|
54
|
+
static fromConfig(config) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
const tools = (_b = (_a = config.getOptionalConfigArray("explore.tools")) == null ? void 0 : _a.map((toolConfig) => {
|
|
57
|
+
return {
|
|
58
|
+
description: toolConfig.getOptionalString("description"),
|
|
59
|
+
image: toolConfig.getString("image"),
|
|
60
|
+
lifecycle: toolConfig.getOptionalString("lifecycle"),
|
|
61
|
+
tags: toolConfig.getOptionalStringArray("tags"),
|
|
62
|
+
title: toolConfig.getString("title"),
|
|
63
|
+
url: toolConfig.getString("url")
|
|
64
|
+
};
|
|
65
|
+
})) != null ? _b : [];
|
|
66
|
+
return this.fromData(tools);
|
|
67
|
+
}
|
|
68
|
+
static fromData(tools) {
|
|
69
|
+
return new StaticExploreToolProvider(tools);
|
|
70
|
+
}
|
|
71
|
+
async getTools(request) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const { filter } = request != null ? request : {};
|
|
74
|
+
const tags = (_a = filter == null ? void 0 : filter.tags) != null ? _a : [];
|
|
75
|
+
const lifecycles = (_b = filter == null ? void 0 : filter.lifecycle) != null ? _b : [];
|
|
76
|
+
const tools = this.tools.filter(
|
|
77
|
+
(t) => {
|
|
78
|
+
var _a2, _b2;
|
|
79
|
+
return anyOf((_a2 = t.tags) != null ? _a2 : [], tags) && anyOf((_b2 = t.lifecycle) != null ? _b2 : [], lifecycles);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return { tools };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const explorePlugin = backendPluginApi.createBackendPlugin({
|
|
87
|
+
pluginId: "explore",
|
|
88
|
+
register(env) {
|
|
89
|
+
env.registerInit({
|
|
90
|
+
deps: {
|
|
91
|
+
config: backendPluginApi.coreServices.rootConfig,
|
|
92
|
+
httpRouter: backendPluginApi.coreServices.httpRouter,
|
|
93
|
+
logger: backendPluginApi.coreServices.logger
|
|
94
|
+
},
|
|
95
|
+
async init({ config, httpRouter, logger }) {
|
|
96
|
+
httpRouter.use(
|
|
97
|
+
await createRouter({
|
|
98
|
+
logger,
|
|
99
|
+
toolProvider: StaticExploreToolProvider.fromConfig(config)
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const exampleTools = [
|
|
108
|
+
{
|
|
109
|
+
title: "New Relic",
|
|
110
|
+
description: "Observability platform built to help engineers create and monitor their software",
|
|
111
|
+
url: "/newrelic",
|
|
112
|
+
image: "https://i.imgur.com/L37ikrX.jpg",
|
|
113
|
+
tags: ["newrelic", "performance", "monitoring", "errors", "alerting"]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
title: "CircleCI",
|
|
117
|
+
description: "Provides builds overview, detailed build info and retriggering functionality for CircleCI.",
|
|
118
|
+
url: "/circleci",
|
|
119
|
+
image: "https://miro.medium.com/max/1200/1*hkTBp22vLAqlIHkrkZHPnw.png",
|
|
120
|
+
tags: ["circleci", "ci", "dev"]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
title: "Sentry",
|
|
124
|
+
description: "Self-hosted and cloud-based error monitoring that helps software teams discover, triage, and prioritize errors in real-time.",
|
|
125
|
+
url: "/sentry",
|
|
126
|
+
image: "https://sentry-brand.storage.googleapis.com/sentry-logo-black.png",
|
|
127
|
+
tags: ["sentry", "monitoring", "errors"]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: "Lighthouse",
|
|
131
|
+
description: "Google's Lighthouse tool is a great resource for benchmarking and improving the accessibility, performance, SEO, and best practices of your website.",
|
|
132
|
+
url: "/lighthouse",
|
|
133
|
+
image: "https://raw.githubusercontent.com/GoogleChrome/lighthouse/8b3d7f052b2e64dd857e741d7395647f487697e7/assets/lighthouse-logo.png",
|
|
134
|
+
tags: ["web", "seo", "accessibility", "performance"]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: "Tech Radar",
|
|
138
|
+
description: "Tech Radar is a list of technologies, complemented by an assessment result, called ring assignment.",
|
|
139
|
+
url: "/tech-radar",
|
|
140
|
+
image: "https://storage.googleapis.com/wf-blogs-engineering-media/2018/09/fe13bb32-wf-tech-radar-hero-1024x597.png",
|
|
141
|
+
tags: ["standards", "landscape"]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: "Cost Insights",
|
|
145
|
+
description: "Insights into cloud costs for your organization.",
|
|
146
|
+
url: "/cost-insights",
|
|
147
|
+
image: "https://cloud.google.com/images/press/logo-cloud.png",
|
|
148
|
+
tags: ["cloud", "finops"]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: "GraphiQL",
|
|
152
|
+
description: "Integrates GraphiQL as a tool to browse GraphiQL endpoints inside Backstage.",
|
|
153
|
+
url: "/graphiql",
|
|
154
|
+
image: "https://camo.githubusercontent.com/517398c3fbe0687d3d4dcbe05da82970b882e75a/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f33413061324e314c3346324f304c3377326e316a2f477261706869514c382e706e673f582d436c6f75644170702d56697369746f722d49643d3433363432",
|
|
155
|
+
tags: ["graphql", "dev"]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: "GitOps Clusters",
|
|
159
|
+
description: "Create GitOps-managed clusters with Backstage. Currently supports EKS flavors and profiles like Machine Learning Ops (MLOps)",
|
|
160
|
+
url: "/gitops-clusters",
|
|
161
|
+
image: "https://miro.medium.com/max/801/1*R28u8gj-hVdDFISoYqPhrQ.png",
|
|
162
|
+
tags: ["gitops", "dev"]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
title: "Rollbar",
|
|
166
|
+
description: "Error monitoring and crash reporting for agile development and continuous delivery",
|
|
167
|
+
url: "/rollbar",
|
|
168
|
+
image: "https://images.ctfassets.net/cj4mgtttlyx7/4DfiWj9CbuHBi10uWK7JHn/5e94a6c5dbd5d50bdcd8d9e78f88689b/rollbar-seo.png",
|
|
169
|
+
tags: ["rollbar", "monitoring", "errors"]
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
|
|
173
|
+
const ToolDocumentCollatorFactory = pluginSearchBackendModuleExplore.ToolDocumentCollatorFactory;
|
|
174
|
+
|
|
175
|
+
exports.StaticExploreToolProvider = StaticExploreToolProvider;
|
|
176
|
+
exports.ToolDocumentCollatorFactory = ToolDocumentCollatorFactory;
|
|
177
|
+
exports.createRouter = createRouter;
|
|
178
|
+
exports.default = explorePlugin;
|
|
179
|
+
exports.exampleTools = exampleTools;
|
|
180
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/service/router.ts","../src/tools/providers/StaticExploreToolProvider.ts","../src/plugin.ts","../src/example/exampleTools.ts","../src/index.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { errorHandler } from '@backstage/backend-common';\nimport { GetExploreToolsRequest } from '@backstage-community/plugin-explore-common';\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { ExploreToolProvider } from '../tools';\nimport { LoggerService } from '@backstage/backend-plugin-api';\n\n/**\n * @public\n */\nexport interface RouterOptions {\n logger: LoggerService;\n toolProvider: ExploreToolProvider;\n}\n\n/**\n * @public\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const { toolProvider } = options;\n\n const router = Router();\n router.use(express.json());\n\n router.get('/tools', async (request, response) => {\n const requestQuery = parseExploreToolRequestQuery(request.query);\n const result = await toolProvider.getTools(requestQuery);\n response.json(result);\n });\n\n router.use(errorHandler());\n\n return router;\n}\n\nfunction parseExploreToolRequestQuery(\n params: Record<string, unknown>,\n): GetExploreToolsRequest {\n // TODO: Implement proper query parsing for the filters\n // Also consider using a `filter` query string like catalog client does\n return {\n filter: {\n tags: [...[(params?.tag as any) ?? []]].flat(),\n lifecycle: [...[(params?.lifecycle as any) ?? []]].flat(),\n },\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n ExploreTool,\n GetExploreToolsRequest,\n GetExploreToolsResponse,\n} from '@backstage-community/plugin-explore-common';\nimport { intersection, isEmpty } from 'lodash';\nimport { ExploreToolProvider } from '../types';\n\nconst anyOf = <T>(prop: T | T[], matches: T[]) =>\n isEmpty(matches)\n ? true\n : intersection([...[prop]].flat(), matches)?.length > 0;\n\n/**\n * A basic ExploreToolProvider implementation using static data.\n *\n * @public\n */\nexport class StaticExploreToolProvider implements ExploreToolProvider {\n private readonly tools: ExploreTool[];\n\n static fromConfig(config: Config): StaticExploreToolProvider {\n const tools: ExploreTool[] =\n config.getOptionalConfigArray('explore.tools')?.map(toolConfig => {\n return {\n description: toolConfig.getOptionalString('description'),\n image: toolConfig.getString('image'),\n lifecycle: toolConfig.getOptionalString('lifecycle'),\n tags: toolConfig.getOptionalStringArray('tags'),\n title: toolConfig.getString('title'),\n url: toolConfig.getString('url'),\n } as ExploreTool;\n }) ?? [];\n return this.fromData(tools);\n }\n\n static fromData(tools: ExploreTool[]): StaticExploreToolProvider {\n return new StaticExploreToolProvider(tools);\n }\n\n private constructor(tools: ExploreTool[]) {\n this.tools = tools;\n }\n\n async getTools(\n request: GetExploreToolsRequest,\n ): Promise<GetExploreToolsResponse> {\n const { filter } = request ?? {};\n const tags = filter?.tags ?? [];\n const lifecycles = filter?.lifecycle ?? [];\n\n const tools = this.tools.filter(\n t => anyOf(t.tags ?? [], tags) && anyOf(t.lifecycle ?? [], lifecycles),\n );\n\n return { tools };\n }\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { createRouter } from './service';\nimport { StaticExploreToolProvider } from './tools';\n\n/**\n * The explore backend plugin.\n *\n * @public\n */\nexport const explorePlugin = createBackendPlugin({\n pluginId: 'explore',\n register(env) {\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n },\n async init({ config, httpRouter, logger }) {\n httpRouter.use(\n await createRouter({\n logger,\n toolProvider: StaticExploreToolProvider.fromConfig(config),\n }),\n );\n },\n });\n },\n});\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExploreTool } from '@backstage-community/plugin-explore-common';\n\n/**\n * @private Example only - do not use in production\n */\nexport const exampleTools: ExploreTool[] = [\n {\n title: 'New Relic',\n description:\n 'Observability platform built to help engineers create and monitor their software',\n url: '/newrelic',\n image: 'https://i.imgur.com/L37ikrX.jpg',\n tags: ['newrelic', 'performance', 'monitoring', 'errors', 'alerting'],\n },\n {\n title: 'CircleCI',\n description:\n 'Provides builds overview, detailed build info and retriggering functionality for CircleCI.',\n url: '/circleci',\n image: 'https://miro.medium.com/max/1200/1*hkTBp22vLAqlIHkrkZHPnw.png',\n tags: ['circleci', 'ci', 'dev'],\n },\n {\n title: 'Sentry',\n description:\n 'Self-hosted and cloud-based error monitoring that helps software teams discover, triage, and prioritize errors in real-time.',\n url: '/sentry',\n image: 'https://sentry-brand.storage.googleapis.com/sentry-logo-black.png',\n tags: ['sentry', 'monitoring', 'errors'],\n },\n {\n title: 'Lighthouse',\n description:\n \"Google's Lighthouse tool is a great resource for benchmarking and improving the accessibility, performance, SEO, and best practices of your website.\",\n url: '/lighthouse',\n image:\n 'https://raw.githubusercontent.com/GoogleChrome/lighthouse/8b3d7f052b2e64dd857e741d7395647f487697e7/assets/lighthouse-logo.png',\n tags: ['web', 'seo', 'accessibility', 'performance'],\n },\n {\n title: 'Tech Radar',\n description:\n 'Tech Radar is a list of technologies, complemented by an assessment result, called ring assignment.',\n url: '/tech-radar',\n image:\n 'https://storage.googleapis.com/wf-blogs-engineering-media/2018/09/fe13bb32-wf-tech-radar-hero-1024x597.png',\n tags: ['standards', 'landscape'],\n },\n {\n title: 'Cost Insights',\n description: 'Insights into cloud costs for your organization.',\n url: '/cost-insights',\n image: 'https://cloud.google.com/images/press/logo-cloud.png',\n tags: ['cloud', 'finops'],\n },\n {\n title: 'GraphiQL',\n description:\n 'Integrates GraphiQL as a tool to browse GraphiQL endpoints inside Backstage.',\n url: '/graphiql',\n image:\n 'https://camo.githubusercontent.com/517398c3fbe0687d3d4dcbe05da82970b882e75a/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f33413061324e314c3346324f304c3377326e316a2f477261706869514c382e706e673f582d436c6f75644170702d56697369746f722d49643d3433363432',\n tags: ['graphql', 'dev'],\n },\n {\n title: 'GitOps Clusters',\n description:\n 'Create GitOps-managed clusters with Backstage. Currently supports EKS flavors and profiles like Machine Learning Ops (MLOps)',\n url: '/gitops-clusters',\n image: 'https://miro.medium.com/max/801/1*R28u8gj-hVdDFISoYqPhrQ.png',\n tags: ['gitops', 'dev'],\n },\n {\n title: 'Rollbar',\n description:\n 'Error monitoring and crash reporting for agile development and continuous delivery',\n url: '/rollbar',\n image:\n 'https://images.ctfassets.net/cj4mgtttlyx7/4DfiWj9CbuHBi10uWK7JHn/5e94a6c5dbd5d50bdcd8d9e78f88689b/rollbar-seo.png',\n tags: ['rollbar', 'monitoring', 'errors'],\n },\n];\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A Backstage plugin for building an exploration page of your software ecosystem\n *\n * @packageDocumentation\n */\n\nexport { explorePlugin as default } from './plugin';\nexport * from './service';\nexport * from './tools';\n\n/**\n * @internal Example only - do not use in production\n */\nexport { exampleTools } from './example/exampleTools';\n\nimport { ToolDocumentCollatorFactory as _ToolDocumentCollatorFactory } from '@backstage/plugin-search-backend-module-explore';\nimport type {\n ToolDocument as _ToolDocument,\n ToolDocumentCollatorFactoryOptions as _ToolDocumentCollatorFactoryOptions,\n} from '@backstage/plugin-search-backend-module-explore';\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-explore` instead\n */\nexport const ToolDocumentCollatorFactory = _ToolDocumentCollatorFactory;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-explore` instead\n */\nexport type ToolDocument = _ToolDocument;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-explore` instead\n */\nexport type ToolDocumentCollatorFactoryOptions =\n _ToolDocumentCollatorFactoryOptions;\n"],"names":["Router","express","errorHandler","isEmpty","intersection","_a","_b","createBackendPlugin","coreServices","_ToolDocumentCollatorFactory"],"mappings":";;;;;;;;;;;;;;;;AAkCA,eAAsB,aACpB,OACyB,EAAA;AACzB,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA,CAAA;AAEzB,EAAA,MAAM,SAASA,uBAAO,EAAA,CAAA;AACtB,EAAO,MAAA,CAAA,GAAA,CAAIC,wBAAQ,CAAA,IAAA,EAAM,CAAA,CAAA;AAEzB,EAAA,MAAA,CAAO,GAAI,CAAA,QAAA,EAAU,OAAO,OAAA,EAAS,QAAa,KAAA;AAChD,IAAM,MAAA,YAAA,GAAe,4BAA6B,CAAA,OAAA,CAAQ,KAAK,CAAA,CAAA;AAC/D,IAAA,MAAM,MAAS,GAAA,MAAM,YAAa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AAA;AAAA,IACF,GAAK,EAAA,WAAA;AAAA,IACL,KACE,EAAA,kSAAA;AAAA,IACF,IAAA,EAAM,CAAC,SAAA,EAAW,KAAK,CAAA;AAAA,GACzB;AAAA,EACA;AAAA,IACE,KAAO,EAAA,iBAAA;AAAA,IACP,WACE,EAAA,8HAAA;AAAA,IACF,GAAK,EAAA,kBAAA;AAAA,IACL,KAAO,EAAA,8DAAA;AAAA,IACP,IAAA,EAAM,CAAC,QAAA,EAAU,KAAK,CAAA;AAAA,GACxB;AAAA,EACA;AAAA,IACE,KAAO,EAAA,SAAA;AAAA,IACP,WACE,EAAA,oFAAA;AAAA,IACF,GAAK,EAAA,UAAA;AAAA,IACL,KACE,EAAA,mHAAA;AAAA,IACF,IAAM,EAAA,CAAC,SAAW,EAAA,YAAA,EAAc,QAAQ,CAAA;AAAA,GAC1C;AACF;;ACxDO,MAAM,2BAA8B,GAAAC;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
|
+
import { LoggerService } from '@backstage/backend-plugin-api';
|
|
3
|
+
import express from 'express';
|
|
4
|
+
import { GetExploreToolsRequest, GetExploreToolsResponse, ExploreTool } from '@backstage-community/plugin-explore-common';
|
|
5
|
+
import { Config } from '@backstage/config';
|
|
6
|
+
import { ToolDocumentCollatorFactory as ToolDocumentCollatorFactory$1, ToolDocument as ToolDocument$1, ToolDocumentCollatorFactoryOptions as ToolDocumentCollatorFactoryOptions$1 } from '@backstage/plugin-search-backend-module-explore';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The explore backend plugin.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
declare const explorePlugin: () => _backstage_backend_plugin_api.BackendFeature;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
interface ExploreToolProvider {
|
|
19
|
+
/**
|
|
20
|
+
* Gets a list of explore tools filtered by the request options.
|
|
21
|
+
*
|
|
22
|
+
* @param request - The request options {@link @backstage-community/plugin-explore-common#GetExploreToolsRequest}.
|
|
23
|
+
* @returns The response {@link @backstage-community/plugin-explore-common#GetExploreToolsResponse}.
|
|
24
|
+
*/
|
|
25
|
+
getTools(request: GetExploreToolsRequest): Promise<GetExploreToolsResponse>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A basic ExploreToolProvider implementation using static data.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
declare class StaticExploreToolProvider implements ExploreToolProvider {
|
|
34
|
+
private readonly tools;
|
|
35
|
+
static fromConfig(config: Config): StaticExploreToolProvider;
|
|
36
|
+
static fromData(tools: ExploreTool[]): StaticExploreToolProvider;
|
|
37
|
+
private constructor();
|
|
38
|
+
getTools(request: GetExploreToolsRequest): Promise<GetExploreToolsResponse>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
interface RouterOptions {
|
|
45
|
+
logger: LoggerService;
|
|
46
|
+
toolProvider: ExploreToolProvider;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A Backstage plugin for building an exploration page of your software ecosystem
|
|
55
|
+
*
|
|
56
|
+
* @packageDocumentation
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @public
|
|
61
|
+
* @deprecated import from `@backstage/plugin-search-backend-module-explore` instead
|
|
62
|
+
*/
|
|
63
|
+
declare const ToolDocumentCollatorFactory: typeof ToolDocumentCollatorFactory$1;
|
|
64
|
+
/**
|
|
65
|
+
* @public
|
|
66
|
+
* @deprecated import from `@backstage/plugin-search-backend-module-explore` instead
|
|
67
|
+
*/
|
|
68
|
+
type ToolDocument = ToolDocument$1;
|
|
69
|
+
/**
|
|
70
|
+
* @public
|
|
71
|
+
* @deprecated import from `@backstage/plugin-search-backend-module-explore` instead
|
|
72
|
+
*/
|
|
73
|
+
type ToolDocumentCollatorFactoryOptions = ToolDocumentCollatorFactoryOptions$1;
|
|
74
|
+
|
|
75
|
+
export { type ExploreToolProvider, type RouterOptions, StaticExploreToolProvider, type ToolDocument, ToolDocumentCollatorFactory, type ToolDocumentCollatorFactoryOptions, createRouter, explorePlugin as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage-community/plugin-explore-backend",
|
|
3
|
+
"version": "0.0.28",
|
|
4
|
+
"backstage": {
|
|
5
|
+
"role": "backend-plugin"
|
|
6
|
+
},
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"main": "dist/index.cjs.js",
|
|
10
|
+
"types": "dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://backstage.io",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/backstage/community-plugins",
|
|
16
|
+
"directory": "workspaces/explore/plugins/explore-backend"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"main": "dist/index.cjs.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"files": [
|
|
22
|
+
"config.d.ts",
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "backstage-cli package build",
|
|
27
|
+
"clean": "backstage-cli package clean",
|
|
28
|
+
"lint": "backstage-cli package lint",
|
|
29
|
+
"prepack": "backstage-cli package prepack",
|
|
30
|
+
"postpack": "backstage-cli package postpack",
|
|
31
|
+
"start": "backstage-cli package start",
|
|
32
|
+
"test": "backstage-cli package test"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@backstage-community/plugin-explore-common": "^0.0.3",
|
|
36
|
+
"@backstage/backend-common": "^0.21.7",
|
|
37
|
+
"@backstage/backend-plugin-api": "^0.6.17",
|
|
38
|
+
"@backstage/config": "^1.2.0",
|
|
39
|
+
"@backstage/plugin-search-backend-module-explore": "^0.1.21",
|
|
40
|
+
"@backstage/types": "^1.1.1",
|
|
41
|
+
"@types/express": "*",
|
|
42
|
+
"express": "^4.18.1",
|
|
43
|
+
"express-promise-router": "^4.1.0",
|
|
44
|
+
"lodash": "^4.17.21",
|
|
45
|
+
"node-fetch": "^2.6.7",
|
|
46
|
+
"yn": "^4.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@backstage/backend-test-utils": "^0.3.7",
|
|
50
|
+
"@backstage/cli": "^0.26.3",
|
|
51
|
+
"@types/lodash": "^4.14.151",
|
|
52
|
+
"@types/node-fetch": "^2.5.12",
|
|
53
|
+
"@types/supertest": "^2.0.8",
|
|
54
|
+
"supertest": "^6.2.4"
|
|
55
|
+
},
|
|
56
|
+
"configSchema": "config.d.ts"
|
|
57
|
+
}
|