@backstage-community/plugin-explore-backend 0.1.0 → 0.1.2
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 +18 -0
- package/README.md +48 -0
- package/dist/index.cjs.js +24 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +13 -19
- package/package.json +16 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @backstage-community/plugin-explore-backend
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2173f7d: version:bump to v1.29.1
|
|
8
|
+
- Updated dependencies [2173f7d]
|
|
9
|
+
- @backstage-community/plugin-explore-common@0.0.4
|
|
10
|
+
- @backstage-community/plugin-explore-node@0.1.2
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- d84243a: Add ToolProviderExtensionPoint to allow setting other tool providers
|
|
17
|
+
- Updated dependencies [d84243a]
|
|
18
|
+
- Updated dependencies [d84243a]
|
|
19
|
+
- @backstage-community/plugin-explore-node@0.1.1
|
|
20
|
+
|
|
3
21
|
## 0.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -184,6 +184,8 @@ can be customized to provide tools from any source. For example you could create
|
|
|
184
184
|
a `CustomExploreToolProvider` that queries an internal for tools in your
|
|
185
185
|
`packages/backend/src/plugins/explore.ts` file.
|
|
186
186
|
|
|
187
|
+
Old Backend system:
|
|
188
|
+
|
|
187
189
|
```ts
|
|
188
190
|
import {
|
|
189
191
|
createRouter,
|
|
@@ -223,3 +225,49 @@ export default async function createPlugin(
|
|
|
223
225
|
});
|
|
224
226
|
}
|
|
225
227
|
```
|
|
228
|
+
|
|
229
|
+
New Backend system:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
// packages/backend/src/modules/exploreToolProviderModule.ts
|
|
233
|
+
|
|
234
|
+
import { createBackendModule } from '@backstage/backend-plugin-api';
|
|
235
|
+
import { toolProviderExtensionPoint } from '@backstage-community/plugin-explore-node';
|
|
236
|
+
import { ExploreTool } from '@backstage-community/plugin-explore-common';
|
|
237
|
+
import { StaticExploreToolProvider } from '@backstage-community/plugin-explore-backend';
|
|
238
|
+
|
|
239
|
+
const exploreTools: ExploreTool[] = [
|
|
240
|
+
{
|
|
241
|
+
title: 'New Relic',
|
|
242
|
+
description: 'new relic plugin',
|
|
243
|
+
url: '/newrelic',
|
|
244
|
+
image: 'https://i.imgur.com/L37ikrX.jpg',
|
|
245
|
+
tags: ['newrelic', 'proxy', 'nerdGraph'],
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
export default createBackendModule({
|
|
250
|
+
pluginId: 'explore',
|
|
251
|
+
moduleId: 'exploreModuleToolProvider',
|
|
252
|
+
register(env) {
|
|
253
|
+
env.registerInit({
|
|
254
|
+
deps: {
|
|
255
|
+
exploreToolProvider: toolProviderExtensionPoint,
|
|
256
|
+
},
|
|
257
|
+
async init({ exploreToolProvider }) {
|
|
258
|
+
exploreToolProvider.setToolProvider(
|
|
259
|
+
StaticExploreToolProvider.fromData(exploreTools),
|
|
260
|
+
);
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
// packages/backend/src/index.ts
|
|
269
|
+
|
|
270
|
+
import exploreToolProviderModule from './modules/exploreToolProviderModule';
|
|
271
|
+
|
|
272
|
+
backend.add(exploreToolProviderModule);
|
|
273
|
+
```
|
package/dist/index.cjs.js
CHANGED
|
@@ -7,6 +7,7 @@ var backendCommon = require('@backstage/backend-common');
|
|
|
7
7
|
var express = require('express');
|
|
8
8
|
var Router = require('express-promise-router');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
|
+
var pluginExploreNode = require('@backstage-community/plugin-explore-node');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
13
|
|
|
@@ -26,33 +27,19 @@ async function createRouter(options) {
|
|
|
26
27
|
return router;
|
|
27
28
|
}
|
|
28
29
|
function parseExploreToolRequestQuery(params) {
|
|
29
|
-
var _a, _b;
|
|
30
30
|
return {
|
|
31
31
|
filter: {
|
|
32
|
-
tags: [...[
|
|
33
|
-
lifecycle: [...[
|
|
32
|
+
tags: [...[params?.tag ?? []]].flat(),
|
|
33
|
+
lifecycle: [...[params?.lifecycle ?? []]].flat()
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
40
|
-
var __publicField = (obj, key, value) => {
|
|
41
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
42
|
-
return value;
|
|
43
|
-
};
|
|
44
|
-
const anyOf = (prop, matches) => {
|
|
45
|
-
var _a;
|
|
46
|
-
return lodash.isEmpty(matches) ? true : ((_a = lodash.intersection([...[prop]].flat(), matches)) == null ? void 0 : _a.length) > 0;
|
|
47
|
-
};
|
|
38
|
+
const anyOf = (prop, matches) => lodash.isEmpty(matches) ? true : lodash.intersection([...[prop]].flat(), matches)?.length > 0;
|
|
48
39
|
class StaticExploreToolProvider {
|
|
49
|
-
|
|
50
|
-
__publicField(this, "tools");
|
|
51
|
-
this.tools = tools;
|
|
52
|
-
}
|
|
40
|
+
tools;
|
|
53
41
|
static fromConfig(config) {
|
|
54
|
-
|
|
55
|
-
const tools = (_b = (_a = config.getOptionalConfigArray("explore.tools")) == null ? void 0 : _a.map((toolConfig) => {
|
|
42
|
+
const tools = config.getOptionalConfigArray("explore.tools")?.map((toolConfig) => {
|
|
56
43
|
return {
|
|
57
44
|
description: toolConfig.getOptionalString("description"),
|
|
58
45
|
image: toolConfig.getString("image"),
|
|
@@ -61,22 +48,21 @@ class StaticExploreToolProvider {
|
|
|
61
48
|
title: toolConfig.getString("title"),
|
|
62
49
|
url: toolConfig.getString("url")
|
|
63
50
|
};
|
|
64
|
-
})
|
|
51
|
+
}) ?? [];
|
|
65
52
|
return this.fromData(tools);
|
|
66
53
|
}
|
|
67
54
|
static fromData(tools) {
|
|
68
55
|
return new StaticExploreToolProvider(tools);
|
|
69
56
|
}
|
|
57
|
+
constructor(tools) {
|
|
58
|
+
this.tools = tools;
|
|
59
|
+
}
|
|
70
60
|
async getTools(request) {
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const lifecycles = (_b = filter == null ? void 0 : filter.lifecycle) != null ? _b : [];
|
|
61
|
+
const { filter } = request ?? {};
|
|
62
|
+
const tags = filter?.tags ?? [];
|
|
63
|
+
const lifecycles = filter?.lifecycle ?? [];
|
|
75
64
|
const tools = this.tools.filter(
|
|
76
|
-
(t) =>
|
|
77
|
-
var _a2, _b2;
|
|
78
|
-
return anyOf((_a2 = t.tags) != null ? _a2 : [], tags) && anyOf((_b2 = t.lifecycle) != null ? _b2 : [], lifecycles);
|
|
79
|
-
}
|
|
65
|
+
(t) => anyOf(t.tags ?? [], tags) && anyOf(t.lifecycle ?? [], lifecycles)
|
|
80
66
|
);
|
|
81
67
|
return { tools };
|
|
82
68
|
}
|
|
@@ -85,6 +71,15 @@ class StaticExploreToolProvider {
|
|
|
85
71
|
const explorePlugin = backendPluginApi.createBackendPlugin({
|
|
86
72
|
pluginId: "explore",
|
|
87
73
|
register(env) {
|
|
74
|
+
let toolProvider;
|
|
75
|
+
env.registerExtensionPoint(pluginExploreNode.toolProviderExtensionPoint, {
|
|
76
|
+
setToolProvider(provider) {
|
|
77
|
+
if (provider) {
|
|
78
|
+
throw new Error("The tool provider has been already set");
|
|
79
|
+
}
|
|
80
|
+
toolProvider = provider;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
88
83
|
env.registerInit({
|
|
89
84
|
deps: {
|
|
90
85
|
config: backendPluginApi.coreServices.rootConfig,
|
|
@@ -95,7 +90,7 @@ const explorePlugin = backendPluginApi.createBackendPlugin({
|
|
|
95
90
|
httpRouter.use(
|
|
96
91
|
await createRouter({
|
|
97
92
|
logger,
|
|
98
|
-
toolProvider: StaticExploreToolProvider.fromConfig(config)
|
|
93
|
+
toolProvider: toolProvider ?? StaticExploreToolProvider.fromConfig(config)
|
|
99
94
|
})
|
|
100
95
|
);
|
|
101
96
|
}
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +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"],"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"],"names":["Router","express","errorHandler","isEmpty","intersection","_a","_b","createBackendPlugin","coreServices"],"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,CAAA,QAAA,CAAS,YAAY,CAAA,CAAA;AACvD,IAAA,QAAA,CAAS,KAAK,MAAM,CAAA,CAAA;AAAA,GACrB,CAAA,CAAA;AAED,EAAO,MAAA,CAAA,GAAA,CAAIC,4BAAc,CAAA,CAAA;AAEzB,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAEA,SAAS,6BACP,MACwB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AA,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;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/service/router.ts","../src/tools/providers/StaticExploreToolProvider.ts","../src/plugin.ts","../src/example/exampleTools.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 { LoggerService } from '@backstage/backend-plugin-api';\nimport { ExploreToolProvider } from '@backstage-community/plugin-explore-node';\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';\n\nimport { ExploreToolProvider } from '@backstage-community/plugin-explore-node';\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';\nimport {\n ExploreToolProvider,\n toolProviderExtensionPoint,\n} from '@backstage-community/plugin-explore-node';\n\n/**\n * The explore backend plugin.\n *\n * @public\n */\nexport const explorePlugin = createBackendPlugin({\n pluginId: 'explore',\n register(env) {\n let toolProvider: ExploreToolProvider | undefined;\n\n env.registerExtensionPoint(toolProviderExtensionPoint, {\n setToolProvider(provider) {\n if (provider) {\n throw new Error('The tool provider has been already set');\n }\n toolProvider = provider;\n },\n });\n\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:\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"],"names":["Router","express","errorHandler","isEmpty","intersection","createBackendPlugin","toolProviderExtensionPoint","coreServices"],"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,CAAA,QAAA,CAAS,YAAY,CAAA,CAAA;AACvD,IAAA,QAAA,CAAS,KAAK,MAAM,CAAA,CAA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AA,CAAC,KAAO,EAAA,KAAA,EAAO,iBAAiB,aAAa,CAAA;AAAA,GACrD;AAAA,EACA;AAAA,IACE,KAAO,EAAA,YAAA;AAAA,IACP,WACE,EAAA,qGAAA;AAAA,IACF,GAAK,EAAA,aAAA;AAAA,IACL,KACE,EAAA,4GAAA;AAAA,IACF,IAAA,EAAM,CAAC,WAAA,EAAa,WAAW,CAAA;AAAA,GACjC;AAAA,EACA;AAAA,IACE,KAAO,EAAA,eAAA;AAAA,IACP,WAAa,EAAA,kDAAA;AAAA,IACb,GAAK,EAAA,gBAAA;AAAA,IACL,KAAO,EAAA,sDAAA;AAAA,IACP,IAAA,EAAM,CAAC,OAAA,EAAS,QAAQ,CAAA;AAAA,GAC1B;AAAA,EACA;AAAA,IACE,KAAO,EAAA,UAAA;AAAA,IACP,WACE,EAAA,8EAAA;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;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
2
|
import { LoggerService } from '@backstage/backend-plugin-api';
|
|
3
3
|
import express from 'express';
|
|
4
|
-
import {
|
|
4
|
+
import { ExploreToolProvider as ExploreToolProvider$1 } from '@backstage-community/plugin-explore-node';
|
|
5
5
|
import { Config } from '@backstage/config';
|
|
6
|
+
import { ExploreTool, GetExploreToolsRequest, GetExploreToolsResponse } from '@backstage-community/plugin-explore-common';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The explore backend plugin.
|
|
9
10
|
*
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
|
-
declare const explorePlugin:
|
|
13
|
+
declare const explorePlugin: _backstage_backend_plugin_api.BackendFeatureCompat;
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @public
|
|
16
17
|
*/
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @param request - The request options {@link @backstage-community/plugin-explore-common#GetExploreToolsRequest}.
|
|
22
|
-
* @returns The response {@link @backstage-community/plugin-explore-common#GetExploreToolsResponse}.
|
|
23
|
-
*/
|
|
24
|
-
getTools(request: GetExploreToolsRequest): Promise<GetExploreToolsResponse>;
|
|
18
|
+
interface RouterOptions {
|
|
19
|
+
logger: LoggerService;
|
|
20
|
+
toolProvider: ExploreToolProvider$1;
|
|
25
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* A basic ExploreToolProvider implementation using static data.
|
|
29
29
|
*
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
|
-
declare class StaticExploreToolProvider implements ExploreToolProvider {
|
|
32
|
+
declare class StaticExploreToolProvider implements ExploreToolProvider$1 {
|
|
33
33
|
private readonly tools;
|
|
34
34
|
static fromConfig(config: Config): StaticExploreToolProvider;
|
|
35
35
|
static fromData(tools: ExploreTool[]): StaticExploreToolProvider;
|
|
@@ -38,15 +38,9 @@ declare class StaticExploreToolProvider implements ExploreToolProvider {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
+
* @deprecated Import from backstage-community/plugin-explore-node instead
|
|
41
42
|
* @public
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
-
logger: LoggerService;
|
|
45
|
-
toolProvider: ExploreToolProvider;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
44
|
+
type ExploreToolProvider = ExploreToolProvider$1;
|
|
51
45
|
|
|
52
46
|
export { type ExploreToolProvider, type RouterOptions, StaticExploreToolProvider, createRouter, explorePlugin as default };
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-explore-backend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"backstage": {
|
|
5
|
-
"role": "backend-plugin"
|
|
5
|
+
"role": "backend-plugin",
|
|
6
|
+
"pluginId": "explore",
|
|
7
|
+
"pluginPackages": [
|
|
8
|
+
"@backstage-community/plugin-explore",
|
|
9
|
+
"@backstage-community/plugin-explore-backend",
|
|
10
|
+
"@backstage-community/plugin-explore-common",
|
|
11
|
+
"@backstage-community/plugin-explore-node",
|
|
12
|
+
"@backstage-community/plugin-explore-react"
|
|
13
|
+
]
|
|
6
14
|
},
|
|
7
15
|
"publishConfig": {
|
|
8
16
|
"access": "public",
|
|
@@ -32,9 +40,10 @@
|
|
|
32
40
|
"test": "backstage-cli package test"
|
|
33
41
|
},
|
|
34
42
|
"dependencies": {
|
|
35
|
-
"@backstage-community/plugin-explore-common": "^0.0.
|
|
36
|
-
"@backstage/
|
|
37
|
-
"@backstage/backend-
|
|
43
|
+
"@backstage-community/plugin-explore-common": "^0.0.4",
|
|
44
|
+
"@backstage-community/plugin-explore-node": "^0.1.2",
|
|
45
|
+
"@backstage/backend-common": "^0.23.3",
|
|
46
|
+
"@backstage/backend-plugin-api": "^0.7.0",
|
|
38
47
|
"@backstage/config": "^1.2.0",
|
|
39
48
|
"@backstage/types": "^1.1.1",
|
|
40
49
|
"@types/express": "*",
|
|
@@ -45,8 +54,8 @@
|
|
|
45
54
|
"yn": "^4.0.0"
|
|
46
55
|
},
|
|
47
56
|
"devDependencies": {
|
|
48
|
-
"@backstage/backend-test-utils": "^0.
|
|
49
|
-
"@backstage/cli": "^0.26.
|
|
57
|
+
"@backstage/backend-test-utils": "^0.4.4",
|
|
58
|
+
"@backstage/cli": "^0.26.11",
|
|
50
59
|
"@types/lodash": "^4.14.151",
|
|
51
60
|
"@types/node-fetch": "^2.5.12",
|
|
52
61
|
"@types/supertest": "^2.0.8",
|