From 5211dd8d918cfa63cdd47f559cbba549460a16bb Mon Sep 17 00:00:00 2001 From: Tommy Le Date: Fri, 26 Jan 2024 15:44:30 +0100 Subject: [PATCH 01/24] fix: fix decoding issues in StackOverflowSearchResultListItem Signed-off-by: Tommy Le --- plugins/stack-overflow/package.json | 2 ++ .../StackOverflowSearchResultListItem.tsx | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/stack-overflow/package.json b/plugins/stack-overflow/package.json index de0aec1e61..5364ee59bb 100644 --- a/plugins/stack-overflow/package.json +++ b/plugins/stack-overflow/package.json @@ -54,6 +54,7 @@ "@testing-library/jest-dom": "^6.0.0", "@types/react": "^16.13.1 || ^17.0.0", "cross-fetch": "^4.0.0", + "he": "^1.2.0", "lodash": "^4.17.21", "qs": "^6.9.4", "react-use": "^17.2.4" @@ -69,6 +70,7 @@ "@testing-library/dom": "^9.0.0", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.0.0", + "@types/he": "^1.2.3", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx b/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx index 245666deeb..9e98d6612f 100644 --- a/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx +++ b/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx @@ -15,7 +15,6 @@ */ import React from 'react'; -import _unescape from 'lodash/unescape'; import { Link } from '@backstage/core-components'; import { Divider, @@ -26,8 +25,9 @@ import { Chip, } from '@material-ui/core'; import { useAnalytics } from '@backstage/core-plugin-api'; -import { ResultHighlight } from '@backstage/plugin-search-common'; +import type { ResultHighlight } from '@backstage/plugin-search-common'; import { HighlightedSearchResultText } from '@backstage/plugin-search-react'; +import { decode } from 'he'; /** * Props for {@link StackOverflowSearchResultListItem} @@ -48,6 +48,10 @@ export const StackOverflowSearchResultListItem = ( const analytics = useAnalytics(); const handleClick = () => { + if (!result) { + return; + } + analytics.captureEvent('discover', result.title, { attributes: { to: result.location }, value: props.rank, @@ -69,12 +73,12 @@ export const StackOverflowSearchResultListItem = ( {highlight?.fields?.title ? ( ) : ( - _unescape(result.title) + decode(result.title) )} } @@ -83,13 +87,13 @@ export const StackOverflowSearchResultListItem = ( <> Author:{' '} ) : ( - `Author: ${result.text}` + `Author: ${decode(result.text)}` ) } /> From c6779aca2da8103128a257afc18e1853f3797e90 Mon Sep 17 00:00:00 2001 From: Tommy Le Date: Fri, 26 Jan 2024 15:49:18 +0100 Subject: [PATCH 02/24] chore: add changeset Signed-off-by: Tommy Le --- .changeset/dry-impalas-serve.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dry-impalas-serve.md diff --git a/.changeset/dry-impalas-serve.md b/.changeset/dry-impalas-serve.md new file mode 100644 index 0000000000..709c0fb498 --- /dev/null +++ b/.changeset/dry-impalas-serve.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-stack-overflow': patch +--- + +fix: fix decode issues in title and author fields in StackOverflowSearchResultListItem From 30fadd61daf864217304fe0a203f15af4d78a3fd Mon Sep 17 00:00:00 2001 From: Tommy Le Date: Tue, 13 Feb 2024 13:25:12 +0100 Subject: [PATCH 03/24] refactor: removed he and added a util to decode html Signed-off-by: Tommy Le --- plugins/stack-overflow/package.json | 2 -- .../StackOverflowSearchResultListItem.tsx | 15 ++++++------- plugins/stack-overflow/src/util.ts | 21 +++++++++++++++++++ 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 plugins/stack-overflow/src/util.ts diff --git a/plugins/stack-overflow/package.json b/plugins/stack-overflow/package.json index 73498e2a53..c1a4f8f40b 100644 --- a/plugins/stack-overflow/package.json +++ b/plugins/stack-overflow/package.json @@ -54,7 +54,6 @@ "@testing-library/jest-dom": "^6.0.0", "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0", "cross-fetch": "^4.0.0", - "he": "^1.2.0", "lodash": "^4.17.21", "qs": "^6.9.4", "react-use": "^17.2.4" @@ -70,7 +69,6 @@ "@testing-library/dom": "^9.0.0", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.0.0", - "@types/he": "^1.2.3", "msw": "^1.0.0" }, "files": [ diff --git a/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx b/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx index 9e98d6612f..70e182b86d 100644 --- a/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx +++ b/plugins/stack-overflow/src/search/StackOverflowSearchResultListItem/StackOverflowSearchResultListItem.tsx @@ -27,7 +27,7 @@ import { import { useAnalytics } from '@backstage/core-plugin-api'; import type { ResultHighlight } from '@backstage/plugin-search-common'; import { HighlightedSearchResultText } from '@backstage/plugin-search-react'; -import { decode } from 'he'; +import { decodeHtml } from '../../util'; /** * Props for {@link StackOverflowSearchResultListItem} @@ -45,13 +45,10 @@ export const StackOverflowSearchResultListItem = ( props: StackOverflowSearchResultListItemProps, ) => { const { result, highlight } = props; + const analytics = useAnalytics(); const handleClick = () => { - if (!result) { - return; - } - analytics.captureEvent('discover', result.title, { attributes: { to: result.location }, value: props.rank, @@ -73,12 +70,12 @@ export const StackOverflowSearchResultListItem = ( {highlight?.fields?.title ? ( ) : ( - decode(result.title) + decodeHtml(result.title) )} } @@ -87,13 +84,13 @@ export const StackOverflowSearchResultListItem = ( <> Author:{' '} ) : ( - `Author: ${decode(result.text)}` + `Author: ${decodeHtml(result.text)}` ) } /> diff --git a/plugins/stack-overflow/src/util.ts b/plugins/stack-overflow/src/util.ts new file mode 100644 index 0000000000..a40ae905ea --- /dev/null +++ b/plugins/stack-overflow/src/util.ts @@ -0,0 +1,21 @@ +/* + * Copyright 2024 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. + */ + +export function decodeHtml(input: string) { + const textContainer = document.createElement('textarea'); + textContainer.innerHTML = input; + return textContainer.value; +} From 6faf825b662a6e9a9a64d22d9fe55fec81bbe1f8 Mon Sep 17 00:00:00 2001 From: Tommy Le Date: Tue, 13 Feb 2024 13:50:35 +0100 Subject: [PATCH 04/24] chore: update api-report Signed-off-by: Tommy Le --- plugins/stack-overflow/api-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/stack-overflow/api-report.md b/plugins/stack-overflow/api-report.md index 293c2ac226..7593db530f 100644 --- a/plugins/stack-overflow/api-report.md +++ b/plugins/stack-overflow/api-report.md @@ -10,7 +10,7 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { CardExtensionProps } from '@backstage/plugin-home-react'; import { JSX as JSX_2 } from 'react'; import { default as React_2 } from 'react'; -import { ResultHighlight } from '@backstage/plugin-search-common'; +import type { ResultHighlight } from '@backstage/plugin-search-common'; import { SearchResultListItemExtensionProps } from '@backstage/plugin-search-react'; // @public From a2327acaab7b36953c2f3cd6204ba19bfc9a3d71 Mon Sep 17 00:00:00 2001 From: Vladimir Kobzev Date: Thu, 15 Feb 2024 13:33:56 +0100 Subject: [PATCH 05/24] add word-break: normal to the "moved in direction" table header cell Signed-off-by: Vladimir Kobzev --- .changeset/poor-beans-cross.md | 5 +++++ .../src/components/RadarTimeline/RadarTimeline.tsx | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/poor-beans-cross.md diff --git a/.changeset/poor-beans-cross.md b/.changeset/poor-beans-cross.md new file mode 100644 index 0000000000..34c473a545 --- /dev/null +++ b/.changeset/poor-beans-cross.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-radar': patch +--- + +Fixed an issue with the "moved in direction" table header cell getting squished and becoming unreadable if a timeline description is too long diff --git a/plugins/tech-radar/src/components/RadarTimeline/RadarTimeline.tsx b/plugins/tech-radar/src/components/RadarTimeline/RadarTimeline.tsx index e54c4a499e..2456c26918 100644 --- a/plugins/tech-radar/src/components/RadarTimeline/RadarTimeline.tsx +++ b/plugins/tech-radar/src/components/RadarTimeline/RadarTimeline.tsx @@ -47,7 +47,9 @@ const RadarTimeline = (props: Props): JSX.Element => { - Moved in direction + + Moved in direction + Moved to ring Moved on date Description From f9b9926f4d8a4fc81c70ea8543ec7108cafe8f2b Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Thu, 15 Feb 2024 22:36:25 +0100 Subject: [PATCH 06/24] docs: add new community plugins project area Signed-off-by: Vincenzo Scamporlino --- OWNERS.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OWNERS.md b/OWNERS.md index 1e92e68c40..b8d317e2d3 100644 --- a/OWNERS.md +++ b/OWNERS.md @@ -108,6 +108,20 @@ Scope: The TechDocs plugin and related tooling These incubating project areas have shared ownership with @backstage/maintainers. +### Community Plugins + +Team: @backstage/community-plugins-maintainers + +Scope: Tooling related to the Backstage [Community Plugins repository](https://github.com/backstage/community-plugins) + +| Name | Organization | GitHub | Discord | +| -------------------- | ------------ | ------------------------------------------- | ------------ | +| Bethany Griggs | Red Hat | [BethGriggs](https://github.com/BethGriggs) | `bethgriggs` | +| Tomas Kral | Red Hat | [kadel](https://github.com/kadel) | `tomkral` | +| André Wanlin | Spotify | [awanlin](https://github.com/awanlin) | `ahhhndre` | +| Philipp Hugenroth | Spotify | [tudi2d](https://github.com/tudi2d) | `tudi2d` | +| Vincenzo Scamporlino | Spotify | [vinzscam](https://github.com/vinzscam) | `vinzscam` | + ### OpenAPI Tooling Team: @backstage/openapi-tooling-maintainers From a0e33935a9d7847a4276cd90464bef5e5f993953 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 18 Feb 2024 08:56:32 -0600 Subject: [PATCH 07/24] Updated to use `fetchApi` as per ADR013 Signed-off-by: Andre Wanlin --- .changeset/olive-mails-tell.md | 7 +++++++ plugins/azure-devops/api-report.md | 2 ++ plugins/azure-devops/src/alpha/plugin.tsx | 11 ++++++++--- plugins/azure-devops/src/api/AzureDevOpsClient.ts | 11 +++++++++-- plugins/azure-devops/src/plugin.ts | 11 ++++++++--- plugins/devtools/src/alpha/plugin.tsx | 11 ++++++++--- plugins/devtools/src/api/DevToolsClient.ts | 11 +++++++++-- plugins/devtools/src/plugin.ts | 11 ++++++++--- plugins/linguist/src/alpha/plugin.tsx | 11 ++++++++--- plugins/linguist/src/api/LinguistClient.ts | 11 +++++++++-- plugins/linguist/src/plugin.ts | 11 ++++++++--- 11 files changed, 84 insertions(+), 24 deletions(-) create mode 100644 .changeset/olive-mails-tell.md diff --git a/.changeset/olive-mails-tell.md b/.changeset/olive-mails-tell.md new file mode 100644 index 0000000000..763338c6ff --- /dev/null +++ b/.changeset/olive-mails-tell.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-azure-devops': patch +'@backstage/plugin-devtools': patch +'@backstage/plugin-linguist': patch +--- + +Updated to use `fetchApi` as per [ADR013](https://backstage.io/docs/architecture-decisions/adrs-adr013) diff --git a/plugins/azure-devops/api-report.md b/plugins/azure-devops/api-report.md index cfff4348ee..3eeb4d8dca 100644 --- a/plugins/azure-devops/api-report.md +++ b/plugins/azure-devops/api-report.md @@ -12,6 +12,7 @@ import { BuildRunOptions } from '@backstage/plugin-azure-devops-common'; import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common'; import { DiscoveryApi } from '@backstage/core-plugin-api'; import { Entity } from '@backstage/catalog-model'; +import { FetchApi } from '@backstage/core-plugin-api'; import { GitTag } from '@backstage/plugin-azure-devops-common'; import { IdentityApi } from '@backstage/core-plugin-api'; import { JSX as JSX_2 } from 'react'; @@ -124,6 +125,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi { constructor(options: { discoveryApi: DiscoveryApi; identityApi: IdentityApi; + fetchApi: FetchApi; }); // (undocumented) getAllTeams(): Promise; diff --git a/plugins/azure-devops/src/alpha/plugin.tsx b/plugins/azure-devops/src/alpha/plugin.tsx index 40305c1714..54ac3469be 100644 --- a/plugins/azure-devops/src/alpha/plugin.tsx +++ b/plugins/azure-devops/src/alpha/plugin.tsx @@ -21,6 +21,7 @@ import { createPageExtension, createPlugin, discoveryApiRef, + fetchApiRef, identityApiRef, } from '@backstage/frontend-plugin-api'; import { azureDevOpsApiRef, AzureDevOpsClient } from '../api'; @@ -38,9 +39,13 @@ import { azurePullRequestDashboardRouteRef } from '../routes'; export const azureDevOpsApi = createApiExtension({ factory: createApiFactory({ api: azureDevOpsApiRef, - deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef }, - factory: ({ discoveryApi, identityApi }) => - new AzureDevOpsClient({ discoveryApi, identityApi }), + deps: { + discoveryApi: discoveryApiRef, + identityApi: identityApiRef, + fetchApi: fetchApiRef, + }, + factory: ({ discoveryApi, identityApi, fetchApi }) => + new AzureDevOpsClient({ discoveryApi, identityApi, fetchApi }), }), }); diff --git a/plugins/azure-devops/src/api/AzureDevOpsClient.ts b/plugins/azure-devops/src/api/AzureDevOpsClient.ts index 76e38b064c..f7f3564563 100644 --- a/plugins/azure-devops/src/api/AzureDevOpsClient.ts +++ b/plugins/azure-devops/src/api/AzureDevOpsClient.ts @@ -27,7 +27,11 @@ import { RepoBuildOptions, Team, } from '@backstage/plugin-azure-devops-common'; -import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api'; +import { + DiscoveryApi, + FetchApi, + IdentityApi, +} from '@backstage/core-plugin-api'; import { ResponseError } from '@backstage/errors'; import { AzureDevOpsApi } from './AzureDevOpsApi'; @@ -35,13 +39,16 @@ import { AzureDevOpsApi } from './AzureDevOpsApi'; export class AzureDevOpsClient implements AzureDevOpsApi { private readonly discoveryApi: DiscoveryApi; private readonly identityApi: IdentityApi; + private readonly fetchApi: FetchApi; public constructor(options: { discoveryApi: DiscoveryApi; identityApi: IdentityApi; + fetchApi: FetchApi; }) { this.discoveryApi = options.discoveryApi; this.identityApi = options.identityApi; + this.fetchApi = options.fetchApi; } public async getRepoBuilds( @@ -201,7 +208,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi { const url = new URL(path, baseUrl); const { token: idToken } = await this.identityApi.getCredentials(); - const response = await fetch(url.toString(), { + const response = await this.fetchApi.fetch(url.toString(), { headers: idToken ? { Authorization: `Bearer ${idToken}` } : {}, }); diff --git a/plugins/azure-devops/src/plugin.ts b/plugins/azure-devops/src/plugin.ts index 1e76c9e53a..e06ea8f5e0 100644 --- a/plugins/azure-devops/src/plugin.ts +++ b/plugins/azure-devops/src/plugin.ts @@ -27,6 +27,7 @@ import { createComponentExtension, discoveryApiRef, identityApiRef, + fetchApiRef, } from '@backstage/core-plugin-api'; import { AzureDevOpsClient } from './api/AzureDevOpsClient'; @@ -56,9 +57,13 @@ export const azureDevOpsPlugin = createPlugin({ apis: [ createApiFactory({ api: azureDevOpsApiRef, - deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef }, - factory: ({ discoveryApi, identityApi }) => - new AzureDevOpsClient({ discoveryApi, identityApi }), + deps: { + discoveryApi: discoveryApiRef, + identityApi: identityApiRef, + fetchApi: fetchApiRef, + }, + factory: ({ discoveryApi, identityApi, fetchApi }) => + new AzureDevOpsClient({ discoveryApi, identityApi, fetchApi }), }), ], }); diff --git a/plugins/devtools/src/alpha/plugin.tsx b/plugins/devtools/src/alpha/plugin.tsx index 746b90a50f..1854fbfbd9 100644 --- a/plugins/devtools/src/alpha/plugin.tsx +++ b/plugins/devtools/src/alpha/plugin.tsx @@ -22,6 +22,7 @@ import { createPageExtension, createPlugin, discoveryApiRef, + fetchApiRef, identityApiRef, } from '@backstage/frontend-plugin-api'; @@ -37,9 +38,13 @@ import { rootRouteRef } from '../routes'; export const devToolsApi = createApiExtension({ factory: createApiFactory({ api: devToolsApiRef, - deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef }, - factory: ({ discoveryApi, identityApi }) => - new DevToolsClient({ discoveryApi, identityApi }), + deps: { + discoveryApi: discoveryApiRef, + identityApi: identityApiRef, + fetchApi: fetchApiRef, + }, + factory: ({ discoveryApi, identityApi, fetchApi }) => + new DevToolsClient({ discoveryApi, identityApi, fetchApi }), }), }); diff --git a/plugins/devtools/src/api/DevToolsClient.ts b/plugins/devtools/src/api/DevToolsClient.ts index 0be8294b3f..1702333363 100644 --- a/plugins/devtools/src/api/DevToolsClient.ts +++ b/plugins/devtools/src/api/DevToolsClient.ts @@ -14,7 +14,11 @@ * limitations under the License. */ -import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api'; +import { + DiscoveryApi, + FetchApi, + IdentityApi, +} from '@backstage/core-plugin-api'; import { ConfigInfo, DevToolsInfo, @@ -26,13 +30,16 @@ import { DevToolsApi } from './DevToolsApi'; export class DevToolsClient implements DevToolsApi { private readonly discoveryApi: DiscoveryApi; private readonly identityApi: IdentityApi; + private readonly fetchApi: FetchApi; public constructor(options: { discoveryApi: DiscoveryApi; identityApi: IdentityApi; + fetchApi: FetchApi; }) { this.discoveryApi = options.discoveryApi; this.identityApi = options.identityApi; + this.fetchApi = options.fetchApi; } public async getConfig(): Promise { @@ -65,7 +72,7 @@ export class DevToolsClient implements DevToolsApi { const url = new URL(path, baseUrl); const { token } = await this.identityApi.getCredentials(); - const response = await fetch(url.toString(), { + const response = await this.fetchApi.fetch(url.toString(), { headers: token ? { Authorization: `Bearer ${token}` } : {}, }); diff --git a/plugins/devtools/src/plugin.ts b/plugins/devtools/src/plugin.ts index df2aca3447..8bf61b1fba 100644 --- a/plugins/devtools/src/plugin.ts +++ b/plugins/devtools/src/plugin.ts @@ -19,6 +19,7 @@ import { createPlugin, createRoutableExtension, discoveryApiRef, + fetchApiRef, identityApiRef, } from '@backstage/core-plugin-api'; import { devToolsApiRef, DevToolsClient } from './api'; @@ -31,9 +32,13 @@ export const devToolsPlugin = createPlugin({ apis: [ createApiFactory({ api: devToolsApiRef, - deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef }, - factory: ({ discoveryApi, identityApi }) => - new DevToolsClient({ discoveryApi, identityApi }), + deps: { + discoveryApi: discoveryApiRef, + identityApi: identityApiRef, + fetchApi: fetchApiRef, + }, + factory: ({ discoveryApi, identityApi, fetchApi }) => + new DevToolsClient({ discoveryApi, identityApi, fetchApi }), }), ], routes: { diff --git a/plugins/linguist/src/alpha/plugin.tsx b/plugins/linguist/src/alpha/plugin.tsx index 36d635740f..fc552de26c 100644 --- a/plugins/linguist/src/alpha/plugin.tsx +++ b/plugins/linguist/src/alpha/plugin.tsx @@ -20,6 +20,7 @@ import { createApiFactory, createPlugin, discoveryApiRef, + fetchApiRef, identityApiRef, } from '@backstage/frontend-plugin-api'; @@ -40,9 +41,13 @@ export const entityLinguistCard = createEntityCardExtension({ export const linguistApi = createApiExtension({ factory: createApiFactory({ api: linguistApiRef, - deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef }, - factory: ({ discoveryApi, identityApi }) => - new LinguistClient({ discoveryApi, identityApi }), + deps: { + discoveryApi: discoveryApiRef, + identityApi: identityApiRef, + fetchApi: fetchApiRef, + }, + factory: ({ discoveryApi, identityApi, fetchApi }) => + new LinguistClient({ discoveryApi, identityApi, fetchApi }), }), }); diff --git a/plugins/linguist/src/api/LinguistClient.ts b/plugins/linguist/src/api/LinguistClient.ts index 3e327ff21e..0a8e547ccc 100644 --- a/plugins/linguist/src/api/LinguistClient.ts +++ b/plugins/linguist/src/api/LinguistClient.ts @@ -14,7 +14,11 @@ * limitations under the License. */ -import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api'; +import { + DiscoveryApi, + FetchApi, + IdentityApi, +} from '@backstage/core-plugin-api'; import { ResponseError } from '@backstage/errors'; import { Languages } from '@backstage/plugin-linguist-common'; import { LinguistApi } from './LinguistApi'; @@ -22,13 +26,16 @@ import { LinguistApi } from './LinguistApi'; export class LinguistClient implements LinguistApi { private readonly discoveryApi: DiscoveryApi; private readonly identityApi: IdentityApi; + private readonly fetchApi: FetchApi; public constructor(options: { discoveryApi: DiscoveryApi; identityApi: IdentityApi; + fetchApi: FetchApi; }) { this.discoveryApi = options.discoveryApi; this.identityApi = options.identityApi; + this.fetchApi = options.fetchApi; } public async getLanguages(entityRef: string): Promise { @@ -46,7 +53,7 @@ export class LinguistClient implements LinguistApi { const url = new URL(path, baseUrl); const { token } = await this.identityApi.getCredentials(); - const response = await fetch(url.toString(), { + const response = await this.fetchApi.fetch(url.toString(), { headers: token ? { Authorization: `Bearer ${token}` } : {}, }); diff --git a/plugins/linguist/src/plugin.ts b/plugins/linguist/src/plugin.ts index 917a13ca9a..e93dc5eaa7 100644 --- a/plugins/linguist/src/plugin.ts +++ b/plugins/linguist/src/plugin.ts @@ -19,6 +19,7 @@ import { createComponentExtension, createPlugin, discoveryApiRef, + fetchApiRef, identityApiRef, } from '@backstage/core-plugin-api'; import { linguistApiRef, LinguistClient } from './api'; @@ -35,9 +36,13 @@ export const linguistPlugin = createPlugin({ apis: [ createApiFactory({ api: linguistApiRef, - deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef }, - factory: ({ discoveryApi, identityApi }) => - new LinguistClient({ discoveryApi, identityApi }), + deps: { + discoveryApi: discoveryApiRef, + identityApi: identityApiRef, + fetchApi: fetchApiRef, + }, + factory: ({ discoveryApi, identityApi, fetchApi }) => + new LinguistClient({ discoveryApi, identityApi, fetchApi }), }), ], }); From 1d6af04ad0451ce13d41c6192456553b05f37b15 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 18 Feb 2024 09:19:04 -0600 Subject: [PATCH 08/24] Refactored to removed items cover by fetchApi Signed-off-by: Andre Wanlin --- plugins/azure-devops/api-report.md | 7 +------ plugins/azure-devops/src/alpha/plugin.tsx | 6 ++---- plugins/azure-devops/src/api/AzureDevOpsClient.ts | 14 ++------------ plugins/azure-devops/src/plugin.ts | 4 ++-- plugins/devtools/src/alpha/plugin.tsx | 6 ++---- plugins/devtools/src/api/DevToolsClient.ts | 14 ++------------ plugins/devtools/src/plugin.ts | 6 ++---- plugins/linguist/src/alpha/plugin.tsx | 6 ++---- plugins/linguist/src/api/LinguistClient.ts | 14 ++------------ plugins/linguist/src/plugin.ts | 6 ++---- 10 files changed, 19 insertions(+), 64 deletions(-) diff --git a/plugins/azure-devops/api-report.md b/plugins/azure-devops/api-report.md index 3eeb4d8dca..e4e2d4306f 100644 --- a/plugins/azure-devops/api-report.md +++ b/plugins/azure-devops/api-report.md @@ -14,7 +14,6 @@ import { DiscoveryApi } from '@backstage/core-plugin-api'; import { Entity } from '@backstage/catalog-model'; import { FetchApi } from '@backstage/core-plugin-api'; import { GitTag } from '@backstage/plugin-azure-devops-common'; -import { IdentityApi } from '@backstage/core-plugin-api'; import { JSX as JSX_2 } from 'react'; import { PullRequest } from '@backstage/plugin-azure-devops-common'; import { PullRequestOptions } from '@backstage/plugin-azure-devops-common'; @@ -122,11 +121,7 @@ export const azureDevOpsApiRef: ApiRef; // @public (undocumented) export class AzureDevOpsClient implements AzureDevOpsApi { - constructor(options: { - discoveryApi: DiscoveryApi; - identityApi: IdentityApi; - fetchApi: FetchApi; - }); + constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi }); // (undocumented) getAllTeams(): Promise; // (undocumented) diff --git a/plugins/azure-devops/src/alpha/plugin.tsx b/plugins/azure-devops/src/alpha/plugin.tsx index 54ac3469be..62d8719324 100644 --- a/plugins/azure-devops/src/alpha/plugin.tsx +++ b/plugins/azure-devops/src/alpha/plugin.tsx @@ -22,7 +22,6 @@ import { createPlugin, discoveryApiRef, fetchApiRef, - identityApiRef, } from '@backstage/frontend-plugin-api'; import { azureDevOpsApiRef, AzureDevOpsClient } from '../api'; import { @@ -41,11 +40,10 @@ export const azureDevOpsApi = createApiExtension({ api: azureDevOpsApiRef, deps: { discoveryApi: discoveryApiRef, - identityApi: identityApiRef, fetchApi: fetchApiRef, }, - factory: ({ discoveryApi, identityApi, fetchApi }) => - new AzureDevOpsClient({ discoveryApi, identityApi, fetchApi }), + factory: ({ discoveryApi, fetchApi }) => + new AzureDevOpsClient({ discoveryApi, fetchApi }), }), }); diff --git a/plugins/azure-devops/src/api/AzureDevOpsClient.ts b/plugins/azure-devops/src/api/AzureDevOpsClient.ts index f7f3564563..6812c077a6 100644 --- a/plugins/azure-devops/src/api/AzureDevOpsClient.ts +++ b/plugins/azure-devops/src/api/AzureDevOpsClient.ts @@ -27,27 +27,20 @@ import { RepoBuildOptions, Team, } from '@backstage/plugin-azure-devops-common'; -import { - DiscoveryApi, - FetchApi, - IdentityApi, -} from '@backstage/core-plugin-api'; +import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api'; import { ResponseError } from '@backstage/errors'; import { AzureDevOpsApi } from './AzureDevOpsApi'; /** @public */ export class AzureDevOpsClient implements AzureDevOpsApi { private readonly discoveryApi: DiscoveryApi; - private readonly identityApi: IdentityApi; private readonly fetchApi: FetchApi; public constructor(options: { discoveryApi: DiscoveryApi; - identityApi: IdentityApi; fetchApi: FetchApi; }) { this.discoveryApi = options.discoveryApi; - this.identityApi = options.identityApi; this.fetchApi = options.fetchApi; } @@ -207,10 +200,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi { const baseUrl = `${await this.discoveryApi.getBaseUrl('azure-devops')}/`; const url = new URL(path, baseUrl); - const { token: idToken } = await this.identityApi.getCredentials(); - const response = await this.fetchApi.fetch(url.toString(), { - headers: idToken ? { Authorization: `Bearer ${idToken}` } : {}, - }); + const response = await this.fetchApi.fetch(url.toString()); if (!response.ok) { throw await ResponseError.fromResponse(response); diff --git a/plugins/azure-devops/src/plugin.ts b/plugins/azure-devops/src/plugin.ts index e06ea8f5e0..9094eb8d2a 100644 --- a/plugins/azure-devops/src/plugin.ts +++ b/plugins/azure-devops/src/plugin.ts @@ -62,8 +62,8 @@ export const azureDevOpsPlugin = createPlugin({ identityApi: identityApiRef, fetchApi: fetchApiRef, }, - factory: ({ discoveryApi, identityApi, fetchApi }) => - new AzureDevOpsClient({ discoveryApi, identityApi, fetchApi }), + factory: ({ discoveryApi, fetchApi }) => + new AzureDevOpsClient({ discoveryApi, fetchApi }), }), ], }); diff --git a/plugins/devtools/src/alpha/plugin.tsx b/plugins/devtools/src/alpha/plugin.tsx index 1854fbfbd9..0420556504 100644 --- a/plugins/devtools/src/alpha/plugin.tsx +++ b/plugins/devtools/src/alpha/plugin.tsx @@ -23,7 +23,6 @@ import { createPlugin, discoveryApiRef, fetchApiRef, - identityApiRef, } from '@backstage/frontend-plugin-api'; import { devToolsApiRef, DevToolsClient } from '../api'; @@ -40,11 +39,10 @@ export const devToolsApi = createApiExtension({ api: devToolsApiRef, deps: { discoveryApi: discoveryApiRef, - identityApi: identityApiRef, fetchApi: fetchApiRef, }, - factory: ({ discoveryApi, identityApi, fetchApi }) => - new DevToolsClient({ discoveryApi, identityApi, fetchApi }), + factory: ({ discoveryApi, fetchApi }) => + new DevToolsClient({ discoveryApi, fetchApi }), }), }); diff --git a/plugins/devtools/src/api/DevToolsClient.ts b/plugins/devtools/src/api/DevToolsClient.ts index 1702333363..e0b387a6ca 100644 --- a/plugins/devtools/src/api/DevToolsClient.ts +++ b/plugins/devtools/src/api/DevToolsClient.ts @@ -14,11 +14,7 @@ * limitations under the License. */ -import { - DiscoveryApi, - FetchApi, - IdentityApi, -} from '@backstage/core-plugin-api'; +import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api'; import { ConfigInfo, DevToolsInfo, @@ -29,16 +25,13 @@ import { DevToolsApi } from './DevToolsApi'; export class DevToolsClient implements DevToolsApi { private readonly discoveryApi: DiscoveryApi; - private readonly identityApi: IdentityApi; private readonly fetchApi: FetchApi; public constructor(options: { discoveryApi: DiscoveryApi; - identityApi: IdentityApi; fetchApi: FetchApi; }) { this.discoveryApi = options.discoveryApi; - this.identityApi = options.identityApi; this.fetchApi = options.fetchApi; } @@ -71,10 +64,7 @@ export class DevToolsClient implements DevToolsApi { const baseUrl = `${await this.discoveryApi.getBaseUrl('devtools')}/`; const url = new URL(path, baseUrl); - const { token } = await this.identityApi.getCredentials(); - const response = await this.fetchApi.fetch(url.toString(), { - headers: token ? { Authorization: `Bearer ${token}` } : {}, - }); + const response = await this.fetchApi.fetch(url.toString()); if (!response.ok) { throw await ResponseError.fromResponse(response); diff --git a/plugins/devtools/src/plugin.ts b/plugins/devtools/src/plugin.ts index 8bf61b1fba..77a90746f1 100644 --- a/plugins/devtools/src/plugin.ts +++ b/plugins/devtools/src/plugin.ts @@ -20,7 +20,6 @@ import { createRoutableExtension, discoveryApiRef, fetchApiRef, - identityApiRef, } from '@backstage/core-plugin-api'; import { devToolsApiRef, DevToolsClient } from './api'; @@ -34,11 +33,10 @@ export const devToolsPlugin = createPlugin({ api: devToolsApiRef, deps: { discoveryApi: discoveryApiRef, - identityApi: identityApiRef, fetchApi: fetchApiRef, }, - factory: ({ discoveryApi, identityApi, fetchApi }) => - new DevToolsClient({ discoveryApi, identityApi, fetchApi }), + factory: ({ discoveryApi, fetchApi }) => + new DevToolsClient({ discoveryApi, fetchApi }), }), ], routes: { diff --git a/plugins/linguist/src/alpha/plugin.tsx b/plugins/linguist/src/alpha/plugin.tsx index fc552de26c..2c47346538 100644 --- a/plugins/linguist/src/alpha/plugin.tsx +++ b/plugins/linguist/src/alpha/plugin.tsx @@ -21,7 +21,6 @@ import { createPlugin, discoveryApiRef, fetchApiRef, - identityApiRef, } from '@backstage/frontend-plugin-api'; import { LinguistClient, linguistApiRef } from '../api'; @@ -43,11 +42,10 @@ export const linguistApi = createApiExtension({ api: linguistApiRef, deps: { discoveryApi: discoveryApiRef, - identityApi: identityApiRef, fetchApi: fetchApiRef, }, - factory: ({ discoveryApi, identityApi, fetchApi }) => - new LinguistClient({ discoveryApi, identityApi, fetchApi }), + factory: ({ discoveryApi, fetchApi }) => + new LinguistClient({ discoveryApi, fetchApi }), }), }); diff --git a/plugins/linguist/src/api/LinguistClient.ts b/plugins/linguist/src/api/LinguistClient.ts index 0a8e547ccc..5e687a039b 100644 --- a/plugins/linguist/src/api/LinguistClient.ts +++ b/plugins/linguist/src/api/LinguistClient.ts @@ -14,27 +14,20 @@ * limitations under the License. */ -import { - DiscoveryApi, - FetchApi, - IdentityApi, -} from '@backstage/core-plugin-api'; +import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api'; import { ResponseError } from '@backstage/errors'; import { Languages } from '@backstage/plugin-linguist-common'; import { LinguistApi } from './LinguistApi'; export class LinguistClient implements LinguistApi { private readonly discoveryApi: DiscoveryApi; - private readonly identityApi: IdentityApi; private readonly fetchApi: FetchApi; public constructor(options: { discoveryApi: DiscoveryApi; - identityApi: IdentityApi; fetchApi: FetchApi; }) { this.discoveryApi = options.discoveryApi; - this.identityApi = options.identityApi; this.fetchApi = options.fetchApi; } @@ -52,10 +45,7 @@ export class LinguistClient implements LinguistApi { const baseUrl = `${await this.discoveryApi.getBaseUrl('linguist')}/`; const url = new URL(path, baseUrl); - const { token } = await this.identityApi.getCredentials(); - const response = await this.fetchApi.fetch(url.toString(), { - headers: token ? { Authorization: `Bearer ${token}` } : {}, - }); + const response = await this.fetchApi.fetch(url.toString()); if (!response.ok) { throw await ResponseError.fromResponse(response); diff --git a/plugins/linguist/src/plugin.ts b/plugins/linguist/src/plugin.ts index e93dc5eaa7..11f74a381c 100644 --- a/plugins/linguist/src/plugin.ts +++ b/plugins/linguist/src/plugin.ts @@ -20,7 +20,6 @@ import { createPlugin, discoveryApiRef, fetchApiRef, - identityApiRef, } from '@backstage/core-plugin-api'; import { linguistApiRef, LinguistClient } from './api'; import { LINGUIST_ANNOTATION } from '@backstage/plugin-linguist-common'; @@ -38,11 +37,10 @@ export const linguistPlugin = createPlugin({ api: linguistApiRef, deps: { discoveryApi: discoveryApiRef, - identityApi: identityApiRef, fetchApi: fetchApiRef, }, - factory: ({ discoveryApi, identityApi, fetchApi }) => - new LinguistClient({ discoveryApi, identityApi, fetchApi }), + factory: ({ discoveryApi, fetchApi }) => + new LinguistClient({ discoveryApi, fetchApi }), }), ], }); From a9e7bd6e42d2e34b74e0df75fb0989392707677e Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 18 Feb 2024 09:30:35 -0600 Subject: [PATCH 09/24] Adjusted changeset Signed-off-by: Andre Wanlin --- .changeset/olive-mails-tell.md | 1 - .changeset/rude-sheep-jam.md | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/rude-sheep-jam.md diff --git a/.changeset/olive-mails-tell.md b/.changeset/olive-mails-tell.md index 763338c6ff..5f82656679 100644 --- a/.changeset/olive-mails-tell.md +++ b/.changeset/olive-mails-tell.md @@ -1,5 +1,4 @@ --- -'@backstage/plugin-azure-devops': patch '@backstage/plugin-devtools': patch '@backstage/plugin-linguist': patch --- diff --git a/.changeset/rude-sheep-jam.md b/.changeset/rude-sheep-jam.md new file mode 100644 index 0000000000..75b0354e9c --- /dev/null +++ b/.changeset/rude-sheep-jam.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-azure-devops': minor +--- + +**BREAKING** The `AzureDevOpsClient` no longer requires `identityAPi` but now requires `fetchApi`. + +Updated to use `fetchApi` as per [ADR013](https://backstage.io/docs/architecture-decisions/adrs-adr013) From f6283a0a03ab024c8dac94030e48202015f66624 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 18 Feb 2024 09:46:31 -0600 Subject: [PATCH 10/24] Clean up based on feedback Signed-off-by: Andre Wanlin --- plugins/azure-devops/src/plugin.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/azure-devops/src/plugin.ts b/plugins/azure-devops/src/plugin.ts index 9094eb8d2a..b35f16de2d 100644 --- a/plugins/azure-devops/src/plugin.ts +++ b/plugins/azure-devops/src/plugin.ts @@ -26,7 +26,6 @@ import { createRoutableExtension, createComponentExtension, discoveryApiRef, - identityApiRef, fetchApiRef, } from '@backstage/core-plugin-api'; @@ -59,7 +58,6 @@ export const azureDevOpsPlugin = createPlugin({ api: azureDevOpsApiRef, deps: { discoveryApi: discoveryApiRef, - identityApi: identityApiRef, fetchApi: fetchApiRef, }, factory: ({ discoveryApi, fetchApi }) => From 55827a49d10f7f5eefd05e8a207e668f20b59309 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Mon, 19 Feb 2024 13:21:31 +0100 Subject: [PATCH 11/24] Update OWNERS.md Co-authored-by: Ben Lambert Signed-off-by: Vincenzo Scamporlino --- OWNERS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OWNERS.md b/OWNERS.md index b8d317e2d3..66df7e1a35 100644 --- a/OWNERS.md +++ b/OWNERS.md @@ -112,7 +112,7 @@ These incubating project areas have shared ownership with @backstage/maintainers Team: @backstage/community-plugins-maintainers -Scope: Tooling related to the Backstage [Community Plugins repository](https://github.com/backstage/community-plugins) +Scope: Tooling and Community Repo Maintainers for the Backstage [Community Plugins repository](https://github.com/backstage/community-plugins) | Name | Organization | GitHub | Discord | | -------------------- | ------------ | ------------------------------------------- | ------------ | From ffa828b7f2961b3c96cd666d945f78cc2711e252 Mon Sep 17 00:00:00 2001 From: Marek Libra Date: Thu, 15 Feb 2024 12:54:48 +0100 Subject: [PATCH 12/24] chore(notifications): narrow the scope to messaging Signed-off-by: Marek Libra --- beps/0001-notifications-system/README.md | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/beps/0001-notifications-system/README.md b/beps/0001-notifications-system/README.md index e3507d05fa..e071b36a06 100644 --- a/beps/0001-notifications-system/README.md +++ b/beps/0001-notifications-system/README.md @@ -96,7 +96,6 @@ The notification backend stores notification using the [database service](https: - ID - Read date -- Done date - Saved status - Creation date - Updated date (optional, for scoped notifications) @@ -104,7 +103,8 @@ The notification backend stores notification using the [database service](https: - Title - Description (optional) - Origin - - Link + - Link (optional) + - Additional links (optional) - Recipients - Severity (optional, default normal) - Topic (optional) @@ -113,6 +113,10 @@ The notification backend stores notification using the [database service](https: The recipients is **not** a list of users, but rather a filter that describes who should receive the notification. It must be possible to evaluate this filter in a database query, so that we can efficiently fetch all notifications for a given user. The same filter will also be used by the signal backend to determine which users should receive a signal. +The read date is a timestamp of marking the notifications as read by the user. If missing, the notification is still unread. + +The saved status is a timestamp indicating when/if the user marked the notification for better visibility in the future (to "pin" the message). Can be undefined. + The title is mandatory human-readable text shortly describing the notifications. The description is an optional human-readable text providing more details to the user. @@ -143,6 +147,8 @@ The link is a relative or absolute URL. As an example, it can be used: - by an external system to request an action within an asynchronous task - by a BE plugin to provide link to other part of the Backstage UI (i.e. to the Catalog) +The additional links are an array of title-URL pairs. They can represent immediate actions on the notification (i.e. yes-no) or lead the user to additional details. + The `notification-backend` does not provide any new permissions, since creating notifications can only be done by other backend plugins, while reading notifications can only be done by the authenticated user. It is possible that we want to add a permissions for reading notifications, in particular for admin and impersonation use cases, but that is not part of this proposal or the initial implementation. The `notification-backend` shall provide necessary parameters for paging and filtering notifications from the frontend. @@ -228,7 +234,7 @@ interface NotificationService { Each notification is always routed to individual users unless it's a broadcast. The `notification-backend` will figure out which users will receive a notification based on the `recipients` parameter, resolving it to the concrete list of users at the time of sending the notification. -Each notification contains a `title` and a `link` for user to see further information. The `created`, `id`, `read` and `saved` properties are handled by the backend based and cannot be changed during the notification creation. +Each notification contains a human readable `title`, `origin` and optionally `link` for additional details. The `created`, `id`, `read` and `saved` properties are handled by the backend based and cannot be passed during the notification creation. Calling `sendNotification` should never throw an error so that it doesn't block the current processing. Notifications should be considered as second-level citizens that are not critical if not delivered. @@ -273,37 +279,31 @@ Example signal payload for a new notification: Notification frontend shows users their own notifications in its own page and the number of unread notifications in the main menu item. -By default, notifications that are `undone` will be shown in the notifications view. The notification `read` status is indicated by the UI. +Notifications are set to `read` when the `Mark as read` action is triggered by the user (bulk or single). -Notifications are set to `read` when the notification link is opened or the notification is set as `done` by the user. +Notifications can be saved for better visibility in the future. -Notifications can be set to `done` by the user, and they are filtered out of the main view. +Notifications can be filtered by `read`, `saved`, `content` (text search in title or description), `created` (since multiple predefined options) and `severity`. -Notifications can be saved for later use by the user. - -Notifications can be filtered by their `read`, `done` and `saved` statuses. - -Notifications are displayed in pages. - -User can search for notifications based on their title and description. +Notifications are displayed in pages. To do so, the backend needs to implement filtering and sorting. The following frontend API is added as part of this proposal. #### `NotificationsApi` ```ts -export type NotificationType = 'undone' | 'done' | 'saved'; +export type NotificationSeverity = 'critical' | 'high' | 'normal' | 'low'; export type GetNotificationsOptions = { - type?: NotificationType; offset?: number; limit?: number; search?: string; + createdSince?: Date; + severity?: NotificationSeverity; }; export type NotificationUpdateOptions = { ids: string[]; - done?: boolean; read?: boolean; saved?: boolean; }; @@ -358,7 +358,7 @@ interface SignalApi { - Replace absent signal service with long polling. This requires changes to the `signals` plugin as well. - Render dynamic values with various different React elements such as the `EntityRefLink` for entity references (for example `{{ user:default/john.doe }}`) in the notification payload -- Handle `link` values that use route references. For example instead hard-coding link to `/catalog/default/component/artist-web` it should be possible to use `catalogPlugin.catalogEntity` route reference as a link of the notification. This should also allow using parameters to be passed to the route reference +- Handle `link` values that use route references. For example instead hard-coding link to `/catalog/default/component/artist-web` it should be possible to use `catalogPlugin.catalogEntity` route reference as a link of the notification. This should also allow using parameters to be passed to the route reference. Links to external systems are still supported. - Add support for `analyticsApi` to notification actions like marking notifications done, saved or opening links in the notifications - Add support for user settings to control how notifications are shown to the user and which notifications user wants to receive. This should also include support for different `NotificationProcessor`s that can send notification to external systems - Add a sound to be played when notification is received From 72d705a069a5a0d1e351f4a58b812c2fd3c39f01 Mon Sep 17 00:00:00 2001 From: Tommy Le Date: Tue, 20 Feb 2024 17:30:36 +0100 Subject: [PATCH 13/24] chore: update changeset Signed-off-by: Tommy Le --- .changeset/dry-impalas-serve.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/dry-impalas-serve.md b/.changeset/dry-impalas-serve.md index 709c0fb498..3b1f502b9c 100644 --- a/.changeset/dry-impalas-serve.md +++ b/.changeset/dry-impalas-serve.md @@ -2,4 +2,4 @@ '@backstage/plugin-stack-overflow': patch --- -fix: fix decode issues in title and author fields in StackOverflowSearchResultListItem +fix: fix decode issues in title and author fields in `StackOverflowSearchResultListItem` From a5b07ab46f1c27d3c3eae9d710200d85fbf285f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 7 Feb 2024 13:08:20 +0100 Subject: [PATCH 14/24] suggest knexfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .eslintrc.js | 7 ++- .prettierignore | 1 + .../knexfile.js => knexfile.js | 21 +++++-- packages/backend/knexfile.ts | 58 ------------------- plugins/catalog-backend/knexfile.js | 26 --------- scripts/{ => templates}/copyright-header.txt | 0 .../templates/knex-migration.stub.js | 27 +++++---- 7 files changed, 39 insertions(+), 101 deletions(-) rename plugins/catalog-backend-module-incremental-ingestion/knexfile.js => knexfile.js (52%) delete mode 100644 packages/backend/knexfile.ts delete mode 100644 plugins/catalog-backend/knexfile.js rename scripts/{ => templates}/copyright-header.txt (100%) rename plugins/bazaar-backend/knexfile.js => scripts/templates/knex-migration.stub.js (62%) diff --git a/.eslintrc.js b/.eslintrc.js index 2df965ab73..01cad187be 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,8 +23,11 @@ module.exports = { 'notice/notice': [ 'error', { - // eslint-disable-next-line no-restricted-syntax - templateFile: path.resolve(__dirname, './scripts/copyright-header.txt'), + templateFile: path.resolve( + // eslint-disable-next-line no-restricted-syntax + __dirname, + './scripts/templates/copyright-header.txt' + ), onNonMatchingHeader: 'replace', }, ], diff --git a/.prettierignore b/.prettierignore index c561036ebb..3a16bd1388 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,6 +11,7 @@ cli-report.md plugins/scaffolder-backend/sample-templates .vscode dist-types +.eslintrc.js # reduce the barrier for adopters to add themselves ADOPTERS.md diff --git a/plugins/catalog-backend-module-incremental-ingestion/knexfile.js b/knexfile.js similarity index 52% rename from plugins/catalog-backend-module-incremental-ingestion/knexfile.js rename to knexfile.js index 4cf9ef77c3..d7c91e0348 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/knexfile.js +++ b/knexfile.js @@ -1,5 +1,5 @@ /* - * Copyright 2021 The Backstage Authors + * Copyright 2024 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. @@ -14,13 +14,26 @@ * limitations under the License. */ -// This file makes it possible to run "yarn knex migrate:make some_file_name" -// to assist in making new migrations +// To create a new migration in a plugin, run: +// +// yarn workspace knex migrate:make +// +// for example: +// +// yarn workspace @backstage/plugin-catalog-backend knex migrate:make add_feature_foo +// +// This creates a file similar to +// +// plugins/catalog-backend/migrations/20240206160252_add_feature_foo.js + module.exports = { client: 'better-sqlite3', connection: ':memory:', useNullAsDefault: true, migrations: { - directory: './migrations', + // unfortunately this needs to be relative to the TARGET, not this file, and + // it just so happens to work to make it go up two steps due to our repo + // layout + stub: '../../scripts/templates/knex-migration.stub.js', }, }; diff --git a/packages/backend/knexfile.ts b/packages/backend/knexfile.ts deleted file mode 100644 index 93993c1d5c..0000000000 --- a/packages/backend/knexfile.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2020 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. - */ - -module.exports = { - development: { - client: 'better-sqlite3', - connection: { - filename: './dev.sqlite3', - }, - }, - - /* - staging: { - client: 'postgresql', - connection: { - database: 'my_db', - user: 'username', - password: 'password', - }, - pool: { - min: 2, - max: 10, - }, - migrations: { - tableName: 'knex_migrations', - }, - }, - - production: { - client: 'postgresql', - connection: { - database: 'my_db', - user: 'username', - password: 'password', - }, - pool: { - min: 2, - max: 10, - }, - migrations: { - tableName: 'knex_migrations', - }, - }, - */ -}; diff --git a/plugins/catalog-backend/knexfile.js b/plugins/catalog-backend/knexfile.js deleted file mode 100644 index 4cf9ef77c3..0000000000 --- a/plugins/catalog-backend/knexfile.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2021 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. - */ - -// This file makes it possible to run "yarn knex migrate:make some_file_name" -// to assist in making new migrations -module.exports = { - client: 'better-sqlite3', - connection: ':memory:', - useNullAsDefault: true, - migrations: { - directory: './migrations', - }, -}; diff --git a/scripts/copyright-header.txt b/scripts/templates/copyright-header.txt similarity index 100% rename from scripts/copyright-header.txt rename to scripts/templates/copyright-header.txt diff --git a/plugins/bazaar-backend/knexfile.js b/scripts/templates/knex-migration.stub.js similarity index 62% rename from plugins/bazaar-backend/knexfile.js rename to scripts/templates/knex-migration.stub.js index c05af246c5..abed7526cd 100644 --- a/plugins/bazaar-backend/knexfile.js +++ b/scripts/templates/knex-migration.stub.js @@ -1,5 +1,5 @@ /* - * Copyright 2022 The Backstage Authors + * Copyright 2024 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. @@ -14,15 +14,20 @@ * limitations under the License. */ -// Update with your config settings. +// @ts-check -// This file makes it possible to run "yarn knex migrate:make some_file_name" -// to assist in making new migrations -module.exports = { - client: 'better-sqlite3', - connection: ':memory:', - useNullAsDefault: true, - migrations: { - directory: './migrations', - }, +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = async function up(knex) { + // await knex.schema... +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = async function down(knex) { + // await knex.schema... }; From d7eff474844cb825410bf94e9d5fae5e4afd8ae5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:21:10 +0000 Subject: [PATCH 15/24] fix(deps): update dependency @uiw/react-codemirror to v4.21.22 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 4bf67873a3..1a8566ff31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20089,9 +20089,9 @@ __metadata: languageName: node linkType: hard -"@uiw/codemirror-extensions-basic-setup@npm:4.21.21": - version: 4.21.21 - resolution: "@uiw/codemirror-extensions-basic-setup@npm:4.21.21" +"@uiw/codemirror-extensions-basic-setup@npm:4.21.22": + version: 4.21.22 + resolution: "@uiw/codemirror-extensions-basic-setup@npm:4.21.22" dependencies: "@codemirror/autocomplete": ^6.0.0 "@codemirror/commands": ^6.0.0 @@ -20108,19 +20108,19 @@ __metadata: "@codemirror/search": ">=6.0.0" "@codemirror/state": ">=6.0.0" "@codemirror/view": ">=6.0.0" - checksum: 5d96ec930be286b5e324ee8dd57128171c72a8e333b4b991a5c4f33a05420a638def3776bd1a77c5b88184f7d3cbc6828b5c9a42b3b490f51908bedf69eaa0f0 + checksum: 75e9f8fa8c9462d45e89d05b6bda5c82825fd0fc2a73c20c2c7b5f7d1d5fce6b0a43aefac3b5651877eb655f5b82ff1eba34f9db57acd69a4da6d4e75540d3fe languageName: node linkType: hard "@uiw/react-codemirror@npm:^4.9.3": - version: 4.21.21 - resolution: "@uiw/react-codemirror@npm:4.21.21" + version: 4.21.22 + resolution: "@uiw/react-codemirror@npm:4.21.22" dependencies: "@babel/runtime": ^7.18.6 "@codemirror/commands": ^6.1.0 "@codemirror/state": ^6.1.1 "@codemirror/theme-one-dark": ^6.0.0 - "@uiw/codemirror-extensions-basic-setup": 4.21.21 + "@uiw/codemirror-extensions-basic-setup": 4.21.22 codemirror: ^6.0.0 peerDependencies: "@babel/runtime": ">=7.11.0" @@ -20130,7 +20130,7 @@ __metadata: codemirror: ">=6.0.0" react: ">=16.8.0" react-dom: ">=16.8.0" - checksum: 6a8500290bf0a739fd345221465b10112e0f758914bc8aa28ce0b9904b76489ae018d390f6a2d7dd7752b21f0ed87ba3fedb45b4185d04e4985abf0eb22e6d75 + checksum: 3d3152c32cb017f419956ac729e0842181c1f2836f1199c991fb6aab27b4b372d994085f28b83e293288e5630556186a87f2bbed305de96fedee7e0902dc9529 languageName: node linkType: hard From 34b3785c1ff579f989e747d08e0ebc27b22c0be1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:08:19 +0000 Subject: [PATCH 16/24] fix(deps): update dependency dompurify to v3.0.9 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 1a8566ff31..24eb2a954e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25659,7 +25659,7 @@ __metadata: languageName: node linkType: hard -"dompurify@npm:=3.0.8, dompurify@npm:^3.0.0": +"dompurify@npm:=3.0.8": version: 3.0.8 resolution: "dompurify@npm:3.0.8" checksum: cac660ccae15a9603f06a85344da868a4c3732d8b57f7998de0f421eb4b9e67d916be52e9bb2a57b2f95b49e994cc50bcd06bb87f2cb2849cf058bdf15266237 @@ -25673,6 +25673,13 @@ __metadata: languageName: node linkType: hard +"dompurify@npm:^3.0.0": + version: 3.0.9 + resolution: "dompurify@npm:3.0.9" + checksum: 09794f2e40a0003d36e3cd70be1036f83de39d9d4a0f199c45e0b9962ce8ae5f9fe424d7edc4c8ff9ec615be9744a140d66788f0925913ac482d4628b283cae5 + languageName: node + linkType: hard + "domutils@npm:^2.5.2, domutils@npm:^2.8.0": version: 2.8.0 resolution: "domutils@npm:2.8.0" From ad84e8eb683c81027e30facdda989dcf078fab80 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:37:01 +0000 Subject: [PATCH 17/24] fix(deps): update dependency js-base64 to v3.7.7 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 24eb2a954e..fe53624004 100644 --- a/yarn.lock +++ b/yarn.lock @@ -32165,9 +32165,9 @@ __metadata: linkType: hard "js-base64@npm:^3.6.0": - version: 3.7.6 - resolution: "js-base64@npm:3.7.6" - checksum: 4e1e82443c22f3f8f24902b071ea824069a28a16a86c3d8706e8c0741cace92cfb4affd093f52d13981369e10df840e54df8d0a59ede6dd2204a1f0aa4b64deb + version: 3.7.7 + resolution: "js-base64@npm:3.7.7" + checksum: d1b02971db9dc0fd35baecfaf6ba499731fb44fe3373e7e1d6681fbd3ba665f29e8d9d17910254ef8104e2cb8b44117fe4202d3dc54c7cafe9ba300fe5433358 languageName: node linkType: hard From 0c06fbf86f485a06dd030f0b51131f53db4c937d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:38:30 +0000 Subject: [PATCH 18/24] fix(deps): update dependency react-virtualized-auto-sizer to v1.0.23 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 24eb2a954e..53608a1899 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39867,12 +39867,12 @@ __metadata: linkType: hard "react-virtualized-auto-sizer@npm:^1.0.11": - version: 1.0.22 - resolution: "react-virtualized-auto-sizer@npm:1.0.22" + version: 1.0.23 + resolution: "react-virtualized-auto-sizer@npm:1.0.23" peerDependencies: react: ^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0 react-dom: ^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0 - checksum: dc3fc29437b7179de71f77e5be3514e8789944132d7eb03f7157f783ec167ad9bebf1d371c135cf74fc5787dfac313a2914a5d23b45e978ae77be36c673342e5 + checksum: a5b37b2201f09f957d2398f1415fcec9b2aa0cbfb75ae193bd324a0bc5ef00dc30d3a40f60b31fe5a450d8ec66c0911213f9f3be0e8410ae1b180547030fd8e8 languageName: node linkType: hard From e909d21f3b1dc8884c32a2f0072da30003d7cdb7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 20:19:30 +0000 Subject: [PATCH 19/24] fix(deps): update dependency recharts to v2.12.1 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 53608a1899..e920452be0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33696,7 +33696,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:4.17.21, lodash@npm:^4.15.0, lodash@npm:^4.16.4, lodash@npm:^4.17.10, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.7.0, lodash@npm:~4.17.15, lodash@npm:~4.17.21": +"lodash@npm:4.17.21, lodash@npm:^4.15.0, lodash@npm:^4.16.4, lodash@npm:^4.17.10, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.7.0, lodash@npm:~4.17.15, lodash@npm:~4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 @@ -40082,12 +40082,12 @@ __metadata: linkType: hard "recharts@npm:^2.5.0": - version: 2.12.0 - resolution: "recharts@npm:2.12.0" + version: 2.12.1 + resolution: "recharts@npm:2.12.1" dependencies: clsx: ^2.0.0 eventemitter3: ^4.0.1 - lodash: ^4.17.19 + lodash: ^4.17.21 react-is: ^16.10.2 react-smooth: ^4.0.0 recharts-scale: ^0.4.4 @@ -40096,7 +40096,7 @@ __metadata: peerDependencies: react: ^16.0.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 - checksum: 13fc3f8405a16dc8555b5aba9928e7339549b1db2da4821e659df8ac59cbdccec044b985be21093a546c2b2c231113103064c6ea4799322ca360805aede0358b + checksum: 768024e18bab43de2378241891748c562c57ddedfc31c3cec932a21a8b41cd662555d7c2bc26e86e7534c5e5c7ef2ebc0faa6d5fdc34d28057020837b4e3bf50 languageName: node linkType: hard From 8ba8439ce28acbfb37e6f1149b4d305f22bd6d96 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:24:56 +0000 Subject: [PATCH 20/24] chore(deps): update dependency better-sqlite3 to v9.4.2 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 944113a84b..fe579fc1d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21993,13 +21993,13 @@ __metadata: linkType: hard "better-sqlite3@npm:^9.0.0": - version: 9.4.1 - resolution: "better-sqlite3@npm:9.4.1" + version: 9.4.2 + resolution: "better-sqlite3@npm:9.4.2" dependencies: bindings: ^1.5.0 node-gyp: latest prebuild-install: ^7.1.1 - checksum: 4d14a95c9ec62eb76321aaf085fd08e9dae10527149f5b54e9f9868feb50ae6fbf6f7eed52f52e6126472938aa789f7e82f5ad9357c88b4efeaf8f7d958c5c11 + checksum: cd3038d028def835f14cf989a3fada118d2c586e19f2b4e52462d67f0a616364ce73f916bf8d857b144bff0f3ef36945399ab11451c256990be21cd425a76f26 languageName: node linkType: hard From 4934e315254da85ba8e4eb1c3cca47620e6ef73d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:15:22 +0000 Subject: [PATCH 21/24] fix(deps): update dependency google-auth-library to v9.6.3 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/yarn.lock b/yarn.lock index fe579fc1d9..d752dc7e2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28741,19 +28741,19 @@ __metadata: languageName: node linkType: hard -"gaxios@npm:^6.0.0, gaxios@npm:^6.0.2": - version: 6.1.1 - resolution: "gaxios@npm:6.1.1" +"gaxios@npm:^6.0.0, gaxios@npm:^6.0.2, gaxios@npm:^6.1.1": + version: 6.3.0 + resolution: "gaxios@npm:6.3.0" dependencies: extend: ^3.0.2 https-proxy-agent: ^7.0.1 is-stream: ^2.0.0 node-fetch: ^2.6.9 - checksum: bb4a4e6c81847b690ee29e01294d2093eb9bb4f9e60bbf81fcc6cd3b274f3c551c50a9bc134e7e7019a9b116eac9d9df6af9f2519c695da7ddd785f36564da72 + checksum: 4d4a8db32d833f8012435e2016cb0c919cac288e821bf81f877504e4284ef12b444cd903448e738c4031cd5219adf1e8d68e7df2b3dba774db9fde27f71109d4 languageName: node linkType: hard -"gcp-metadata@npm:^6.0.0": +"gcp-metadata@npm:^6.1.0": version: 6.1.0 resolution: "gcp-metadata@npm:6.1.0" dependencies: @@ -29138,16 +29138,16 @@ __metadata: linkType: hard "google-auth-library@npm:^9.0.0": - version: 9.2.0 - resolution: "google-auth-library@npm:9.2.0" + version: 9.6.3 + resolution: "google-auth-library@npm:9.6.3" dependencies: base64-js: ^1.3.0 ecdsa-sig-formatter: ^1.0.11 - gaxios: ^6.0.0 - gcp-metadata: ^6.0.0 + gaxios: ^6.1.1 + gcp-metadata: ^6.1.0 gtoken: ^7.0.0 jws: ^4.0.0 - checksum: 0da686964a769c79b5a1f7e518cb885f7c433edd50c8adf5cc310bfce607235184ebe6f9bc5290618d760c25e4ce1e273d444c9914c815353faa9d9dea37d1b3 + checksum: 46174191de15ec56110ac0394ae9d1c56fb6aa293809d45170b2ff570130d7e3f3e82fa78d413908862a2d0da3fa946b72f1074000f4d52579eb17367e49e44d languageName: node linkType: hard From bc3b1ae9d9bccd53993087198cf8c11d8e836d08 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 03:48:33 +0000 Subject: [PATCH 22/24] chore(deps): update dependency better-sqlite3 to v9.4.3 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index d752dc7e2d..99854e5042 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21993,13 +21993,13 @@ __metadata: linkType: hard "better-sqlite3@npm:^9.0.0": - version: 9.4.2 - resolution: "better-sqlite3@npm:9.4.2" + version: 9.4.3 + resolution: "better-sqlite3@npm:9.4.3" dependencies: bindings: ^1.5.0 node-gyp: latest prebuild-install: ^7.1.1 - checksum: cd3038d028def835f14cf989a3fada118d2c586e19f2b4e52462d67f0a616364ce73f916bf8d857b144bff0f3ef36945399ab11451c256990be21cd425a76f26 + checksum: 09e8d52e52e42f7175fd71fb8856873e9e39714a31b7739e0c6c2017b020bfa3f1cdd255ad1fe4d68140b0c74a5d043eca4d1ed8be9a080e172557bbea0deaf5 languageName: node linkType: hard From d5216f01f6dcda8fe4869806698debbbc08aa0b4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 04:38:53 +0000 Subject: [PATCH 23/24] fix(deps): update dependency @uiw/react-codemirror to v4.21.23 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 99854e5042..06edaceef5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20089,9 +20089,9 @@ __metadata: languageName: node linkType: hard -"@uiw/codemirror-extensions-basic-setup@npm:4.21.22": - version: 4.21.22 - resolution: "@uiw/codemirror-extensions-basic-setup@npm:4.21.22" +"@uiw/codemirror-extensions-basic-setup@npm:4.21.23": + version: 4.21.23 + resolution: "@uiw/codemirror-extensions-basic-setup@npm:4.21.23" dependencies: "@codemirror/autocomplete": ^6.0.0 "@codemirror/commands": ^6.0.0 @@ -20108,19 +20108,19 @@ __metadata: "@codemirror/search": ">=6.0.0" "@codemirror/state": ">=6.0.0" "@codemirror/view": ">=6.0.0" - checksum: 75e9f8fa8c9462d45e89d05b6bda5c82825fd0fc2a73c20c2c7b5f7d1d5fce6b0a43aefac3b5651877eb655f5b82ff1eba34f9db57acd69a4da6d4e75540d3fe + checksum: cd17481d9d9a9b620f961a4df6e8208bcabe98652ca6c18366a8688fbcc09d37a030694a70dcc010aaabe02c85c342acf9f80357c6853b57f1081af5b130bd26 languageName: node linkType: hard "@uiw/react-codemirror@npm:^4.9.3": - version: 4.21.22 - resolution: "@uiw/react-codemirror@npm:4.21.22" + version: 4.21.23 + resolution: "@uiw/react-codemirror@npm:4.21.23" dependencies: "@babel/runtime": ^7.18.6 "@codemirror/commands": ^6.1.0 "@codemirror/state": ^6.1.1 "@codemirror/theme-one-dark": ^6.0.0 - "@uiw/codemirror-extensions-basic-setup": 4.21.22 + "@uiw/codemirror-extensions-basic-setup": 4.21.23 codemirror: ^6.0.0 peerDependencies: "@babel/runtime": ">=7.11.0" @@ -20130,7 +20130,7 @@ __metadata: codemirror: ">=6.0.0" react: ">=16.8.0" react-dom: ">=16.8.0" - checksum: 3d3152c32cb017f419956ac729e0842181c1f2836f1199c991fb6aab27b4b372d994085f28b83e293288e5630556186a87f2bbed305de96fedee7e0902dc9529 + checksum: 7d0209d947e1e57cf80ef44a097bb3af04d2bab2d6fc57deed91619a0db77e3d4289db8f03fb43906b2e324496d25c872fa99b83834f085c40ad95137ea4459c languageName: node linkType: hard From 613e2bfe03fc212e8c35e0340a597b5edf8d3b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 22 Feb 2024 11:54:39 +0100 Subject: [PATCH 24/24] extend the visibility docs with deep visibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- docs/conf/defining.md | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/conf/defining.md b/docs/conf/defining.md index 9e13442f7b..1c2fb8d273 100644 --- a/docs/conf/defining.md +++ b/docs/conf/defining.md @@ -84,13 +84,16 @@ receive schema validation and autocompletion. For example: ## Visibility The `https://backstage.io/schema/config-v1` meta schema is a superset of JSON -Schema Draft 07. The single addition is a custom `visibility` keyword, which is -used to indicate whether the given config value should be visible in the -frontend or not. The possible values are `frontend`, `backend`, and `secret`, -where `backend` is the default. A visibility of `secret` has the same scope at -runtime, but it will be treated with more care in certain contexts, and defining -both `frontend` and `secret` for the same value in two different schemas will -result in an error during schema merging. +Schema Draft 07. The only additions are the custom `visibility` and +`deepVisibility` keywords, which are used to indicate whether the given config +value should be visible in the frontend or not. The `visibility` marker applies +only to the field it's on, while the `deepVisibility` marker applies to the +field it's on and downwards in the hierarchy as well. The possible values are +`frontend`, `backend`, and `secret`, where `backend` is the default. A +visibility of `secret` has the same scope at runtime, but it will be treated +with more care in certain contexts, and defining both `frontend` and `secret` +for the same value in two different schemas will result in an error during +schema merging. The visibility only applies to the direct parent of where the keyword is placed in the schema. For example, if you set the visibility to `frontend` for a subset @@ -105,17 +108,38 @@ declare the visibility of a leaf node of `type: "string"`. | `backend` | (Default) Only in backend | | `secret` | Only in backend and may be excluded from logs for security reasons | -You can set visibility with an `@visibility` comment in the `Config` Typescript -interface. +You can set visibility with a `@visibility` or `@deepVisibility` comment in the +`Config` Typescript interface. ```ts export interface Config { app: { /** * Frontend root URL + * NOTE: Visibility applies to only this field * @visibility frontend */ baseUrl: string; + + /** + * Some custom complex type + * NOTE: Visibility applies recursively downward + * This is particularly useful for complex types like durations + * @deepVisibility frontend + */ + customSchedule: HumanDuration; + }; + + backend: { + /** + * Some custom credentials type + * NOTE: Visibility applies recursively downward, and this would NOT have + * been safe if the regular visibility keyword had been used + * @deepVisibility secret + */ + customCredentials: { + password: string; + }; }; } ```