From 248ed0f7d815215b34d0d1ccb4fa356cce1de110 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 5 Dec 2022 09:10:58 +0000 Subject: [PATCH 001/141] add entity peek ahead component Signed-off-by: Brian Fletcher --- plugins/catalog-react/package.json | 1 + .../EntityRefLink/EntityRefLink.tsx | 159 ++++++++++++++++-- 2 files changed, 149 insertions(+), 11 deletions(-) diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index 11b9555a12..caa3ac7a56 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -48,6 +48,7 @@ "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.57", + "material-ui-popup-state": "^1.9.3", "classnames": "^2.2.6", "jwt-decode": "^3.1.0", "lodash": "^4.17.21", diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 06a632232e..62be932f44 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -19,13 +19,34 @@ import { CompoundEntityRef, DEFAULT_NAMESPACE, parseEntityRef, + isUserEntity, + isGroupEntity, } from '@backstage/catalog-model'; -import React, { forwardRef } from 'react'; +import React, { ForwardedRef, forwardRef } from 'react'; import { entityRouteRef } from '../../routes'; import { humanizeEntityRef } from './humanize'; import { Link, LinkProps } from '@backstage/core-components'; -import { useRouteRef } from '@backstage/core-plugin-api'; -import { Tooltip } from '@material-ui/core'; +import { useApi, useRouteRef } from '@backstage/core-plugin-api'; +import { + Button, + Tooltip, + Typography, + CardContent, + Card, + CardActions, + makeStyles, +} from '@material-ui/core'; +import { + usePopupState, + bindPopover, + bindHover, + PopupState, +} from 'material-ui-popup-state/hooks'; +import HoverPopover from 'material-ui-popup-state/HoverPopover'; +import EmailIcon from '@material-ui/icons/Email'; +import InfoIcon from '@material-ui/icons/Info'; +import useAsync from 'react-use/lib/useAsync'; +import { catalogApiRef } from '../../api'; /** * Props for {@link EntityRefLink}. @@ -39,6 +60,101 @@ export type EntityRefLinkProps = { children?: React.ReactNode; } & Omit; +type PeekAheadPopoverProps = { + popupState: PopupState; + entityRef: CompoundEntityRef; + ref: ForwardedRef; +}; + +const useStyles = makeStyles(() => { + return { + popover: { + width: '80em', + minWidth: '80em', + maxWidth: '80em', + }, + card: { + width: '100%', + }, + }; +}); + +export const PeekAheadPopover = ({ + popupState, + entityRef, + ref, +}: PeekAheadPopoverProps) => { + const catalogApi = useApi(catalogApiRef); + const entityRoute = useRouteRef(entityRouteRef); + const classes = useStyles(); + + const { value, loading, error } = useAsync(async () => { + if (popupState.isOpen) { + return catalogApi.getEntityByRef(entityRef); + } + return undefined; + }, [popupState]); + + if (loading) { + return null; + } + + return ( + + + + {entityRef.namespace} + + {entityRef.name} + + {entityRef.kind} + + {error && error.message} + {value && ( + <> + {value.metadata.description} +
+
+ {value.spec?.type} + + )} +
+
+ + {value && + (isUserEntity(value) || isGroupEntity(value)) && + value.spec.profile?.email && ( + + + + )} + + + + + + +
+
+ ); +}; /** * Shows a clickable link to an entity. * @@ -48,6 +164,10 @@ export const EntityRefLink = forwardRef( (props, ref) => { const { entityRef, defaultKind, title, children, ...linkProps } = props; const entityRoute = useRouteRef(entityRouteRef); + const popupState = usePopupState({ + variant: 'popover', + popupId: 'entity-peek-ahead', + }); let kind; let namespace; @@ -78,16 +198,33 @@ export const EntityRefLink = forwardRef( ); const link = ( - - {children} - {!children && (title ?? formattedEntityRefTitle)} - + <> + + {children} + {!children && (title ?? formattedEntityRefTitle)} + + ); - return title ? ( - {link} - ) : ( - link + return ( + <> + {title ? ( + {link} + ) : ( + link + )} + + + ); }, ) as (props: EntityRefLinkProps) => JSX.Element; From d4d0ffcafaa1282fc4eb34c8afe26a96b561b9a3 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 5 Dec 2022 09:17:14 +0000 Subject: [PATCH 002/141] tidy Signed-off-by: Brian Fletcher --- .../EntityRefLink/EntityRefLink.tsx | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 62be932f44..6496bc7f53 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -63,7 +63,6 @@ export type EntityRefLinkProps = { type PeekAheadPopoverProps = { popupState: PopupState; entityRef: CompoundEntityRef; - ref: ForwardedRef; }; const useStyles = makeStyles(() => { @@ -82,7 +81,6 @@ const useStyles = makeStyles(() => { export const PeekAheadPopover = ({ popupState, entityRef, - ref, }: PeekAheadPopoverProps) => { const catalogApi = useApi(catalogApiRef); const entityRoute = useRouteRef(entityRouteRef); @@ -198,17 +196,15 @@ export const EntityRefLink = forwardRef( ); const link = ( - <> - - {children} - {!children && (title ?? formattedEntityRefTitle)} - - + + {children} + {!children && (title ?? formattedEntityRefTitle)} + ); return ( @@ -220,7 +216,6 @@ export const EntityRefLink = forwardRef( )} From 516b2039b6b3e4a60dd4aad9b0f96871779c8d62 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 5 Dec 2022 09:19:43 +0000 Subject: [PATCH 003/141] changeset Signed-off-by: Brian Fletcher --- .changeset/red-tables-train.md | 5 +++++ .../src/components/EntityRefLink/EntityRefLink.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/red-tables-train.md diff --git a/.changeset/red-tables-train.md b/.changeset/red-tables-train.md new file mode 100644 index 0000000000..1aadde75cf --- /dev/null +++ b/.changeset/red-tables-train.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Add pop over on the `EntityRefLink` component. It shows a more details about the associated entity. diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 6496bc7f53..ee7d770769 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -22,7 +22,7 @@ import { isUserEntity, isGroupEntity, } from '@backstage/catalog-model'; -import React, { ForwardedRef, forwardRef } from 'react'; +import React, { forwardRef } from 'react'; import { entityRouteRef } from '../../routes'; import { humanizeEntityRef } from './humanize'; import { Link, LinkProps } from '@backstage/core-components'; From dcc65c637a919d81ed2e96b87d6ae7ed74c9e0cf Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 5 Dec 2022 09:35:29 +0000 Subject: [PATCH 004/141] yarn update Signed-off-by: Brian Fletcher --- plugins/catalog-react/package.json | 2 +- yarn.lock | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index caa3ac7a56..b74466424b 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -48,10 +48,10 @@ "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.57", - "material-ui-popup-state": "^1.9.3", "classnames": "^2.2.6", "jwt-decode": "^3.1.0", "lodash": "^4.17.21", + "material-ui-popup-state": "^1.9.3", "qs": "^6.9.4", "react-use": "^17.2.4", "yaml": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 4af9e1862a..858f0c5ea4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5469,6 +5469,7 @@ __metadata: cross-fetch: ^3.1.5 jwt-decode: ^3.1.0 lodash: ^4.17.21 + material-ui-popup-state: ^1.9.3 qs: ^6.9.4 react-test-renderer: ^16.13.1 react-use: ^17.2.4 From f68ff9a3d880113bad7da443893329f585b1aec5 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 5 Dec 2022 10:02:21 +0000 Subject: [PATCH 005/141] fix width of popover Signed-off-by: Brian Fletcher --- .../components/EntityRefLink/EntityRefLink.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index ee7d770769..329f52ea74 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -67,13 +67,8 @@ type PeekAheadPopoverProps = { const useStyles = makeStyles(() => { return { - popover: { - width: '80em', - minWidth: '80em', - maxWidth: '80em', - }, - card: { - width: '100%', + popoverPaper: { + width: '20em', }, }; }); @@ -99,8 +94,10 @@ export const PeekAheadPopover = ({ return ( - + {entityRef.namespace} From 281df37809ae2533a2e606302a1c941de24c5bd5 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 5 Dec 2022 13:10:22 +0000 Subject: [PATCH 006/141] fix tests and improve error handling Signed-off-by: Brian Fletcher --- .../examples/acme/team-a-group.yaml | 2 +- .../EntityRefLink/EntityRefLink.test.tsx | 79 +++++++++++++------ .../EntityRefLink/EntityRefLink.tsx | 33 +++++--- .../EntityRefLink/EntityRefLinks.test.tsx | 37 ++++++--- .../components/EntityTable/presets.test.tsx | 39 ++++++--- plugins/playlist/package.json | 1 + .../PlaylistCard/PlaylistCard.test.tsx | 38 +++++---- .../techdocs-addons-test-utils/package.json | 2 + .../src/test-utils.tsx | 7 ++ .../package.json | 1 + plugins/techdocs/package.json | 1 + .../TechDocsReaderPage.test.tsx | 8 +- yarn.lock | 5 ++ 13 files changed, 181 insertions(+), 72 deletions(-) diff --git a/packages/catalog-model/examples/acme/team-a-group.yaml b/packages/catalog-model/examples/acme/team-a-group.yaml index e343209d5f..6f2be963b7 100644 --- a/packages/catalog-model/examples/acme/team-a-group.yaml +++ b/packages/catalog-model/examples/acme/team-a-group.yaml @@ -21,7 +21,7 @@ spec: # Intentional no displayName for testing email: breanna-davison@example.com picture: https://avatars.dicebear.com/api/avataaars/breanna-davison@example.com.svg?background=%23fff - memberOf: [team-a] + memberOf: [team-a, team-not-exist] --- apiVersion: backstage.io/v1alpha1 kind: User diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.test.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.test.tsx index b0a6b46bf5..71ff25c746 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.test.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.test.tsx @@ -14,11 +14,20 @@ * limitations under the License. */ -import { renderInTestApp } from '@backstage/test-utils'; +import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils'; import { screen } from '@testing-library/react'; import React from 'react'; import { entityRouteRef } from '../../routes'; import { EntityRefLink } from './EntityRefLink'; +import { catalogApiRef } from '../../api'; +import { CatalogApi } from '@backstage/catalog-client'; +import { ApiProvider } from '@backstage/core-app-api'; + +const catalogApi: jest.Mocked = { + getEntityByRef: jest.fn(), +} as any; + +const apis = TestApiRegistry.from([catalogApiRef, catalogApi]); describe('', () => { it('renders link for entity in default namespace', async () => { @@ -34,11 +43,16 @@ describe('', () => { lifecycle: 'production', }, }; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name/*': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name/*': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('component:software')).toHaveAttribute( 'href', @@ -60,11 +74,16 @@ describe('', () => { lifecycle: 'production', }, }; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name/*': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name/*': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('component:test/software')).toHaveAttribute( 'href', '/catalog/test/component/software', @@ -86,7 +105,9 @@ describe('', () => { }, }; await renderInTestApp( - , + + + , { mountedRoutes: { '/catalog/:namespace/:kind/:name/*': entityRouteRef, @@ -105,11 +126,16 @@ describe('', () => { namespace: 'default', name: 'software', }; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name/*': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name/*': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('component:software')).toHaveAttribute( 'href', '/catalog/default/component/software', @@ -122,11 +148,16 @@ describe('', () => { namespace: 'test', name: 'software', }; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name/*': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name/*': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('component:test/software')).toHaveAttribute( 'href', '/catalog/test/component/software', @@ -140,7 +171,9 @@ describe('', () => { name: 'software', }; await renderInTestApp( - , + + + , { mountedRoutes: { '/catalog/:namespace/:kind/:name/*': entityRouteRef, @@ -160,9 +193,11 @@ describe('', () => { name: 'software', }; await renderInTestApp( - - Custom Children - , + + + Custom Children + + , { mountedRoutes: { '/catalog/:namespace/:kind/:name/*': entityRouteRef, diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 329f52ea74..c1d699421e 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -47,6 +47,7 @@ import EmailIcon from '@material-ui/icons/Email'; import InfoIcon from '@material-ui/icons/Info'; import useAsync from 'react-use/lib/useAsync'; import { catalogApiRef } from '../../api'; +import { Alert } from '@material-ui/lab'; /** * Props for {@link EntityRefLink}. @@ -77,13 +78,21 @@ export const PeekAheadPopover = ({ popupState, entityRef, }: PeekAheadPopoverProps) => { - const catalogApi = useApi(catalogApiRef); const entityRoute = useRouteRef(entityRouteRef); const classes = useStyles(); + const catalogApi = useApi(catalogApiRef); - const { value, loading, error } = useAsync(async () => { + const { + value: entity, + loading, + error, + } = useAsync(async () => { if (popupState.isOpen) { - return catalogApi.getEntityByRef(entityRef); + const retrievedEntity = await catalogApi.getEntityByRef(entityRef); + if (!retrievedEntity) { + throw new Error(`${entityRef.name} was not found`); + } + return retrievedEntity; } return undefined; }, [popupState]); @@ -115,25 +124,25 @@ export const PeekAheadPopover = ({ {entityRef.kind} - {error && error.message} - {value && ( + {error && {error.message}} + {entity && ( <> - {value.metadata.description} + {entity.metadata.description}

- {value.spec?.type} + {entity.spec?.type} )}
- {value && - (isUserEntity(value) || isGroupEntity(value)) && - value.spec.profile?.email && ( - + {entity && + (isUserEntity(entity) || isGroupEntity(entity)) && + entity.spec.profile?.email && ( + + + )} + + + + + + +
+
+ + ); +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts b/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts new file mode 100644 index 0000000000..476767931f --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2022 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 { EntityPeekAheadPopover } from './EntityPeekAheadPopover'; diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 7ebd828a4c..813195cb70 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -19,38 +19,13 @@ import { CompoundEntityRef, DEFAULT_NAMESPACE, parseEntityRef, - isUserEntity, - isGroupEntity, } from '@backstage/catalog-model'; -import React, { forwardRef, useEffect } from 'react'; +import React, { forwardRef } from 'react'; import { entityRouteRef } from '../../routes'; import { humanizeEntityRef } from './humanize'; -import { Link, LinkProps, Progress } from '@backstage/core-components'; -import { useApiHolder, useRouteRef } from '@backstage/core-plugin-api'; -import { - Button, - Tooltip, - Typography, - CardContent, - Card, - CardActions, - makeStyles, - Box, - Chip, -} from '@material-ui/core'; -import { - usePopupState, - bindPopover, - bindHover, - PopupState, -} from 'material-ui-popup-state/hooks'; -import HoverPopover from 'material-ui-popup-state/HoverPopover'; -import EmailIcon from '@material-ui/icons/Email'; -import InfoIcon from '@material-ui/icons/Info'; -import { catalogApiRef } from '../../api'; -import { Alert, Skeleton } from '@material-ui/lab'; -import useAsyncFn from 'react-use/lib/useAsyncFn'; - +import { Link, LinkProps } from '@backstage/core-components'; +import { useRouteRef } from '@backstage/core-plugin-api'; +import { EntityPeekAheadPopover } from '../EntityPeekAheadPopover'; /** * Props for {@link EntityRefLink}. * @@ -63,129 +38,6 @@ export type EntityRefLinkProps = { children?: React.ReactNode; } & Omit; -type PeekAheadPopoverProps = { - popupState: PopupState; - entityRef: CompoundEntityRef; -}; - -const useStyles = makeStyles(() => { - return { - popoverPaper: { - width: '30em', - }, - descriptionTypography: { - overflow: 'hidden', - textOverflow: 'ellipsis', - display: '-webkit-box', - WebkitLineClamp: 2, - WebkitBoxOrient: 'vertical', - }, - }; -}); - -const maxTagChips = 4; - -export const PeekAheadPopover = ({ - popupState, - entityRef, -}: PeekAheadPopoverProps) => { - const entityRoute = useRouteRef(entityRouteRef); - const classes = useStyles(); - const apiHolder = useApiHolder(); - - const [{ loading, error, value: entity }, load] = useAsyncFn(async () => { - const catalogApi = apiHolder.get(catalogApiRef); - if (catalogApi) { - const retrievedEntity = await catalogApi.getEntityByRef(entityRef); - if (!retrievedEntity) { - throw new Error(`${entityRef.name} was not found`); - } - return retrievedEntity; - } - return undefined; - }, [apiHolder, entityRef]); - - useEffect(() => { - if (popupState.isOpen && !entity && !error && !loading) { - load(); - } - }, [popupState.isOpen, load, entity, error, loading]); - - return ( - - - {loading && } - - {entityRef.namespace} - - {entityRef.name} - - {error && {error.message}} - {entity ? ( - <> - {entity.kind} - - {entity.metadata.description} - - {entity.spec?.type} - - {(entity.metadata.tags || []).slice(0, maxTagChips).map(tag => { - return ; - })} - {entity.metadata.tags?.length && - entity.metadata.tags?.length > maxTagChips && ( - - - - )} - - - ) : ( - <> - - - - - - )} - - - {entity && - (isUserEntity(entity) || isGroupEntity(entity)) && - entity.spec.profile?.email && ( - - - - )} - - - - - - - - - ); -}; /** * Shows a clickable link to an entity. * @@ -195,10 +47,6 @@ export const EntityRefLink = forwardRef( (props, ref) => { const { entityRef, defaultKind, title, children, ...linkProps } = props; const entityRoute = useRouteRef(entityRouteRef); - const popupState = usePopupState({ - variant: 'popover', - popupId: 'entity-peek-ahead', - }); let kind; let namespace; @@ -229,22 +77,12 @@ export const EntityRefLink = forwardRef( ); return ( - <> - + + {children} {!children && (title ?? formattedEntityRefTitle)} - - - + ); }, ) as (props: EntityRefLinkProps) => JSX.Element; diff --git a/plugins/catalog-react/src/components/index.ts b/plugins/catalog-react/src/components/index.ts index c604306ead..a4380ddef0 100644 --- a/plugins/catalog-react/src/components/index.ts +++ b/plugins/catalog-react/src/components/index.ts @@ -19,6 +19,7 @@ export * from './EntityKindPicker'; export * from './EntityLifecyclePicker'; export * from './EntityOwnerPicker'; export * from './EntityRefLink'; +export * from './EntityPeekAheadPopover'; export * from './EntitySearchBar'; export * from './EntityTable'; export * from './EntityTagPicker'; From 1e1bc430eba97ca379ea003ba518a60468702b06 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 8 Dec 2022 13:38:03 +0000 Subject: [PATCH 018/141] remove testing content Signed-off-by: Brian Fletcher --- .../EntityPeekAheadPopover/EntityPeekAheadPopover.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index c7d994628b..d50525151e 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -127,15 +127,7 @@ export const EntityPeekAheadPopover = ({ <> {entity.kind} - {/* {entity.metadata.description} */} - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed - do eiusmod tempor incididunt ut labore et dolore magna aliqua. - Ut enim ad minim veniam, quis nostrud exercitation ullamco - laboris nisi ut aliquip ex ea commodo consequat. Duis aute - irure dolor in reprehenderit in voluptate velit esse cillum - dolore eu fugiat nulla pariatur. Excepteur sint occaecat - cupidatat non proident, sunt in culpa qui officia deserunt - mollit anim id est laborum. + {entity.metadata.description} {entity.spec?.type} From 1ec7c6b055925a001e042682202ad6f52863d960 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 8 Dec 2022 14:19:27 +0000 Subject: [PATCH 019/141] small refactors and api reports Signed-off-by: Brian Fletcher --- plugins/catalog-react/api-report.md | 11 ++ .../EntityPeekAheadPopover.tsx | 101 ++++++++++++++---- .../EntityPeekAheadPopover/index.ts | 2 +- 3 files changed, 91 insertions(+), 23 deletions(-) diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 92bfc4de96..9d30d84bb2 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -254,6 +254,17 @@ export class EntityOwnerFilter implements EntityFilter { // @public (undocumented) export const EntityOwnerPicker: () => JSX.Element | null; +// @public +export const EntityPeekAheadPopover: ({ + entityRef, + children, +}: EntityPeekAheadPopoverProps) => JSX.Element; + +// @public +export type EntityPeekAheadPopoverProps = PropsWithChildren<{ + entityRef: CompoundEntityRef; +}>; + // @public (undocumented) export const EntityProcessingStatusPicker: () => JSX.Element; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index d50525151e..bd41dd5b92 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -42,12 +42,20 @@ import { CompoundEntityRef, isUserEntity, isGroupEntity, + UserEntity, + GroupEntity, + Entity, } from '@backstage/catalog-model'; import { Link, Progress } from '@backstage/core-components'; -export type EntityPeekAheadPopoverProps = { +/** + * Properties for an entity popover on hover of a component. + * + * @public + */ +export type EntityPeekAheadPopoverProps = PropsWithChildren<{ entityRef: CompoundEntityRef; -}; +}>; const useStyles = makeStyles(() => { return { @@ -66,11 +74,71 @@ const useStyles = makeStyles(() => { const maxTagChips = 4; +const EmailCardAction = ({ email }: { email: string }) => { + return ( + + + + ); +}; + +const UserCardActions = ({ entity }: { entity: UserEntity }) => { + return ( + <> + {entity.spec.profile?.email && ( + + )} + + ); +}; + +const GroupCardActions = ({ entity }: { entity: GroupEntity }) => { + return ( + <> + {entity.spec.profile?.email && ( + + )} + + ); +}; + +/** + * Shows an entity popover on hover of a component. + * + * @public + */ +const EntityCardActions = ({ entity }: { entity: Entity }) => { + const entityRoute = useRouteRef(entityRouteRef); + + return ( + <> + + + + + + + ); +}; + +/** + * Shows an entity popover on hover of a component. + * + * @public + */ export const EntityPeekAheadPopover = ({ entityRef, children, -}: PropsWithChildren) => { - const entityRoute = useRouteRef(entityRouteRef); +}: EntityPeekAheadPopoverProps) => { const classes = useStyles(); const apiHolder = useApiHolder(); const popupState = usePopupState({ @@ -154,24 +222,13 @@ export const EntityPeekAheadPopover = ({ )} - {entity && - (isUserEntity(entity) || isGroupEntity(entity)) && - entity.spec.profile?.email && ( - - - - )} - - - - - + {entity && ( + <> + {isUserEntity(entity) && } + {isGroupEntity(entity) && } + + + )} diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts b/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts index 476767931f..6630f6f555 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/index.ts @@ -13,4 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { EntityPeekAheadPopover } from './EntityPeekAheadPopover'; +export * from './EntityPeekAheadPopover'; From f88981fb1deeba517b04df2da2ae4e0e8344f7e7 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Fri, 9 Dec 2022 14:13:57 +0000 Subject: [PATCH 020/141] add unit test for peek ahead popover Signed-off-by: Brian Fletcher --- .../EntityPeekAheadPopover.test.tsx | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx new file mode 100644 index 0000000000..7053969a09 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx @@ -0,0 +1,72 @@ +/* + * 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. + */ + +import { fireEvent, render, screen } from '@testing-library/react'; +import React from 'react'; +import { EntityPeekAheadPopover } from './EntityPeekAheadPopover'; +import { ApiProvider } from '@backstage/core-app-api'; +import { TestApiRegistry } from '@backstage/test-utils'; +import { catalogApiRef } from '../../api'; +import { CompoundEntityRef, Entity } from '@backstage/catalog-model'; +import { CatalogApi } from '@backstage/catalog-client'; + +const catalogApi: Partial = { + getEntityByRef: async ( + entityRef: CompoundEntityRef, + ): Promise => { + if ( + entityRef === + { name: 'service1', namespace: 'default', kind: 'component ' } + ) { + return { + apiVersion: '', + kind: 'Component', + metadata: { + namespace: 'default', + name: 'service1', + }, + spec: { + tags: ['java'], + }, + }; + } + return undefined; + }, +}; + +const apis = TestApiRegistry.from([catalogApiRef, catalogApi]); + +describe('', () => { + it('renders all owners', async () => { + render( + + +
asdf
+
+
, + ); + expect(screen.getByText('asdf')).toBeInTheDocument(); + expect(screen.queryByText('service1')).toBeNull(); + fireEvent.mouseOver(screen.getByTestId('popover')); + expect(screen.getByText('service1')).toBeInTheDocument(); + }); +}); From 2172ae4259fcef34a54ba2a9507469ba24351aca Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 12 Dec 2022 14:24:48 +0000 Subject: [PATCH 021/141] adds a storybook for the peek ahead popover Signed-off-by: Brian Fletcher --- .../EntityPeekAheadPopover.stories.tsx | 114 ++++++++++++++++++ storybook/.storybook/main.js | 1 + 2 files changed, 115 insertions(+) create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx new file mode 100644 index 0000000000..c31e5320ef --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx @@ -0,0 +1,114 @@ +/* + * 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. + */ + +import React, { ComponentType } from 'react'; +import { + EntityPeekAheadPopover, + EntityPeekAheadPopoverProps, +} from './EntityPeekAheadPopover'; +import Button from '@material-ui/core/Button'; +import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils'; +import { catalogApiRef } from '../../api'; +import { CompoundEntityRef } from '@backstage/catalog-model'; +import { entityRouteRef } from '../../routes'; +import { CatalogApi } from '@backstage/catalog-client'; + +const mockCatalogApi = { + getEntityByRef: async (entityRef: CompoundEntityRef) => { + if ( + entityRef.namespace === 'default' && + entityRef.name === 'playback' && + entityRef.kind === 'component' + ) { + return { + kind: 'Component', + metadata: { + name: 'playback', + namespace: 'default', + description: 'Details about the playback service', + }, + }; + } + if ( + entityRef.namespace === 'default' && + entityRef.name === 'fname.lname' && + entityRef.kind === 'user' + ) { + return { + kind: 'User', + metadata: { + name: 'fname.lname', + namespace: 'default', + }, + spec: { + profile: { + email: 'fname.lname@example.com', + }, + }, + }; + } + return undefined; + }, +}; + +const defaultArgs = { + entityRef: { + namespace: 'default', + name: 'playback', + kind: 'component', + }, +}; + +export default { + title: 'Catalog /PeekAheadPopover', + decorators: [ + (Story: ComponentType<{}>) => + wrapInTestApp( + <> + + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, + ), + ], +}; + +export const Default = (args: EntityPeekAheadPopoverProps) => ( + + + +); +Default.args = defaultArgs; + +export const User = (args: EntityPeekAheadPopoverProps) => ( + + + +); +User.args = { + entityRef: { + kind: 'user', + namespace: 'default', + name: 'fname.lname', + }, +}; diff --git a/storybook/.storybook/main.js b/storybook/.storybook/main.js index e523b68337..3d92237438 100644 --- a/storybook/.storybook/main.js +++ b/storybook/.storybook/main.js @@ -12,6 +12,7 @@ const BACKSTAGE_CORE_STORIES = [ 'plugins/search-react', 'plugins/home', 'plugins/stack-overflow', + 'plugins/catalog-react', ]; // Some configuration needs to be available directly on the exported object From 5bc78a5284773b43c5b35fa40bcc341c1ec116a5 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 13 Dec 2022 11:42:29 +0000 Subject: [PATCH 022/141] more review comments Signed-off-by: Brian Fletcher --- plugins/catalog-react/api-report.md | 9 +- .../EntityPeekAheadPopover.stories.tsx | 45 ++++++-- .../EntityPeekAheadPopover.test.tsx | 44 +++++--- .../EntityPeekAheadPopover.tsx | 106 +++++++++++------- .../EntityRefLink/EntityRefLink.tsx | 2 +- 5 files changed, 131 insertions(+), 75 deletions(-) diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 9d30d84bb2..82f8326a17 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -255,14 +255,13 @@ export class EntityOwnerFilter implements EntityFilter { export const EntityOwnerPicker: () => JSX.Element | null; // @public -export const EntityPeekAheadPopover: ({ - entityRef, - children, -}: EntityPeekAheadPopoverProps) => JSX.Element; +export const EntityPeekAheadPopover: ( + props: EntityPeekAheadPopoverProps, +) => JSX.Element; // @public export type EntityPeekAheadPopoverProps = PropsWithChildren<{ - entityRef: CompoundEntityRef; + entityRef: string; }>; // @public (undocumented) diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx index c31e5320ef..c44a31a743 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx @@ -60,16 +60,27 @@ const mockCatalogApi = { }, }; } + if ( + entityRef.namespace === 'default' && + entityRef.name === 'slow.catalog.item' && + entityRef.kind === 'component' + ) { + await new Promise(resolve => setTimeout(resolve, 3000)); + return { + kind: 'Component', + metadata: { + name: 'slow.catalog.item', + namespace: 'default', + description: 'Details about the slow.catalog.item service', + }, + }; + } return undefined; }, }; const defaultArgs = { - entityRef: { - namespace: 'default', - name: 'playback', - kind: 'component', - }, + entityRef: 'component:default/playback', }; export default { @@ -106,9 +117,23 @@ export const User = (args: EntityPeekAheadPopoverProps) => (
); User.args = { - entityRef: { - kind: 'user', - namespace: 'default', - name: 'fname.lname', - }, + entityRef: 'user:default/fname.lname', +}; + +export const NotFound = (args: EntityPeekAheadPopoverProps) => ( + + + +); +NotFound.args = { + entityRef: 'user:default/doesnt.exist', +}; + +export const SlowCatalogItem = (args: EntityPeekAheadPopoverProps) => ( + + + +); +SlowCatalogItem.args = { + entityRef: 'component:default/slow.catalog.item', }; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx index 7053969a09..f7c4d1cffa 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx @@ -14,22 +14,25 @@ * limitations under the License. */ -import { fireEvent, render, screen } from '@testing-library/react'; +import { fireEvent, screen } from '@testing-library/react'; import React from 'react'; import { EntityPeekAheadPopover } from './EntityPeekAheadPopover'; import { ApiProvider } from '@backstage/core-app-api'; -import { TestApiRegistry } from '@backstage/test-utils'; +import { TestApiRegistry, renderInTestApp } from '@backstage/test-utils'; import { catalogApiRef } from '../../api'; import { CompoundEntityRef, Entity } from '@backstage/catalog-model'; import { CatalogApi } from '@backstage/catalog-client'; +import { Button } from '@material-ui/core'; +import { entityRouteRef } from '../../routes'; const catalogApi: Partial = { getEntityByRef: async ( entityRef: CompoundEntityRef, ): Promise => { if ( - entityRef === - { name: 'service1', namespace: 'default', kind: 'component ' } + entityRef.name === 'service1' && + entityRef.namespace === 'default' && + entityRef.kind === 'component' ) { return { apiVersion: '', @@ -51,22 +54,31 @@ const apis = TestApiRegistry.from([catalogApiRef, catalogApi]); describe('', () => { it('renders all owners', async () => { - render( + renderInTestApp( - -
asdf
+ + + + +
, + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, ); - expect(screen.getByText('asdf')).toBeInTheDocument(); + expect(screen.getByText('s1')).toBeInTheDocument(); expect(screen.queryByText('service1')).toBeNull(); - fireEvent.mouseOver(screen.getByTestId('popover')); - expect(screen.getByText('service1')).toBeInTheDocument(); + fireEvent.mouseOver(screen.getByTestId('popover1')); + expect(await screen.findByText('service1')).toBeInTheDocument(); + + expect(screen.getByText('s2')).toBeInTheDocument(); + expect(screen.queryByText('service2')).toBeNull(); + fireEvent.mouseOver(screen.getByTestId('popover2')); + expect( + await screen.findByText(/service2 was not found/), + ).toBeInTheDocument(); }); }); diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index bd41dd5b92..6e5b75ed58 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -34,17 +34,17 @@ import { Tooltip, Typography, } from '@material-ui/core'; -import { Alert, Skeleton } from '@material-ui/lab'; +import { Alert } from '@material-ui/lab'; import EmailIcon from '@material-ui/icons/Email'; import InfoIcon from '@material-ui/icons/Info'; import { useApiHolder, useRouteRef } from '@backstage/core-plugin-api'; import { - CompoundEntityRef, isUserEntity, isGroupEntity, UserEntity, GroupEntity, Entity, + parseEntityRef, } from '@backstage/catalog-model'; import { Link, Progress } from '@backstage/core-components'; @@ -54,11 +54,14 @@ import { Link, Progress } from '@backstage/core-components'; * @public */ export type EntityPeekAheadPopoverProps = PropsWithChildren<{ - entityRef: CompoundEntityRef; + entityRef: string; }>; const useStyles = makeStyles(() => { return { + trigger: { + display: 'inline-block', + }, popoverPaper: { width: '30em', }, @@ -130,33 +133,53 @@ const EntityCardActions = ({ entity }: { entity: Entity }) => { ); }; +const EntityNotFoundCard = ({ + entityRef, + error, +}: { + entityRef: string; + error?: Error; +}) => { + return ( + + + + {entityRef} was not found {error?.message} + + + + ); +}; + /** * Shows an entity popover on hover of a component. * * @public */ -export const EntityPeekAheadPopover = ({ - entityRef, - children, -}: EntityPeekAheadPopoverProps) => { +export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { + const { entityRef, children } = props; + const classes = useStyles(); const apiHolder = useApiHolder(); const popupState = usePopupState({ variant: 'popover', popupId: 'entity-peek-ahead', }); + const compoundEntityRef = parseEntityRef(entityRef); const [{ loading, error, value: entity }, load] = useAsyncFn(async () => { const catalogApi = apiHolder.get(catalogApiRef); if (catalogApi) { - const retrievedEntity = await catalogApi.getEntityByRef(entityRef); + const retrievedEntity = await catalogApi.getEntityByRef( + compoundEntityRef, + ); if (!retrievedEntity) { - throw new Error(`${entityRef.name} was not found`); + throw new Error(`${compoundEntityRef.name} was not found`); } return retrievedEntity; } return undefined; - }, [apiHolder, entityRef]); + }, [apiHolder, compoundEntityRef]); useEffect(() => { if (popupState.isOpen && !entity && !error && !loading) { @@ -166,9 +189,9 @@ export const EntityPeekAheadPopover = ({ return ( <> -
+ {children} -
+ - + <> {loading && } - - {entityRef.namespace} - - {entityRef.name} - - {error && {error.message}} - {entity ? ( - <> + {!entity && !loading && ( + + )} + {entity && ( + + + + {compoundEntityRef.namespace} + + + {compoundEntityRef.name} + {entity.kind} {entity.metadata.description} @@ -202,35 +229,28 @@ export const EntityPeekAheadPopover = ({ {(entity.metadata.tags || []) .slice(0, maxTagChips) .map(tag => { - return ; + return ; })} {entity.metadata.tags?.length && entity.metadata.tags?.length > maxTagChips && ( - + )}
- - ) : ( - <> - - - - - - )} - - - {entity && ( - <> - {isUserEntity(entity) && } - {isGroupEntity(entity) && } - - - )} - - + + + <> + {isUserEntity(entity) && } + {isGroupEntity(entity) && ( + + )} + + + + + )} + ); diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 813195cb70..de94866bb6 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -77,7 +77,7 @@ export const EntityRefLink = forwardRef( ); return ( - + {children} {!children && (title ?? formattedEntityRefTitle)} From 416affb607d355d2568f950d0fd9279faa507006 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 13 Dec 2022 14:17:21 +0000 Subject: [PATCH 023/141] review comments Signed-off-by: Brian Fletcher --- .changeset/red-tables-train.md | 4 +- .../EntityPeekAheadPopover.stories.tsx | 2 +- .../EntityRefLink/EntityRefLink.stories.tsx | 125 ++++++++++++++++++ 3 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx diff --git a/.changeset/red-tables-train.md b/.changeset/red-tables-train.md index 1aadde75cf..c2beceb3e7 100644 --- a/.changeset/red-tables-train.md +++ b/.changeset/red-tables-train.md @@ -2,4 +2,6 @@ '@backstage/plugin-catalog-react': patch --- -Add pop over on the `EntityRefLink` component. It shows a more details about the associated entity. +Add pop over on the `EntityRefLink` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entityreflink--default + +Add a reuseable pop over `EntityPeekAheadPopover` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entitypeekaheadpopover--default diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx index c44a31a743..bb24f293cb 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Backstage Authors + * Copyright 2022 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. diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx new file mode 100644 index 0000000000..e09bf89382 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx @@ -0,0 +1,125 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { ComponentType } from 'react'; +import { EntityRefLink, EntityRefLinkProps } from './EntityRefLink'; +import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils'; +import { catalogApiRef } from '../../api'; +import { CompoundEntityRef } from '@backstage/catalog-model'; +import { entityRouteRef } from '../../routes'; +import { CatalogApi } from '@backstage/catalog-client'; + +const mockCatalogApi = { + getEntityByRef: async (entityRef: CompoundEntityRef) => { + if ( + entityRef.namespace === 'default' && + entityRef.name === 'playback' && + entityRef.kind === 'component' + ) { + return { + kind: 'Component', + metadata: { + name: 'playback', + namespace: 'default', + description: 'Details about the playback service', + }, + }; + } + if ( + entityRef.namespace === 'default' && + entityRef.name === 'fname.lname' && + entityRef.kind === 'user' + ) { + return { + kind: 'User', + metadata: { + name: 'fname.lname', + namespace: 'default', + }, + spec: { + profile: { + email: 'fname.lname@example.com', + }, + }, + }; + } + if ( + entityRef.namespace === 'default' && + entityRef.name === 'slow.catalog.item' && + entityRef.kind === 'component' + ) { + await new Promise(resolve => setTimeout(resolve, 3000)); + return { + kind: 'Component', + metadata: { + name: 'slow.catalog.item', + namespace: 'default', + description: 'Details about the slow.catalog.item service', + }, + }; + } + return undefined; + }, +}; + +const defaultArgs = { + entityRef: 'component:default/playback', +}; + +export default { + title: 'Catalog /EntityRefLink', + decorators: [ + (Story: ComponentType<{}>) => + wrapInTestApp( + <> + + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }, + ), + ], +}; + +export const Default = (args: EntityRefLinkProps) => ( + +); +Default.args = defaultArgs; + +export const User = (args: EntityRefLinkProps) => ; +User.args = { + entityRef: 'user:default/fname.lname', +}; + +export const NotFound = (args: EntityRefLinkProps) => ( + +); +NotFound.args = { + entityRef: 'user:default/doesnt.exist', +}; + +export const SlowCatalogItem = (args: EntityRefLinkProps) => ( + +); +SlowCatalogItem.args = { + entityRef: 'component:default/slow.catalog.item', +}; From 8efe254e03fa70a2201d5e1826ce433ca5cfec7a Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 13 Dec 2022 14:24:06 +0000 Subject: [PATCH 024/141] fix typo Signed-off-by: Brian Fletcher --- .changeset/red-tables-train.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/red-tables-train.md b/.changeset/red-tables-train.md index c2beceb3e7..f32a0c5542 100644 --- a/.changeset/red-tables-train.md +++ b/.changeset/red-tables-train.md @@ -4,4 +4,4 @@ Add pop over on the `EntityRefLink` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entityreflink--default -Add a reuseable pop over `EntityPeekAheadPopover` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entitypeekaheadpopover--default +Add a reusable pop over `EntityPeekAheadPopover` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entitypeekaheadpopover--default From 0f9af920f400349253fd81e152f81d9c8954e639 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 15 Dec 2022 09:06:12 +0000 Subject: [PATCH 025/141] remove entity ref link popover This also: - adds stories for the entity ref links componet - and moves some of the components into another file Signed-off-by: Brian Fletcher --- .../CardActionComponents/EmailCardAction.tsx | 33 +++++++ .../EntityCardActions.tsx | 48 ++++++++++ .../CardActionComponents/GroupCardActions.tsx | 33 +++++++ .../CardActionComponents/UserCardActions.tsx | 33 +++++++ .../CardActionComponents/index.ts | 18 ++++ .../EntityNotFoundCard.tsx | 41 ++++++++ .../EntityPeekAheadPopover.tsx | 94 ++----------------- .../EntityRefLink/EntityRefLink.stories.tsx | 94 +------------------ .../EntityRefLink/EntityRefLink.tsx | 21 +++-- .../EntityRefLink/EntityRefLinks.stories.tsx | 42 +++++++++ 10 files changed, 275 insertions(+), 182 deletions(-) create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/GroupCardActions.tsx create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/UserCardActions.tsx create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/index.ts create mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx create mode 100644 plugins/catalog-react/src/components/EntityRefLink/EntityRefLinks.stories.tsx diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx new file mode 100644 index 0000000000..ed9ac7b9aa --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx @@ -0,0 +1,33 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Button, Tooltip } from '@material-ui/core'; +import EmailIcon from '@material-ui/icons/Email'; +import React from 'react'; + +/** + * Email Card action link + * + * @private + */ +export const EmailCardAction = ({ email }: { email: string }) => { + return ( + + + + ); +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx new file mode 100644 index 0000000000..d021a9f69d --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx @@ -0,0 +1,48 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { entityRouteRef } from '../../../routes'; +import { Tooltip } from '@material-ui/core'; +import InfoIcon from '@material-ui/icons/Info'; +import React from 'react'; +import { useRouteRef } from '@backstage/core-plugin-api'; +import { Entity } from '@backstage/catalog-model'; +import { Link } from '@backstage/core-components'; + +/** + * Card actions that show for all entities + * + * @private + */ +export const EntityCardActions = ({ entity }: { entity: Entity }) => { + const entityRoute = useRouteRef(entityRouteRef); + + return ( + <> + + + + + + + ); +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/GroupCardActions.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/GroupCardActions.tsx new file mode 100644 index 0000000000..fca0763703 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/GroupCardActions.tsx @@ -0,0 +1,33 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { EmailCardAction } from './EmailCardAction'; +import React from 'react'; +import { GroupEntity } from '@backstage/catalog-model'; + +/** + * Card actions that show for a group + * + * @private + */ +export const GroupCardActions = ({ entity }: { entity: GroupEntity }) => { + return ( + <> + {entity.spec.profile?.email && ( + + )} + + ); +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/UserCardActions.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/UserCardActions.tsx new file mode 100644 index 0000000000..57801497f6 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/UserCardActions.tsx @@ -0,0 +1,33 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { EmailCardAction } from './EmailCardAction'; +import React from 'react'; +import { UserEntity } from '@backstage/catalog-model'; + +/** + * Card actions that show for a user + * + * @private + */ +export const UserCardActions = ({ entity }: { entity: UserEntity }) => { + return ( + <> + {entity.spec.profile?.email && ( + + )} + + ); +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/index.ts b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/index.ts new file mode 100644 index 0000000000..75959026f7 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright 2022 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 { EntityCardActions } from './EntityCardActions'; +export { GroupCardActions } from './GroupCardActions'; +export { UserCardActions } from './UserCardActions'; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx new file mode 100644 index 0000000000..08d92cab22 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx @@ -0,0 +1,41 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Card, CardContent } from '@material-ui/core'; +import { Alert } from '@material-ui/lab'; +import React from 'react'; + +/** + * Entity not found card + * + * @private + */ +export const EntityNotFoundCard = ({ + entityRef, + error, +}: { + entityRef: string; + error?: Error; +}) => { + return ( + + + + {entityRef} was not found {error?.message} + + + + ); +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index 6e5b75ed58..c6cba8d421 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { entityRouteRef } from '../../routes'; import useAsyncFn from 'react-use/lib/useAsyncFn'; import { catalogApiRef } from '../../api'; import React, { PropsWithChildren, useEffect } from 'react'; @@ -25,7 +24,6 @@ import { } from 'material-ui-popup-state/hooks'; import { Box, - Button, Card, CardActions, CardContent, @@ -34,19 +32,19 @@ import { Tooltip, Typography, } from '@material-ui/core'; -import { Alert } from '@material-ui/lab'; -import EmailIcon from '@material-ui/icons/Email'; -import InfoIcon from '@material-ui/icons/Info'; -import { useApiHolder, useRouteRef } from '@backstage/core-plugin-api'; +import { useApiHolder } from '@backstage/core-plugin-api'; import { - isUserEntity, isGroupEntity, - UserEntity, - GroupEntity, - Entity, + isUserEntity, parseEntityRef, } from '@backstage/catalog-model'; -import { Link, Progress } from '@backstage/core-components'; +import { Progress } from '@backstage/core-components'; +import { + EntityCardActions, + UserCardActions, + GroupCardActions, +} from './CardActionComponents'; +import { EntityNotFoundCard } from './EntityNotFoundCard'; /** * Properties for an entity popover on hover of a component. @@ -77,80 +75,6 @@ const useStyles = makeStyles(() => { const maxTagChips = 4; -const EmailCardAction = ({ email }: { email: string }) => { - return ( - - - - ); -}; - -const UserCardActions = ({ entity }: { entity: UserEntity }) => { - return ( - <> - {entity.spec.profile?.email && ( - - )} - - ); -}; - -const GroupCardActions = ({ entity }: { entity: GroupEntity }) => { - return ( - <> - {entity.spec.profile?.email && ( - - )} - - ); -}; - -/** - * Shows an entity popover on hover of a component. - * - * @public - */ -const EntityCardActions = ({ entity }: { entity: Entity }) => { - const entityRoute = useRouteRef(entityRouteRef); - - return ( - <> - - - - - - - ); -}; - -const EntityNotFoundCard = ({ - entityRef, - error, -}: { - entityRef: string; - error?: Error; -}) => { - return ( - - - - {entityRef} was not found {error?.message} - - - - ); -}; - /** * Shows an entity popover on hover of a component. * diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx index e09bf89382..e82c4ab963 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.stories.tsx @@ -16,64 +16,8 @@ import React, { ComponentType } from 'react'; import { EntityRefLink, EntityRefLinkProps } from './EntityRefLink'; -import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils'; -import { catalogApiRef } from '../../api'; -import { CompoundEntityRef } from '@backstage/catalog-model'; +import { wrapInTestApp } from '@backstage/test-utils'; import { entityRouteRef } from '../../routes'; -import { CatalogApi } from '@backstage/catalog-client'; - -const mockCatalogApi = { - getEntityByRef: async (entityRef: CompoundEntityRef) => { - if ( - entityRef.namespace === 'default' && - entityRef.name === 'playback' && - entityRef.kind === 'component' - ) { - return { - kind: 'Component', - metadata: { - name: 'playback', - namespace: 'default', - description: 'Details about the playback service', - }, - }; - } - if ( - entityRef.namespace === 'default' && - entityRef.name === 'fname.lname' && - entityRef.kind === 'user' - ) { - return { - kind: 'User', - metadata: { - name: 'fname.lname', - namespace: 'default', - }, - spec: { - profile: { - email: 'fname.lname@example.com', - }, - }, - }; - } - if ( - entityRef.namespace === 'default' && - entityRef.name === 'slow.catalog.item' && - entityRef.kind === 'component' - ) { - await new Promise(resolve => setTimeout(resolve, 3000)); - return { - kind: 'Component', - metadata: { - name: 'slow.catalog.item', - namespace: 'default', - description: 'Details about the slow.catalog.item service', - }, - }; - } - return undefined; - }, -}; const defaultArgs = { entityRef: 'component:default/playback', @@ -83,20 +27,11 @@ export default { title: 'Catalog /EntityRefLink', decorators: [ (Story: ComponentType<{}>) => - wrapInTestApp( - <> - - - - , - { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, - }, + wrapInTestApp(, { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, }, - ), + }), ], }; @@ -104,22 +39,3 @@ export const Default = (args: EntityRefLinkProps) => ( ); Default.args = defaultArgs; - -export const User = (args: EntityRefLinkProps) => ; -User.args = { - entityRef: 'user:default/fname.lname', -}; - -export const NotFound = (args: EntityRefLinkProps) => ( - -); -NotFound.args = { - entityRef: 'user:default/doesnt.exist', -}; - -export const SlowCatalogItem = (args: EntityRefLinkProps) => ( - -); -SlowCatalogItem.args = { - entityRef: 'component:default/slow.catalog.item', -}; diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index de94866bb6..06a632232e 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -25,7 +25,8 @@ import { entityRouteRef } from '../../routes'; import { humanizeEntityRef } from './humanize'; import { Link, LinkProps } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; -import { EntityPeekAheadPopover } from '../EntityPeekAheadPopover'; +import { Tooltip } from '@material-ui/core'; + /** * Props for {@link EntityRefLink}. * @@ -76,13 +77,17 @@ export const EntityRefLink = forwardRef( { defaultKind }, ); - return ( - - - {children} - {!children && (title ?? formattedEntityRefTitle)} - - + const link = ( + + {children} + {!children && (title ?? formattedEntityRefTitle)} + + ); + + return title ? ( + {link} + ) : ( + link ); }, ) as (props: EntityRefLinkProps) => JSX.Element; diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLinks.stories.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLinks.stories.tsx new file mode 100644 index 0000000000..176dd24530 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLinks.stories.tsx @@ -0,0 +1,42 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { ComponentType } from 'react'; +import { EntityRefLinks, EntityRefLinksProps } from './EntityRefLinks'; +import { wrapInTestApp } from '@backstage/test-utils'; +import { CompoundEntityRef } from '@backstage/catalog-model'; +import { entityRouteRef } from '../../routes'; + +const defaultArgs = { + entityRefs: ['component:default/playback', 'user:default/fname.lname'], +}; + +export default { + title: 'Catalog /EntityRefLinks', + decorators: [ + (Story: ComponentType<{}>) => + wrapInTestApp(, { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, + }), + ], +}; + +export const Default = ( + args: EntityRefLinksProps, +) => ; +Default.args = defaultArgs; From b91bbaf3480123b3ab934e29dad5aa1f4e47f422 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 15 Dec 2022 09:24:32 +0000 Subject: [PATCH 026/141] remove entity ref link reference in changeset Signed-off-by: Brian Fletcher --- .changeset/red-tables-train.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.changeset/red-tables-train.md b/.changeset/red-tables-train.md index f32a0c5542..031d3720fc 100644 --- a/.changeset/red-tables-train.md +++ b/.changeset/red-tables-train.md @@ -2,6 +2,4 @@ '@backstage/plugin-catalog-react': patch --- -Add pop over on the `EntityRefLink` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entityreflink--default - Add a reusable pop over `EntityPeekAheadPopover` component. It shows more details about the associated entity. See the playbook here https://backstage.io/storybook/?path=/story/catalog-entitypeekaheadpopover--default From 645161da45981e81632cfca1a8f56e241ecc8a1a Mon Sep 17 00:00:00 2001 From: irma12 Date: Mon, 19 Dec 2022 09:16:29 +0100 Subject: [PATCH 027/141] Add delay to popup Signed-off-by: irma12 --- .../EntityPeekAheadPopover.tsx | 152 ++++++++++-------- 1 file changed, 89 insertions(+), 63 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index c6cba8d421..ad53182b90 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -15,7 +15,7 @@ */ import useAsyncFn from 'react-use/lib/useAsyncFn'; import { catalogApiRef } from '../../api'; -import React, { PropsWithChildren, useEffect } from 'react'; +import React, { PropsWithChildren, useEffect, useState } from 'react'; import HoverPopover from 'material-ui-popup-state/HoverPopover'; import { bindHover, @@ -45,6 +45,7 @@ import { GroupCardActions, } from './CardActionComponents'; import { EntityNotFoundCard } from './EntityNotFoundCard'; +import { debounce } from 'lodash'; /** * Properties for an entity popover on hover of a component. @@ -53,6 +54,7 @@ import { EntityNotFoundCard } from './EntityNotFoundCard'; */ export type EntityPeekAheadPopoverProps = PropsWithChildren<{ entityRef: string; + delayTime: number; }>; const useStyles = makeStyles(() => { @@ -81,7 +83,7 @@ const maxTagChips = 4; * @public */ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { - const { entityRef, children } = props; + const { entityRef, children, delayTime } = props; const classes = useStyles(); const apiHolder = useApiHolder(); @@ -90,6 +92,12 @@ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { popupId: 'entity-peek-ahead', }); const compoundEntityRef = parseEntityRef(entityRef); + const [isHovered, setIsHovered] = useState(false); + + const debouncedHandleMouseEnter = debounce( + () => setIsHovered(true), + delayTime, + ); const [{ loading, error, value: entity }, load] = useAsyncFn(async () => { const catalogApi = apiHolder.get(catalogApiRef); @@ -105,6 +113,11 @@ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { return undefined; }, [apiHolder, compoundEntityRef]); + const handleOnMouseLeave = () => { + setIsHovered(false); + debouncedHandleMouseEnter.cancel(); + }; + useEffect(() => { if (popupState.isOpen && !entity && !error && !loading) { load(); @@ -113,69 +126,82 @@ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { return ( <> - - {children} - - - <> - {loading && } - {!entity && !loading && ( - - )} - {entity && ( - - - - {compoundEntityRef.namespace} - - - {compoundEntityRef.name} - - {entity.kind} - - {entity.metadata.description} - - {entity.spec?.type} - - {(entity.metadata.tags || []) - .slice(0, maxTagChips) - .map(tag => { - return ; - })} - {entity.metadata.tags?.length && - entity.metadata.tags?.length > maxTagChips && ( - - - + + {children} + + + {isHovered && ( + + <> + {loading && } + {!entity && !loading && ( + + )} + {entity && ( + + + + {compoundEntityRef.namespace} + + + {compoundEntityRef.name} + + {entity.kind} + + {entity.metadata.description} + + {entity.spec?.type} + + {(entity.metadata.tags || []) + .slice(0, maxTagChips) + .map(tag => { + return ; + })} + {entity.metadata.tags?.length && + entity.metadata.tags?.length > maxTagChips && ( + + + + )} + + + + <> + {isUserEntity(entity) && ( + )} - - - - <> - {isUserEntity(entity) && } - {isGroupEntity(entity) && ( - - )} - - - - - )} - - + {isGroupEntity(entity) && ( + + )} + + + + + )} + + + )} ); }; From 665bbd338cdd406fd7fec2cad585d31d44a2a2e0 Mon Sep 17 00:00:00 2001 From: irma12 Date: Mon, 19 Dec 2022 10:13:33 +0100 Subject: [PATCH 028/141] Add default delayTime value Signed-off-by: irma12 --- .../EntityPeekAheadPopover/EntityPeekAheadPopover.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index ad53182b90..41b8cfbfb2 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -54,7 +54,7 @@ import { debounce } from 'lodash'; */ export type EntityPeekAheadPopoverProps = PropsWithChildren<{ entityRef: string; - delayTime: number; + delayTime?: number; }>; const useStyles = makeStyles(() => { @@ -83,7 +83,7 @@ const maxTagChips = 4; * @public */ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { - const { entityRef, children, delayTime } = props; + const { entityRef, children, delayTime = 500 } = props; const classes = useStyles(); const apiHolder = useApiHolder(); From 1252ff936e47a577d6db7c58799e9f2526d2350e Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Mon, 19 Dec 2022 13:17:50 +0000 Subject: [PATCH 029/141] fix api docs Signed-off-by: Brian Fletcher --- plugins/scaffolder/api-report.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 39e58a7a42..276c225cf1 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -110,9 +110,9 @@ export type EntityPickerUiOptions = export const EntityTagsPickerFieldExtension: FieldExtensionComponent< string[], { - showCounts?: boolean | undefined; - kinds?: string[] | undefined; helperText?: string | undefined; + kinds?: string[] | undefined; + showCounts?: boolean | undefined; } >; @@ -120,9 +120,9 @@ export const EntityTagsPickerFieldExtension: FieldExtensionComponent< export const EntityTagsPickerFieldSchema: FieldSchema< string[], { - showCounts?: boolean | undefined; - kinds?: string[] | undefined; helperText?: string | undefined; + kinds?: string[] | undefined; + showCounts?: boolean | undefined; } >; From fc1d240190490a48a8cc44c69078701e09263564 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Mon, 19 Dec 2022 08:20:20 -0500 Subject: [PATCH 030/141] Add UrlReader support for adr plugin The adr-backend plugin has been expanded with api endpoints that use url readers to read adr docs. This allows the adr frontend plugin to work with sites other than github, such as Azure DevOps. Created the concept of an AdrFileFetcher, which is used for retrieving adr file listings and content. EntityAdrContent and AdrReader have an optional prop to specify an override of the AdrFileFetcher to be used. By default, it uses the octokit fetcher for the octokit service. Signed-off-by: Robert Bunning --- packages/backend/package.json | 1 + packages/backend/src/index.ts | 5 +- packages/backend/src/plugins/adr.ts | 25 +++++++ plugins/adr-backend/package.json | 2 + plugins/adr-backend/src/index.ts | 1 + plugins/adr-backend/src/service/index.ts | 17 +++++ plugins/adr-backend/src/service/router.ts | 61 ++++++++++++++++ plugins/adr/package.json | 1 + .../src/components/AdrReader/AdrReader.tsx | 11 ++- .../EntityAdrContent/EntityAdrContent.tsx | 17 +++-- plugins/adr/src/hooks/adrFileFetcher.ts | 69 +++++++++++++++++++ yarn.lock | 10 ++- 12 files changed, 209 insertions(+), 11 deletions(-) create mode 100644 packages/backend/src/plugins/adr.ts create mode 100644 plugins/adr-backend/src/service/index.ts create mode 100644 plugins/adr-backend/src/service/router.ts create mode 100644 plugins/adr/src/hooks/adrFileFetcher.ts diff --git a/packages/backend/package.json b/packages/backend/package.json index 781eff31a3..47c188e7cc 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -32,6 +32,7 @@ "@backstage/catalog-model": "workspace:^", "@backstage/config": "workspace:^", "@backstage/integration": "workspace:^", + "@backstage/plugin-adr-backend": "workspace:^", "@backstage/plugin-app-backend": "workspace:^", "@backstage/plugin-auth-backend": "workspace:^", "@backstage/plugin-auth-node": "workspace:^", diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 371ce40358..a721c443d6 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Backstage Authors + * Copyright 2022 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. @@ -61,6 +61,7 @@ import badges from './plugins/badges'; import jenkins from './plugins/jenkins'; import permission from './plugins/permission'; import playlist from './plugins/playlist'; +import adr from './plugins/adr'; import { PluginEnvironment } from './types'; import { ServerPermissionClient } from '@backstage/plugin-permission-node'; import { DefaultIdentityClient } from '@backstage/plugin-auth-node'; @@ -139,6 +140,7 @@ async function main() { const appEnv = useHotMemoize(module, () => createEnv('app')); const badgesEnv = useHotMemoize(module, () => createEnv('badges')); const jenkinsEnv = useHotMemoize(module, () => createEnv('jenkins')); + const adrEnv = useHotMemoize(module, () => createEnv('adr')); const techInsightsEnv = useHotMemoize(module, () => createEnv('tech-insights'), ); @@ -175,6 +177,7 @@ async function main() { apiRouter.use('/permission', await permission(permissionEnv)); apiRouter.use('/playlist', await playlist(playlistEnv)); apiRouter.use('/explore', await explore(exploreEnv)); + apiRouter.use('/adr', await adr(adrEnv)); apiRouter.use(notFoundHandler()); const service = createServiceBuilder(module) diff --git a/packages/backend/src/plugins/adr.ts b/packages/backend/src/plugins/adr.ts new file mode 100644 index 0000000000..dceb4d0c69 --- /dev/null +++ b/packages/backend/src/plugins/adr.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createRouter } from '@backstage/plugin-adr-backend'; +import { Router } from 'express'; +import { PluginEnvironment } from '../types'; + +export default async function createPlugin( + env: PluginEnvironment, +): Promise { + return await createRouter(env.reader); +} diff --git a/plugins/adr-backend/package.json b/plugins/adr-backend/package.json index 66886415f3..84ec7ec5d1 100644 --- a/plugins/adr-backend/package.json +++ b/plugins/adr-backend/package.json @@ -36,6 +36,8 @@ "@backstage/integration": "workspace:^", "@backstage/plugin-adr-common": "workspace:^", "@backstage/plugin-search-common": "workspace:^", + "express": "^4.18.2", + "express-promise-router": "^4.1.1", "luxon": "^3.0.0", "marked": "^4.0.14", "node-fetch": "^2.6.5", diff --git a/plugins/adr-backend/src/index.ts b/plugins/adr-backend/src/index.ts index 86e07943df..5cc8f50b72 100644 --- a/plugins/adr-backend/src/index.ts +++ b/plugins/adr-backend/src/index.ts @@ -21,3 +21,4 @@ */ export * from './search'; +export * from './service'; diff --git a/plugins/adr-backend/src/service/index.ts b/plugins/adr-backend/src/service/index.ts new file mode 100644 index 0000000000..434446cf3f --- /dev/null +++ b/plugins/adr-backend/src/service/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2022 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 { createRouter } from './router'; diff --git a/plugins/adr-backend/src/service/router.ts b/plugins/adr-backend/src/service/router.ts new file mode 100644 index 0000000000..c70f7763e7 --- /dev/null +++ b/plugins/adr-backend/src/service/router.ts @@ -0,0 +1,61 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { UrlReader } from '@backstage/backend-common'; +import express from 'express'; +import Router from 'express-promise-router'; + +export async function createRouter(reader: UrlReader): Promise { + const router = Router(); + router.use(express.json()); + + router.get('/getAdrFilesAtUrl', async (req, res) => { + const urlToProcess = req.query.url as string; + if (!urlToProcess) { + res.statusCode = 400; + res.json({ message: 'No URL provided' }); + return; + } + + const treeGetResponse = await reader.readTree(urlToProcess); + const files = await treeGetResponse.files(); + const fileData = files.map(file => { + return { + type: 'file', + name: file.path.substring(file.path.lastIndexOf('/') + 1), + path: file.path, + }; + }); + + res.json({ data: fileData }); + }); + + router.get('/readAdrFileAtUrl', async (req, res) => { + const urlToProcess = req.query.url as string; + if (!urlToProcess) { + res.statusCode = 400; + res.json({ message: 'No URL provided' }); + return; + } + + const fileGetResponse = await reader.readUrl(urlToProcess); + const fileBuffer = await fileGetResponse.buffer(); + + res.json({ data: fileBuffer.toString() }); + }); + + return router; +} diff --git a/plugins/adr/package.json b/plugins/adr/package.json index 21e7ddd3ac..b28fdeb99c 100644 --- a/plugins/adr/package.json +++ b/plugins/adr/package.json @@ -28,6 +28,7 @@ "@backstage/integration-react": "workspace:^", "@backstage/plugin-adr-common": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", + "@backstage/plugin-permission-common": "workspace:^", "@backstage/plugin-search-common": "workspace:^", "@backstage/plugin-search-react": "workspace:^", "@backstage/theme": "workspace:^", diff --git a/plugins/adr/src/components/AdrReader/AdrReader.tsx b/plugins/adr/src/components/AdrReader/AdrReader.tsx index 971dae0949..6f76295e8c 100644 --- a/plugins/adr/src/components/AdrReader/AdrReader.tsx +++ b/plugins/adr/src/components/AdrReader/AdrReader.tsx @@ -26,9 +26,12 @@ import { scmIntegrationsApiRef } from '@backstage/integration-react'; import { getAdrLocationUrl } from '@backstage/plugin-adr-common'; import { useEntity } from '@backstage/plugin-catalog-react'; -import { useOctokitRequest } from '../../hooks'; import { adrDecoratorFactories } from './decorators'; import { AdrContentDecorator } from './types'; +import { + AdrFileFetcher, + octokitAdrFileFetcher, +} from '../../hooks/adrFileFetcher'; /** * Component to fetch and render an ADR. @@ -38,13 +41,15 @@ import { AdrContentDecorator } from './types'; export const AdrReader = (props: { adr: string; decorators?: AdrContentDecorator[]; + adrFileFetcher?: AdrFileFetcher; }) => { - const { adr, decorators } = props; + const { adr, decorators, adrFileFetcher } = props; const { entity } = useEntity(); const scmIntegrations = useApi(scmIntegrationsApiRef); const adrLocationUrl = getAdrLocationUrl(entity, scmIntegrations); - const { value, loading, error } = useOctokitRequest( + const targetAdrFileFetcher = adrFileFetcher ?? octokitAdrFileFetcher; + const { value, loading, error } = targetAdrFileFetcher.useReadAdrFileAtUrl( `${adrLocationUrl.replace(/\/$/, '')}/${adr}`, ); diff --git a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx index 37344cecca..1a75856ab1 100644 --- a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx +++ b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx @@ -44,9 +44,12 @@ import { Typography, } from '@material-ui/core'; -import { useOctokitRequest } from '../../hooks'; import { rootRouteRef } from '../../routes'; import { AdrContentDecorator, AdrReader } from '../AdrReader'; +import { + AdrFileFetcher, + octokitAdrFileFetcher, +} from '../../hooks/adrFileFetcher'; const useStyles = makeStyles((theme: Theme) => ({ adrMenu: { @@ -61,8 +64,9 @@ const useStyles = makeStyles((theme: Theme) => ({ export const EntityAdrContent = (props: { contentDecorators?: AdrContentDecorator[]; filePathFilterFn?: AdrFilePathFilterFn; + adrFileFetcher?: AdrFileFetcher; }) => { - const { contentDecorators, filePathFilterFn } = props; + const { contentDecorators, filePathFilterFn, adrFileFetcher } = props; const classes = useStyles(); const { entity } = useEntity(); const rootLink = useRouteRef(rootRouteRef); @@ -71,7 +75,8 @@ export const EntityAdrContent = (props: { const scmIntegrations = useApi(scmIntegrationsApiRef); const entityHasAdrs = isAdrAvailable(entity); - const { value, loading, error } = useOctokitRequest( + const targetAdrFileFetcher = adrFileFetcher ?? octokitAdrFileFetcher; + const { value, loading, error } = targetAdrFileFetcher.useGetAdrFilesAtUrl( getAdrLocationUrl(entity, scmIntegrations), ); @@ -142,7 +147,11 @@ export const EntityAdrContent = (props: { - + ) : ( diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts new file mode 100644 index 0000000000..2ddbe00434 --- /dev/null +++ b/plugins/adr/src/hooks/adrFileFetcher.ts @@ -0,0 +1,69 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { discoveryApiRef, useApi } from '@backstage/core-plugin-api'; +import { DiscoveryApi } from '@backstage/plugin-permission-common'; +import useAsync from 'react-use/lib/useAsync'; +import { useOctokitRequest } from './useOctokitRequest'; + +const useAdrApi = ( + endpoint: string, + fileUrl: string, + discoveryApi: DiscoveryApi, +) => { + return async () => { + const baseUrl = await discoveryApi.getBaseUrl('adr'); + const targetUrl = `${baseUrl}/${endpoint}?url=${encodeURIComponent( + fileUrl, + )}`; + + const result = await fetch(targetUrl); + const data = await result.json(); + + if (!result.ok) { + throw data; + } + return data; + }; +}; + +export interface AdrFileFetcher { + useGetAdrFilesAtUrl: (url: string) => any; + useReadAdrFileAtUrl: (url: string) => any; +} + +const getAdrFilesEndpoint = 'getAdrFilesAtUrl'; +const readAdrFileEndpoint = 'readAdrFileAtUrl'; + +export const urlReaderAdrFileFetcher: AdrFileFetcher = { + useGetAdrFilesAtUrl: function (url: string) { + const discoveryApi = useApi(discoveryApiRef); + return useAsync(useAdrApi(getAdrFilesEndpoint, url, discoveryApi), [ + url, + ]); + }, + useReadAdrFileAtUrl: function (url: string) { + const discoveryApi = useApi(discoveryApiRef); + return useAsync(useAdrApi(readAdrFileEndpoint, url, discoveryApi), [ + url, + ]); + }, +}; + +export const octokitAdrFileFetcher: AdrFileFetcher = { + useGetAdrFilesAtUrl: (url: string) => useOctokitRequest(url), + useReadAdrFileAtUrl: (url: string) => useOctokitRequest(url), +}; diff --git a/yarn.lock b/yarn.lock index c9d87f09b8..3f38b22fc1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4247,7 +4247,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-adr-backend@workspace:plugins/adr-backend": +"@backstage/plugin-adr-backend@workspace:^, @backstage/plugin-adr-backend@workspace:plugins/adr-backend": version: 0.0.0-use.local resolution: "@backstage/plugin-adr-backend@workspace:plugins/adr-backend" dependencies: @@ -4262,6 +4262,8 @@ __metadata: "@backstage/plugin-search-common": "workspace:^" "@types/marked": ^4.0.0 "@types/supertest": ^2.0.8 + express: ^4.18.2 + express-promise-router: ^4.1.1 luxon: ^3.0.0 marked: ^4.0.14 msw: ^0.49.0 @@ -4296,6 +4298,7 @@ __metadata: "@backstage/integration-react": "workspace:^" "@backstage/plugin-adr-common": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" + "@backstage/plugin-permission-common": "workspace:^" "@backstage/plugin-search-common": "workspace:^" "@backstage/plugin-search-react": "workspace:^" "@backstage/test-utils": "workspace:^" @@ -22303,6 +22306,7 @@ __metadata: "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" "@backstage/integration": "workspace:^" + "@backstage/plugin-adr-backend": "workspace:^" "@backstage/plugin-app-backend": "workspace:^" "@backstage/plugin-auth-backend": "workspace:^" "@backstage/plugin-auth-node": "workspace:^" @@ -22501,7 +22505,7 @@ __metadata: languageName: node linkType: hard -"express-promise-router@npm:^4.1.0": +"express-promise-router@npm:^4.1.0, express-promise-router@npm:^4.1.1": version: 4.1.1 resolution: "express-promise-router@npm:4.1.1" dependencies: @@ -22543,7 +22547,7 @@ __metadata: languageName: node linkType: hard -"express@npm:^4.17.1, express@npm:^4.17.3, express@npm:^4.18.1": +"express@npm:^4.17.1, express@npm:^4.17.3, express@npm:^4.18.1, express@npm:^4.18.2": version: 4.18.2 resolution: "express@npm:4.18.2" dependencies: From 99fea85ddf6c9287bad2f4b0d8767ab1c5e76156 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Mon, 19 Dec 2022 11:24:03 -0500 Subject: [PATCH 031/141] Updated documentation Added comments to exports. Updated READMEs for the adr-backend and adr plugins. Signed-off-by: Robert Bunning --- plugins/adr-backend/README.md | 2 ++ plugins/adr-backend/src/service/router.ts | 1 + plugins/adr/README.md | 25 ++++++++++++++++++++- plugins/adr/src/hooks/adrFileFetcher.ts | 27 +++++++++++++++++++++++ plugins/adr/src/index.ts | 1 + 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/plugins/adr-backend/README.md b/plugins/adr-backend/README.md index 79b5fe13ed..ab81c34c82 100644 --- a/plugins/adr-backend/README.md +++ b/plugins/adr-backend/README.md @@ -4,6 +4,8 @@ This ADR backend plugin is primarily responsible for the following: - Provides a `DefaultAdrCollatorFactory`, which can be used in the search backend to index ADR documents associated with entities to your Backstage Search. +- Provides endpoints that use UrlReaders for getting a ADR documents (used in the [ADR frontend plugin](../adr/README.md)). + ## Indexing ADR documents for search Before you are able to start indexing ADR documents to search, you need to go through the [search getting started guide](https://backstage.io/docs/features/search/getting-started). diff --git a/plugins/adr-backend/src/service/router.ts b/plugins/adr-backend/src/service/router.ts index c70f7763e7..1b896e2805 100644 --- a/plugins/adr-backend/src/service/router.ts +++ b/plugins/adr-backend/src/service/router.ts @@ -18,6 +18,7 @@ import { UrlReader } from '@backstage/backend-common'; import express from 'express'; import Router from 'express-promise-router'; +/** @public */ export async function createRouter(reader: UrlReader): Promise { const router = Router(); router.use(express.json()); diff --git a/plugins/adr/README.md b/plugins/adr/README.md index 2888ff2f07..2d3c2be9a4 100644 --- a/plugins/adr/README.md +++ b/plugins/adr/README.md @@ -4,7 +4,7 @@ Welcome to the ADR plugin! This plugin allows you to browse ADRs associated with your entities as well as a way to discover ADRs across others entities via Backstage Search. Use this to learn from the past experience of other projects to guide your own architecture decisions. -NOTE: This plugin currently only supports entities/ADRs registered via GitHub integration. +NOTE: By default, this plugin only supports entities/ADRs registered via GitHub integration. To get ADRs from other sites, see the [Using ADR plugin with sites other than GitHub](#using-adr-plugin-with-sites-other-than-github) section. ## Setup @@ -77,6 +77,29 @@ case 'adr': ); ``` +## Using ADR plugin with sites other than GitHub + +By default, the ADR plugin will only be able to retrieve ADRs through GitHub. If you would like to use it with other sites (for instance, AzureDevops): + +1. Make sure the [ADR backend plugin](../adr-backend/README.md) is installed. +2. [Configure an integration](https://backstage.io/docs/integrations/) for the site you would like to pull ADRs from. +3. Set the adrFileFetcher property on EntityAdrContent to urlReadersAdrFileFetcher: + +```jsx +// In packages/app/src/components/catalog/EntityPage.tsx +import { EntityAdrContent, isAdrAvailable, urlReaderAdrFileFetcher } from '@backstage/plugin-adr'; + +... + +const serviceEntityPage = ( + + {/* other tabs... */} + + + + +``` + ## Custom ADR formats By default, this plugin will parse ADRs according to the format specified by the [Markdown Architecture Decision Record (MADR)](https://adr.github.io/madr/) template. If your ADRs are written using a different format, you can apply the following customizations to correctly identify and parse your documents: diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts index 2ddbe00434..c0402df628 100644 --- a/plugins/adr/src/hooks/adrFileFetcher.ts +++ b/plugins/adr/src/hooks/adrFileFetcher.ts @@ -40,14 +40,36 @@ const useAdrApi = ( }; }; +/** + * Represents something that is capable of fetching a listing of adr files at a provided url + * and fetching the contents of an adr file at a provided url. + * + * @public + */ export interface AdrFileFetcher { + /** + * A hook to get a listing of adr files that exist at the provided url + * + * @param url The url to get files from + */ useGetAdrFilesAtUrl: (url: string) => any; + + /** + * A hook to get the contents of the adr file at the provided url + * + * @param url The url of the adr file + */ useReadAdrFileAtUrl: (url: string) => any; } const getAdrFilesEndpoint = 'getAdrFilesAtUrl'; const readAdrFileEndpoint = 'readAdrFileAtUrl'; +/** + * An AdrFileFetcher that uses UrlReaders to fetch adr files + * + * @public + */ export const urlReaderAdrFileFetcher: AdrFileFetcher = { useGetAdrFilesAtUrl: function (url: string) { const discoveryApi = useApi(discoveryApiRef); @@ -63,6 +85,11 @@ export const urlReaderAdrFileFetcher: AdrFileFetcher = { }, }; +/** + * An AdrFileFetcher that uses the useOctokitRequest hook for fetching adr files + * + * @public + */ export const octokitAdrFileFetcher: AdrFileFetcher = { useGetAdrFilesAtUrl: (url: string) => useOctokitRequest(url), useReadAdrFileAtUrl: (url: string) => useOctokitRequest(url), diff --git a/plugins/adr/src/index.ts b/plugins/adr/src/index.ts index 84012ccb7a..1b8406330f 100644 --- a/plugins/adr/src/index.ts +++ b/plugins/adr/src/index.ts @@ -22,3 +22,4 @@ export { isAdrAvailable } from '@backstage/plugin-adr-common'; export * from './components/AdrReader'; export { adrPlugin, EntityAdrContent } from './plugin'; export * from './search'; +export * from './hooks/adrFileFetcher'; From e4469d0ec1dcf75b52533e92bf79eda0e7ef79db Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Mon, 19 Dec 2022 11:54:31 -0500 Subject: [PATCH 032/141] Generated changeset Signed-off-by: Robert Bunning --- .changeset/dull-taxis-carry.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dull-taxis-carry.md diff --git a/.changeset/dull-taxis-carry.md b/.changeset/dull-taxis-carry.md new file mode 100644 index 0000000000..60800c40eb --- /dev/null +++ b/.changeset/dull-taxis-carry.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-adr': patch +'@backstage/plugin-adr-backend': patch +--- + +The adr plugin can now work with sites other than GitHub. Expanded the adr backend plugin to provide endpoints to facilitate this and changed EntityAdrContent and AdrReader to take an optional property, adrFileFetcher, to allow switching between the new implementation and the octokit one. By default, the octokit version is used. From 2e633f5e51963afb86c25abd875a51ebac7cee90 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 20 Dec 2022 14:41:22 +0000 Subject: [PATCH 033/141] add delay time to api report Signed-off-by: Brian Fletcher --- plugins/catalog-react/api-report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 82f8326a17..9528c55326 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -262,6 +262,7 @@ export const EntityPeekAheadPopover: ( // @public export type EntityPeekAheadPopoverProps = PropsWithChildren<{ entityRef: string; + delayTime?: number; }>; // @public (undocumented) From e253423ae4bea08357f49e072d6d46e4ff56b433 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 20 Dec 2022 16:39:26 +0000 Subject: [PATCH 034/141] remove api report for scaffolder Signed-off-by: Brian Fletcher --- plugins/scaffolder/api-report.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 9d388d225b..3fe1208ba9 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -110,9 +110,9 @@ export type EntityPickerUiOptions = export const EntityTagsPickerFieldExtension: FieldExtensionComponent< string[], { - helperText?: string | undefined; - kinds?: string[] | undefined; showCounts?: boolean | undefined; + kinds?: string[] | undefined; + helperText?: string | undefined; } >; @@ -120,9 +120,9 @@ export const EntityTagsPickerFieldExtension: FieldExtensionComponent< export const EntityTagsPickerFieldSchema: FieldSchema< string[], { - helperText?: string | undefined; - kinds?: string[] | undefined; showCounts?: boolean | undefined; + kinds?: string[] | undefined; + helperText?: string | undefined; } >; From fd19425ebe470e7ac270b72e2e07163946ffe792 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Tue, 20 Dec 2022 14:58:57 -0500 Subject: [PATCH 035/141] Added tests Signed-off-by: Robert Bunning --- .../adr-backend/src/service/router.test.ts | 206 ++++++++++++++++++ plugins/adr/package.json | 4 + .../components/AdrReader/AdrReader.test.tsx | 129 +++++++++++ .../EntityAdrContent.test.tsx | 139 ++++++++++++ yarn.lock | 4 + 5 files changed, 482 insertions(+) create mode 100644 plugins/adr-backend/src/service/router.test.ts create mode 100644 plugins/adr/src/components/AdrReader/AdrReader.test.tsx create mode 100644 plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx diff --git a/plugins/adr-backend/src/service/router.test.ts b/plugins/adr-backend/src/service/router.test.ts new file mode 100644 index 0000000000..7c42e6eba7 --- /dev/null +++ b/plugins/adr-backend/src/service/router.test.ts @@ -0,0 +1,206 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + ReadTreeResponse, + ReadTreeResponseFile, + ReadUrlResponse, + SearchResponse, + UrlReader, +} from '@backstage/backend-common'; +import express from 'express'; +import request from 'supertest'; +import { createRouter } from './router'; + +const makeBufferFromString = (string: string) => async () => + Buffer.from(string); + +const testingUrlFakeFileTree: ReadTreeResponseFile[] = [ + { + path: 'folder/testFile001.txt', + content: makeBufferFromString('folder/testFile001.txt content'), + }, + { + path: 'testFile001.txt', + content: makeBufferFromString('testFile002.txt content'), + }, + { + path: 'testFile002.txt', + content: makeBufferFromString('testFile001.txt content'), + }, +]; + +const makeFileContent = async (fileContent: string) => { + const result: ReadUrlResponse = { + buffer: makeBufferFromString(fileContent), + }; + return result; +}; + +const testFileOneContent = 'testFileOne content'; +const testFileTwoContent = 'testFileTwo content'; +const genericFileContent = 'file content'; + +const mockUrlReader: UrlReader = { + read: function (): Promise { + throw new Error('read not implemented.'); + }, + readUrl: function (url: string): Promise { + switch (url) { + case 'testFileOne': + return makeFileContent(testFileOneContent); + case 'testFileTwo': + return makeFileContent(testFileTwoContent); + default: + return makeFileContent(genericFileContent); + } + }, + readTree: function (): Promise { + const result: ReadTreeResponse = { + files: async () => testingUrlFakeFileTree, + archive: function (): Promise { + throw new Error('Function not implemented.'); + }, + dir: function (): Promise { + throw new Error('Function not implemented.'); + }, + etag: '', + }; + + const resultPromise = async () => result; + return resultPromise(); + }, + search: function (): Promise { + throw new Error('search not implemented.'); + }, +}; + +describe('createRouter', () => { + let app: express.Express; + + beforeEach(async () => { + jest.resetAllMocks(); + + const router = await createRouter(mockUrlReader); + app = express().use(router); + }); + + describe('GET /getAdrFilesAtUrl', () => { + it('returns bad request (400) when no url is provided', async () => { + const urlNotSpecifiedRequest = await request(app).get( + '/getAdrFilesAtUrl', + ); + const urlNotSpecifiedStatus = urlNotSpecifiedRequest.status; + const urlNotSpecifiedMessage = urlNotSpecifiedRequest.body.message; + + const urlNotFilledRequest = await request(app).get( + '/getAdrFilesAtUrl?url=', + ); + const urlNotFilledStatus = urlNotFilledRequest.status; + const urlNotFilledMessage = urlNotFilledRequest.body.message; + + const expectedStatusCode = 400; + const expectedErrorMessage = 'No URL provided'; + + expect(urlNotSpecifiedStatus).toBe(expectedStatusCode); + expect(urlNotSpecifiedMessage).toBe(expectedErrorMessage); + + expect(urlNotFilledStatus).toBe(expectedStatusCode); + expect(urlNotFilledMessage).toBe(expectedErrorMessage); + }); + + it('returns the correct listing when reading a url', async () => { + const result = await request(app).get('/getAdrFilesAtUrl?url=testing'); + const { status, body, error } = result; + + const expectedStatusCode = 200; + const expectedBody = { + data: [ + { + type: 'file', + name: 'testFile001.txt', + path: 'folder/testFile001.txt', + }, + { + type: 'file', + name: 'testFile001.txt', + path: 'testFile001.txt', + }, + { + type: 'file', + name: 'testFile002.txt', + path: 'testFile002.txt', + }, + ], + }; + + expect(error).toBeFalsy(); + expect(status).toBe(expectedStatusCode); + expect(body).toEqual(expectedBody); + }); + }); + + describe('GET /readAdrFileAtUrl', () => { + it('returns bad request (400) when no url is provided', async () => { + const urlNotSpecifiedRequest = await request(app).get( + '/readAdrFileAtUrl', + ); + const urlNotSpecifiedStatus = urlNotSpecifiedRequest.status; + const urlNotSpecifiedMessage = urlNotSpecifiedRequest.body.message; + + const urlNotFilledRequest = await request(app).get( + '/readAdrFileAtUrl?url=', + ); + const urlNotFilledStatus = urlNotFilledRequest.status; + const urlNotFilledMessage = urlNotFilledRequest.body.message; + + const expectedStatusCode = 400; + const expectedErrorMessage = 'No URL provided'; + + expect(urlNotSpecifiedStatus).toBe(expectedStatusCode); + expect(urlNotSpecifiedMessage).toBe(expectedErrorMessage); + + expect(urlNotFilledStatus).toBe(expectedStatusCode); + expect(urlNotFilledMessage).toBe(expectedErrorMessage); + }); + + it('returns the correct file contents when reading a url', async () => { + const fileOneResponse = await request(app).get( + '/readAdrFileAtUrl?url=testFileOne', + ); + const fileOneStatus = fileOneResponse.status; + const fileOneBody = fileOneResponse.body; + const fileOneError = fileOneResponse.error; + + const fileTwoResponse = await request(app).get( + '/readAdrFileAtUrl?url=testFileTwo', + ); + const fileTwoStatus = fileTwoResponse.status; + const fileTwoBody = fileTwoResponse.body; + const fileTwoError = fileTwoResponse.error; + + const expectedStatusCode = 200; + + expect(fileOneError).toBeFalsy(); + expect(fileOneStatus).toBe(expectedStatusCode); + expect(fileOneBody.data).toBe(testFileOneContent); + + expect(fileTwoError).toBeFalsy(); + expect(fileTwoStatus).toBe(expectedStatusCode); + expect(fileTwoBody.data).toBe(testFileTwoContent); + }); + }); +}); diff --git a/plugins/adr/package.json b/plugins/adr/package.json index b28fdeb99c..dda581c5cd 100644 --- a/plugins/adr/package.json +++ b/plugins/adr/package.json @@ -46,9 +46,13 @@ "react-router-dom": "6.0.0-beta.0 || ^6.3.0" }, "devDependencies": { + "@backstage/catalog-client": "workspace:^", "@backstage/cli": "workspace:^", "@backstage/core-app-api": "workspace:^", "@backstage/dev-utils": "workspace:^", + "@backstage/integration": "workspace:^", + "@backstage/plugin-catalog": "workspace:^", + "@backstage/plugin-permission-react": "workspace:^", "@backstage/test-utils": "workspace:^", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^12.1.3", diff --git a/plugins/adr/src/components/AdrReader/AdrReader.test.tsx b/plugins/adr/src/components/AdrReader/AdrReader.test.tsx new file mode 100644 index 0000000000..1b1cdcf851 --- /dev/null +++ b/plugins/adr/src/components/AdrReader/AdrReader.test.tsx @@ -0,0 +1,129 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { EntityLayout } from '@backstage/plugin-catalog'; +import { Entity, ANNOTATION_SOURCE_LOCATION } from '@backstage/catalog-model'; +import { ApiProvider } from '@backstage/core-app-api'; +import { CatalogApi } from '@backstage/catalog-client'; +import { + EntityProvider, + catalogApiRef, + starredEntitiesApiRef, + MockStarredEntitiesApi, +} from '@backstage/plugin-catalog-react'; +import { scmIntegrationsApiRef } from '@backstage/integration-react'; +import { permissionApiRef } from '@backstage/plugin-permission-react'; +import { + renderInTestApp, + TestApiRegistry, + MockPermissionApi, +} from '@backstage/test-utils'; +import { AdrReader } from './AdrReader'; +import { ScmIntegrationRegistry } from '@backstage/integration'; +import { ANNOTATION_ADR_LOCATION } from '@backstage/plugin-adr-common'; +import { + octokitAdrFileFetcher, + urlReaderAdrFileFetcher, +} from '../../hooks/adrFileFetcher'; + +const mockApis = TestApiRegistry.from( + [catalogApiRef, {} as CatalogApi], + [starredEntitiesApiRef, new MockStarredEntitiesApi()], + [permissionApiRef, new MockPermissionApi()], + [ + scmIntegrationsApiRef, + { + resolveUrl: options => `${options.url}`, + } as ScmIntegrationRegistry, + ], +); + +const mockEntity: Entity = { + kind: 'TestEntity', + metadata: { + name: 'Testing Entity 1', + annotations: { + [ANNOTATION_ADR_LOCATION]: 'testAdrFolder', + [ANNOTATION_SOURCE_LOCATION]: 'source:location', + }, + }, + apiVersion: '', +}; + +afterEach(() => { + jest.resetAllMocks(); +}); + +describe('AdrReader', () => { + it('Falls back to octokitAdrFileFetcher when adrFileFetcher is not specified', async () => { + const spyInstance = jest + .spyOn(octokitAdrFileFetcher, 'useReadAdrFileAtUrl') + .mockImplementation(() => { + return { data: '' }; + }); + + await renderInTestApp( + + + + + + + + + , + ); + + expect(spyInstance).toHaveBeenCalled(); + }); + + it('Uses an alternative AdrFileFetcher when provided', async () => { + const octokitSpyInstance = jest + .spyOn(octokitAdrFileFetcher, 'useReadAdrFileAtUrl') + .mockImplementation(() => { + return { + data: '', + }; + }); + + const urlReadersSpyInstance = jest + .spyOn(urlReaderAdrFileFetcher, 'useReadAdrFileAtUrl') + .mockImplementation(() => { + return { + data: '', + }; + }); + + await renderInTestApp( + + + + + + + + + , + ); + + expect(octokitSpyInstance).not.toHaveBeenCalled(); + expect(urlReadersSpyInstance).toHaveBeenCalled(); + }); +}); diff --git a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx new file mode 100644 index 0000000000..ca6397e736 --- /dev/null +++ b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx @@ -0,0 +1,139 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { EntityLayout } from '@backstage/plugin-catalog'; +import { Entity, ANNOTATION_SOURCE_LOCATION } from '@backstage/catalog-model'; +import { ApiProvider } from '@backstage/core-app-api'; +import { CatalogApi } from '@backstage/catalog-client'; +import { + EntityProvider, + catalogApiRef, + starredEntitiesApiRef, + MockStarredEntitiesApi, +} from '@backstage/plugin-catalog-react'; +import { scmIntegrationsApiRef } from '@backstage/integration-react'; +import { permissionApiRef } from '@backstage/plugin-permission-react'; +import { + renderInTestApp, + TestApiRegistry, + MockPermissionApi, +} from '@backstage/test-utils'; +import { ScmIntegrationRegistry } from '@backstage/integration'; +import { ANNOTATION_ADR_LOCATION } from '@backstage/plugin-adr-common'; +import { + octokitAdrFileFetcher, + urlReaderAdrFileFetcher, +} from '../../hooks/adrFileFetcher'; +import { EntityAdrContent } from './EntityAdrContent'; +import { rootRouteRef } from '../../routes'; + +const mockApis = TestApiRegistry.from( + [catalogApiRef, {} as CatalogApi], + [starredEntitiesApiRef, new MockStarredEntitiesApi()], + [permissionApiRef, new MockPermissionApi()], + [ + scmIntegrationsApiRef, + { + resolveUrl: options => `${options.url}`, + } as ScmIntegrationRegistry, + ], +); + +const mockEntity: Entity = { + kind: 'TestEntity', + metadata: { + name: 'Testing Entity 1', + annotations: { + [ANNOTATION_ADR_LOCATION]: 'testAdrFolder', + [ANNOTATION_SOURCE_LOCATION]: 'source:location', + }, + }, + apiVersion: '', +}; + +afterEach(() => { + jest.resetAllMocks(); +}); + +describe('EntityAdrContent', () => { + it('Falls back to octokitAdrFileFetcher when adrFileFetcher is not specified', async () => { + const getAdrFilesSpyInstance = jest + .spyOn(octokitAdrFileFetcher, 'useGetAdrFilesAtUrl') + .mockImplementation(() => { + return { + data: [], + }; + }); + + await renderInTestApp( + + + + + + + + + , + { + mountedRoutes: { + '/adr': rootRouteRef, + }, + }, + ); + + expect(getAdrFilesSpyInstance).toHaveBeenCalled(); + }); + + it('Uses an alternative AdrFileFetcher when provided', async () => { + const octokitGetAdrFilesSpyInstance = jest + .spyOn(octokitAdrFileFetcher, 'useGetAdrFilesAtUrl') + .mockImplementation(() => { + return { + data: [], + }; + }); + + const urlReadersGetAdrFilesSpyInstance = jest + .spyOn(urlReaderAdrFileFetcher, 'useGetAdrFilesAtUrl') + .mockImplementation(() => { + return { + data: [], + }; + }); + + await renderInTestApp( + + + + + + + + + , + { + mountedRoutes: { + '/adr': rootRouteRef, + }, + }, + ); + + expect(octokitGetAdrFilesSpyInstance).not.toHaveBeenCalled(); + expect(urlReadersGetAdrFilesSpyInstance).toHaveBeenCalled(); + }); +}); diff --git a/yarn.lock b/yarn.lock index 3f38b22fc1..eb0e5f3476 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4289,16 +4289,20 @@ __metadata: version: 0.0.0-use.local resolution: "@backstage/plugin-adr@workspace:plugins/adr" dependencies: + "@backstage/catalog-client": "workspace:^" "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/core-app-api": "workspace:^" "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" + "@backstage/integration": "workspace:^" "@backstage/integration-react": "workspace:^" "@backstage/plugin-adr-common": "workspace:^" + "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" "@backstage/plugin-permission-common": "workspace:^" + "@backstage/plugin-permission-react": "workspace:^" "@backstage/plugin-search-common": "workspace:^" "@backstage/plugin-search-react": "workspace:^" "@backstage/test-utils": "workspace:^" From f50f2cf89147e64e5643d60d5a1b8b7da485a7e6 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Tue, 20 Dec 2022 15:13:23 -0500 Subject: [PATCH 036/141] Fixed spelling mistake in adr's readme Signed-off-by: Robert Bunning --- plugins/adr/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/adr/README.md b/plugins/adr/README.md index 2d3c2be9a4..2478622560 100644 --- a/plugins/adr/README.md +++ b/plugins/adr/README.md @@ -83,7 +83,7 @@ By default, the ADR plugin will only be able to retrieve ADRs through GitHub. If 1. Make sure the [ADR backend plugin](../adr-backend/README.md) is installed. 2. [Configure an integration](https://backstage.io/docs/integrations/) for the site you would like to pull ADRs from. -3. Set the adrFileFetcher property on EntityAdrContent to urlReadersAdrFileFetcher: +3. Set the adrFileFetcher property on EntityAdrContent to urlReaderAdrFileFetcher: ```jsx // In packages/app/src/components/catalog/EntityPage.tsx From 502aea62e1da13362cdb27cee748a93db6eafc59 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 21 Dec 2022 10:49:26 -0500 Subject: [PATCH 037/141] Generated api reports Signed-off-by: Robert Bunning --- plugins/adr-backend/api-report.md | 4 ++++ plugins/adr/api-report.md | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/plugins/adr-backend/api-report.md b/plugins/adr-backend/api-report.md index 5a671e9c8f..24e54e8eb5 100644 --- a/plugins/adr-backend/api-report.md +++ b/plugins/adr-backend/api-report.md @@ -11,6 +11,7 @@ import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; import { Entity } from '@backstage/catalog-model'; +import express from 'express'; import { Logger } from 'winston'; import { PluginCacheManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; @@ -44,6 +45,9 @@ export type AdrParserContext = { // @public export const createMadrParser: (options?: MadrParserOptions) => AdrParser; +// @public (undocumented) +export function createRouter(reader: UrlReader): Promise; + // @public export class DefaultAdrCollatorFactory implements DocumentCollatorFactory { // (undocumented) diff --git a/plugins/adr/api-report.md b/plugins/adr/api-report.md index ecec0c0dd5..99d3e537a3 100644 --- a/plugins/adr/api-report.md +++ b/plugins/adr/api-report.md @@ -20,6 +20,14 @@ export type AdrContentDecorator = (adrInfo: { content: string; }; +// @public +export interface AdrFileFetcher { + // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen + useGetAdrFilesAtUrl: (url: string) => any; + // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen + useReadAdrFileAtUrl: (url: string) => any; +} + // @public export const adrPlugin: BackstagePlugin< { @@ -31,7 +39,11 @@ export const adrPlugin: BackstagePlugin< // @public export const AdrReader: { - (props: { adr: string; decorators?: AdrContentDecorator[] }): JSX.Element; + (props: { + adr: string; + decorators?: AdrContentDecorator[]; + adrFileFetcher?: AdrFileFetcher; + }): JSX.Element; decorators: Readonly<{ createRewriteRelativeLinksDecorator(): AdrContentDecorator; createRewriteRelativeEmbedsDecorator(): AdrContentDecorator; @@ -50,7 +62,14 @@ export function AdrSearchResultListItem(props: { export const EntityAdrContent: (props: { contentDecorators?: AdrContentDecorator[] | undefined; filePathFilterFn?: AdrFilePathFilterFn | undefined; + adrFileFetcher?: AdrFileFetcher | undefined; }) => JSX.Element; export { isAdrAvailable }; + +// @public +export const octokitAdrFileFetcher: AdrFileFetcher; + +// @public +export const urlReaderAdrFileFetcher: AdrFileFetcher; ``` From 4b08032f84a7d9a0700396828f2392c27b71f367 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 21 Dec 2022 11:04:29 -0500 Subject: [PATCH 038/141] Addressed linter warnings Signed-off-by: Robert Bunning --- plugins/adr-backend/src/service/router.test.ts | 12 ++++++------ plugins/adr/src/hooks/adrFileFetcher.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/adr-backend/src/service/router.test.ts b/plugins/adr-backend/src/service/router.test.ts index 7c42e6eba7..b58543dbf0 100644 --- a/plugins/adr-backend/src/service/router.test.ts +++ b/plugins/adr-backend/src/service/router.test.ts @@ -55,10 +55,10 @@ const testFileTwoContent = 'testFileTwo content'; const genericFileContent = 'file content'; const mockUrlReader: UrlReader = { - read: function (): Promise { + read() { throw new Error('read not implemented.'); }, - readUrl: function (url: string): Promise { + readUrl(url: string) { switch (url) { case 'testFileOne': return makeFileContent(testFileOneContent); @@ -68,13 +68,13 @@ const mockUrlReader: UrlReader = { return makeFileContent(genericFileContent); } }, - readTree: function (): Promise { + readTree() { const result: ReadTreeResponse = { files: async () => testingUrlFakeFileTree, - archive: function (): Promise { + archive() { throw new Error('Function not implemented.'); }, - dir: function (): Promise { + dir() { throw new Error('Function not implemented.'); }, etag: '', @@ -83,7 +83,7 @@ const mockUrlReader: UrlReader = { const resultPromise = async () => result; return resultPromise(); }, - search: function (): Promise { + search() { throw new Error('search not implemented.'); }, }; diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts index c0402df628..a9dec1105e 100644 --- a/plugins/adr/src/hooks/adrFileFetcher.ts +++ b/plugins/adr/src/hooks/adrFileFetcher.ts @@ -71,13 +71,13 @@ const readAdrFileEndpoint = 'readAdrFileAtUrl'; * @public */ export const urlReaderAdrFileFetcher: AdrFileFetcher = { - useGetAdrFilesAtUrl: function (url: string) { + useGetAdrFilesAtUrl(url: string) { const discoveryApi = useApi(discoveryApiRef); return useAsync(useAdrApi(getAdrFilesEndpoint, url, discoveryApi), [ url, ]); }, - useReadAdrFileAtUrl: function (url: string) { + useReadAdrFileAtUrl(url: string) { const discoveryApi = useApi(discoveryApiRef); return useAsync(useAdrApi(readAdrFileEndpoint, url, discoveryApi), [ url, From 722713a64b960343d8d05070dde7f42a7c7f3d2c Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 21 Dec 2022 11:12:59 -0500 Subject: [PATCH 039/141] Capitalized ADR in changeset Signed-off-by: Robert Bunning --- .changeset/dull-taxis-carry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/dull-taxis-carry.md b/.changeset/dull-taxis-carry.md index 60800c40eb..6f2901bac2 100644 --- a/.changeset/dull-taxis-carry.md +++ b/.changeset/dull-taxis-carry.md @@ -3,4 +3,4 @@ '@backstage/plugin-adr-backend': patch --- -The adr plugin can now work with sites other than GitHub. Expanded the adr backend plugin to provide endpoints to facilitate this and changed EntityAdrContent and AdrReader to take an optional property, adrFileFetcher, to allow switching between the new implementation and the octokit one. By default, the octokit version is used. +The ADR plugin can now work with sites other than GitHub. Expanded the ADR backend plugin to provide endpoints to facilitate this and changed EntityAdrContent and AdrReader to take an optional property, adrFileFetcher, to allow switching between the new implementation and the octokit one. By default, the octokit version is used. From 2a90eb36681a16712cf8881afc90683b94befd50 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 21 Dec 2022 11:44:10 -0500 Subject: [PATCH 040/141] Remove unused SearchResponse import in test Signed-off-by: Robert Bunning --- plugins/adr-backend/src/service/router.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/adr-backend/src/service/router.test.ts b/plugins/adr-backend/src/service/router.test.ts index b58543dbf0..6cfccb0a40 100644 --- a/plugins/adr-backend/src/service/router.test.ts +++ b/plugins/adr-backend/src/service/router.test.ts @@ -18,7 +18,6 @@ import { ReadTreeResponse, ReadTreeResponseFile, ReadUrlResponse, - SearchResponse, UrlReader, } from '@backstage/backend-common'; import express from 'express'; From 39b54c6dd033eeffd157b32bee1e734bfb7d779d Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 21 Dec 2022 12:44:16 -0500 Subject: [PATCH 041/141] Fixed missing hyphen in param tag Signed-off-by: Robert Bunning --- plugins/adr/api-report.md | 2 -- plugins/adr/src/hooks/adrFileFetcher.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/adr/api-report.md b/plugins/adr/api-report.md index 99d3e537a3..2a49e89b2d 100644 --- a/plugins/adr/api-report.md +++ b/plugins/adr/api-report.md @@ -22,9 +22,7 @@ export type AdrContentDecorator = (adrInfo: { // @public export interface AdrFileFetcher { - // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen useGetAdrFilesAtUrl: (url: string) => any; - // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen useReadAdrFileAtUrl: (url: string) => any; } diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts index a9dec1105e..fa690556e6 100644 --- a/plugins/adr/src/hooks/adrFileFetcher.ts +++ b/plugins/adr/src/hooks/adrFileFetcher.ts @@ -50,14 +50,14 @@ export interface AdrFileFetcher { /** * A hook to get a listing of adr files that exist at the provided url * - * @param url The url to get files from + * @param url - The url to get files from */ useGetAdrFilesAtUrl: (url: string) => any; /** * A hook to get the contents of the adr file at the provided url * - * @param url The url of the adr file + * @param url - The url of the adr file */ useReadAdrFileAtUrl: (url: string) => any; } From 0b1c9e4d651ed7267849dd08c565e82fbbc26912 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 21 Dec 2022 13:28:46 -0500 Subject: [PATCH 042/141] Added express types to adr-backend plugin Signed-off-by: Robert Bunning --- plugins/adr-backend/package.json | 1 + yarn.lock | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/adr-backend/package.json b/plugins/adr-backend/package.json index 90996ce7cf..3b1f19ec01 100644 --- a/plugins/adr-backend/package.json +++ b/plugins/adr-backend/package.json @@ -36,6 +36,7 @@ "@backstage/integration": "workspace:^", "@backstage/plugin-adr-common": "workspace:^", "@backstage/plugin-search-common": "workspace:^", + "@types/express": "^4.17.15", "express": "^4.18.2", "express-promise-router": "^4.1.1", "luxon": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index 1091eb58f7..d18b10cb4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4109,6 +4109,7 @@ __metadata: "@backstage/integration": "workspace:^" "@backstage/plugin-adr-common": "workspace:^" "@backstage/plugin-search-common": "workspace:^" + "@types/express": ^4.17.15 "@types/marked": ^4.0.0 "@types/supertest": ^2.0.8 express: ^4.18.2 @@ -14015,7 +14016,7 @@ __metadata: languageName: node linkType: hard -"@types/express-serve-static-core@npm:*, @types/express-serve-static-core@npm:4.17.31, @types/express-serve-static-core@npm:^4.17.18, @types/express-serve-static-core@npm:^4.17.5": +"@types/express-serve-static-core@npm:*, @types/express-serve-static-core@npm:4.17.31, @types/express-serve-static-core@npm:^4.17.18, @types/express-serve-static-core@npm:^4.17.31, @types/express-serve-static-core@npm:^4.17.5": version: 4.17.31 resolution: "@types/express-serve-static-core@npm:4.17.31" dependencies: @@ -14045,7 +14046,19 @@ __metadata: languageName: node linkType: hard -"@types/express@npm:*, @types/express@npm:4.17.14, @types/express@npm:^4.17.13, @types/express@npm:^4.17.6": +"@types/express@npm:*, @types/express@npm:^4.17.13, @types/express@npm:^4.17.15, @types/express@npm:^4.17.6": + version: 4.17.15 + resolution: "@types/express@npm:4.17.15" + dependencies: + "@types/body-parser": "*" + "@types/express-serve-static-core": ^4.17.31 + "@types/qs": "*" + "@types/serve-static": "*" + checksum: b4acd8a836d4f6409cdf79b12d6e660485249b62500cccd61e7997d2f520093edf77d7f8498ca79d64a112c6434b6de5ca48039b8fde2c881679eced7e96979b + languageName: node + linkType: hard + +"@types/express@npm:4.17.14": version: 4.17.14 resolution: "@types/express@npm:4.17.14" dependencies: From 679c181db1723c73f760fe61b8fe7418df7151a9 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 22 Dec 2022 09:55:54 -0500 Subject: [PATCH 043/141] chore: Ignore local reference and ignore eslint Signed-off-by: Adam Harvey --- scripts/check-docs-quality.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/check-docs-quality.js b/scripts/check-docs-quality.js index ac9db65b40..9c7f444033 100755 --- a/scripts/check-docs-quality.js +++ b/scripts/check-docs-quality.js @@ -23,6 +23,7 @@ const IGNORED = [ /^.*[/\\]CHANGELOG\.md$/, /^.*[/\\]api-report\.md$/, /^docs[/\\]releases[/\\].*-changelog\.md$/, + /^docs[/\\]reference[/\\]/, ]; const rootDir = resolvePath(__dirname, '..'); @@ -55,6 +56,7 @@ async function listFiles(dir = '') { // caused by the script. In CI, we want to ensure vale linter is run. async function exitIfMissingVale() { try { + // eslint-disable-next-line import/no-extraneous-dependencies await require('command-exists')('vale'); } catch (e) { if (process.env.CI) { @@ -72,7 +74,7 @@ async function exitIfMissingVale() { async function runVale(files) { const result = spawnSync( 'vale', - ['--config', resolvePath(rootDir, '.github/vale/config.ini'), ...files], + ['--config', resolvePath(rootDir, '.vale.ini'), ...files], { stdio: 'inherit', }, From 82996901dca5b1e5f76dd84265cf7ec31a4cafa7 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 22 Dec 2022 09:56:37 -0500 Subject: [PATCH 044/141] chore: Refactor Vale config to better support local editing Signed-off-by: Adam Harvey --- .github/{vale => vale-styles}/Vocab/Backstage/accept.txt | 2 +- .github/vale/config.ini | 6 ------ .vale.ini | 5 ++++- 3 files changed, 5 insertions(+), 8 deletions(-) rename .github/{vale => vale-styles}/Vocab/Backstage/accept.txt (99%) delete mode 100644 .github/vale/config.ini diff --git a/.github/vale/Vocab/Backstage/accept.txt b/.github/vale-styles/Vocab/Backstage/accept.txt similarity index 99% rename from .github/vale/Vocab/Backstage/accept.txt rename to .github/vale-styles/Vocab/Backstage/accept.txt index bba59094e3..dd64ea849c 100644 --- a/.github/vale/Vocab/Backstage/accept.txt +++ b/.github/vale-styles/Vocab/Backstage/accept.txt @@ -316,7 +316,7 @@ sparklines Splunk Spotifiers spotify -Spotify +# Spotify sqlite sqs squidfunk diff --git a/.github/vale/config.ini b/.github/vale/config.ini deleted file mode 100644 index 36acb2c058..0000000000 --- a/.github/vale/config.ini +++ /dev/null @@ -1,6 +0,0 @@ -StylesPath = . -Vocab = Backstage - -[*.md] -BasedOnStyles = Vale -Vale.Terms = NO diff --git a/.vale.ini b/.vale.ini index fd1ea53b0d..4975a81f28 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,4 +1,7 @@ -StylesPath = .github/styles +StylesPath = .github/vale-styles + +Vocab = Backstage [*.md] BasedOnStyles = Vale +Vale.Terms = NO From 95c2c9430e471fd32b917d5bef555897d0a2a0cb Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 22 Dec 2022 10:16:24 -0500 Subject: [PATCH 045/141] fix: Return company proper case Signed-off-by: Adam Harvey --- .github/vale-styles/Vocab/Backstage/accept.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/vale-styles/Vocab/Backstage/accept.txt b/.github/vale-styles/Vocab/Backstage/accept.txt index dd64ea849c..bba59094e3 100644 --- a/.github/vale-styles/Vocab/Backstage/accept.txt +++ b/.github/vale-styles/Vocab/Backstage/accept.txt @@ -316,7 +316,7 @@ sparklines Splunk Spotifiers spotify -# Spotify +Spotify sqlite sqs squidfunk From ad490c7115ad73f1536eb0a8e110db44d0f7deae Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 22 Dec 2022 10:33:32 -0500 Subject: [PATCH 046/141] fix: Return original folder name Signed-off-by: Adam Harvey --- .../vale-styles/Vocab/Backstage/accept.txt | 416 ------------------ .vale.ini | 2 +- 2 files changed, 1 insertion(+), 417 deletions(-) delete mode 100644 .github/vale-styles/Vocab/Backstage/accept.txt diff --git a/.github/vale-styles/Vocab/Backstage/accept.txt b/.github/vale-styles/Vocab/Backstage/accept.txt deleted file mode 100644 index 20e1c867a7..0000000000 --- a/.github/vale-styles/Vocab/Backstage/accept.txt +++ /dev/null @@ -1,416 +0,0 @@ -abc -accessors -ACLs -addon -addons -ADRs -airbrake -Airbrake -Airbrakes -Alaria -Alef -Anddddd -Apdex -api -asciidoc -async -Atlassian -automations -autoscaling -Autoscaling -autoselect -Avro -backend's -backported -backporting -Bigtable -Billett -bitbucket -Bitrise -Blackbox -bool -boolean -Brex -builtins -callout -CDNs -Chai -changeset -changesets -Changesets -chanwit -Chanwit -CI/CD -classname -cli -cloudbuild -Cloudflare -Cloudformation -cncf -Cobertura -codeblocks -Codecov -codehilite -Codehilite -codemod -codemods -codeowners -codescene -CodeScene -composability -composable -config -Config -configmaps -configs -const -cookiecutter -Corti -cron -cronjobs -crontab -css -Datadog -dataflow -dayjs -debounce -Debounce -debuggability -declaratively -deduplicated -dependabot -deps -destructured -destructuring -dev -devops -devs -discoverability -Discoverability -dls -Dockerfile -dockerfiles -Dockerize -dockerode -Docusaurus -DOMPurify -don'ts -dynatrace -Dynatrace -ecco -elasticsearch -env -Env -esbuild -eslint -ESModule -ESModules -etag -Expedia -facto -failover -Fargate -Figma -firehydrant -FireHydrant -Firekube -Firestore -Fiverr -Francesco -gerrit -Gerrit -gitbeaker -gitea -Gitea -github -Gitiles -gitlab -GitLab -globals -Gource -Grafana -graphql -GraphQL -graphviz -Hackathons -haproxy -hardcoded -Helidon -Heroku -hoc -horizontalpodautoscalers -Hostname -hotspots -http -https -Iain -Iglesias -iLert -img -incentivised -Indal -indexable -inlined -inlinehilite -integrator's -interop -JaCoCo -JavaScript -jenkins -Jira -jq -js -json -jsonnet -jsx -JWTs -Kaewkasi -Keyv -Knex -KPIs -kubectl -kubernetes -kubernetes -ldap -learnings -Leasot -lerna -Lerna -LocalStack -lockdown -lockfile -lunr -Luxon -magiclink -mailto -maintainer's -maintainership -makefile -md -memcache -memoize -memoized -microservice -microservices -microsite -microtasks -middleware -minikube -Minikube -Minio -misconfiguration -misconfigured -mkdocs -Mkdocs -monorepo -Monorepo -monorepos -msgraph -msw -mutex -mutexes -mysql -namespace -namespaced -namespaces -Namespaces -namespacing -neuro -newrelic -nginx -nodegit -nohoist -nonces -noop -npm -nunjucks -nvarchar -nvm -OAuth -octokit -oidc -Okta -Oldsberg -onboarding -Onboarding -OpenShift -orgs -padding -paddings -pagerduty -pageview -parallelization -parseable -Patrik -pattison -Peloton -performant -Performant -periskop -Periskop -permissioned -permissioning -plantuml -Platformize -Podman -postgres -postpack -pre -prebaked -preconfigured -prepack -Preprarer -productional -Protobuf -proxying -Proxying -pseudonymized -pubsub -pygments -pymdownx -rankdir -readme -Readme -readonly -rebase -Recharts -Redash -replicasets -repo -Repo -repos -rerender -rerenders -reusability -Reusability -roadmaps -rollbar -Rollbar -Rollup -routable -Routable -rst -rsync -ruleset -runbook -sam -sanitization -scaffolded -scaffolder -Scaffolder -scrollbar -seb -semlas -semver -serializable -Serverless -shoutout -SIG -SIGs -siloed -Sinon -Snyk -Sonarqube -sourcemaps -sparklines -Splunk -Spotifiers -spotify -Spotify -sqlite -sqs -squidfunk -src -statefulsets -stdout -storable -stringified -stringify -subcomponent -subcomponents -subfolder -subfolders -subheader -subheaders -subkey -subroutes -subtree -superfences -Superfences -superset -supertype -SVGs -talkdesk -Talkdesk -Tanzu -tasklist -techdocs -Telenor -telus -templated -templater -Templater -templaters -Templaters -TFRecord -theia -thumbsup -todo -todos -togglable -tolerations -Tolerations -toolchain -toolsets -tooltip -tooltips -touchpoint -transpilation -transpiled -transpiler -transpilers -truthy -TSDoc -typeahead -ui -unbreak -Unconference -unmanaged -unregister -unregistering -unregistration -untracked -upsert -upvote -URIs -URLs -utils -Valentina -validator -validators -varchar -VMware -VPCs -VSCode -Wayfair -Weaveworks -Webpack -widget's -winston -www -WWW -XCMetrics -XML -xyz -yaml -Zalando -Zhou -zod -Zolotusky -zoomable -zsh -Lainfiesta -allowlisted -Dominik -Henneke -Kuang diff --git a/.vale.ini b/.vale.ini index 4975a81f28..fa7864a878 100644 --- a/.vale.ini +++ b/.vale.ini @@ -1,4 +1,4 @@ -StylesPath = .github/vale-styles +StylesPath = .github/vale Vocab = Backstage From b3484d436871a33588718cdf0aa691f298ed824b Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 22 Dec 2022 11:07:38 -0500 Subject: [PATCH 047/141] fix: Missed the renamed file Signed-off-by: Adam Harvey --- .github/vale/Vocab/Backstage/accept.txt | 416 ++++++++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 .github/vale/Vocab/Backstage/accept.txt diff --git a/.github/vale/Vocab/Backstage/accept.txt b/.github/vale/Vocab/Backstage/accept.txt new file mode 100644 index 0000000000..20e1c867a7 --- /dev/null +++ b/.github/vale/Vocab/Backstage/accept.txt @@ -0,0 +1,416 @@ +abc +accessors +ACLs +addon +addons +ADRs +airbrake +Airbrake +Airbrakes +Alaria +Alef +Anddddd +Apdex +api +asciidoc +async +Atlassian +automations +autoscaling +Autoscaling +autoselect +Avro +backend's +backported +backporting +Bigtable +Billett +bitbucket +Bitrise +Blackbox +bool +boolean +Brex +builtins +callout +CDNs +Chai +changeset +changesets +Changesets +chanwit +Chanwit +CI/CD +classname +cli +cloudbuild +Cloudflare +Cloudformation +cncf +Cobertura +codeblocks +Codecov +codehilite +Codehilite +codemod +codemods +codeowners +codescene +CodeScene +composability +composable +config +Config +configmaps +configs +const +cookiecutter +Corti +cron +cronjobs +crontab +css +Datadog +dataflow +dayjs +debounce +Debounce +debuggability +declaratively +deduplicated +dependabot +deps +destructured +destructuring +dev +devops +devs +discoverability +Discoverability +dls +Dockerfile +dockerfiles +Dockerize +dockerode +Docusaurus +DOMPurify +don'ts +dynatrace +Dynatrace +ecco +elasticsearch +env +Env +esbuild +eslint +ESModule +ESModules +etag +Expedia +facto +failover +Fargate +Figma +firehydrant +FireHydrant +Firekube +Firestore +Fiverr +Francesco +gerrit +Gerrit +gitbeaker +gitea +Gitea +github +Gitiles +gitlab +GitLab +globals +Gource +Grafana +graphql +GraphQL +graphviz +Hackathons +haproxy +hardcoded +Helidon +Heroku +hoc +horizontalpodautoscalers +Hostname +hotspots +http +https +Iain +Iglesias +iLert +img +incentivised +Indal +indexable +inlined +inlinehilite +integrator's +interop +JaCoCo +JavaScript +jenkins +Jira +jq +js +json +jsonnet +jsx +JWTs +Kaewkasi +Keyv +Knex +KPIs +kubectl +kubernetes +kubernetes +ldap +learnings +Leasot +lerna +Lerna +LocalStack +lockdown +lockfile +lunr +Luxon +magiclink +mailto +maintainer's +maintainership +makefile +md +memcache +memoize +memoized +microservice +microservices +microsite +microtasks +middleware +minikube +Minikube +Minio +misconfiguration +misconfigured +mkdocs +Mkdocs +monorepo +Monorepo +monorepos +msgraph +msw +mutex +mutexes +mysql +namespace +namespaced +namespaces +Namespaces +namespacing +neuro +newrelic +nginx +nodegit +nohoist +nonces +noop +npm +nunjucks +nvarchar +nvm +OAuth +octokit +oidc +Okta +Oldsberg +onboarding +Onboarding +OpenShift +orgs +padding +paddings +pagerduty +pageview +parallelization +parseable +Patrik +pattison +Peloton +performant +Performant +periskop +Periskop +permissioned +permissioning +plantuml +Platformize +Podman +postgres +postpack +pre +prebaked +preconfigured +prepack +Preprarer +productional +Protobuf +proxying +Proxying +pseudonymized +pubsub +pygments +pymdownx +rankdir +readme +Readme +readonly +rebase +Recharts +Redash +replicasets +repo +Repo +repos +rerender +rerenders +reusability +Reusability +roadmaps +rollbar +Rollbar +Rollup +routable +Routable +rst +rsync +ruleset +runbook +sam +sanitization +scaffolded +scaffolder +Scaffolder +scrollbar +seb +semlas +semver +serializable +Serverless +shoutout +SIG +SIGs +siloed +Sinon +Snyk +Sonarqube +sourcemaps +sparklines +Splunk +Spotifiers +spotify +Spotify +sqlite +sqs +squidfunk +src +statefulsets +stdout +storable +stringified +stringify +subcomponent +subcomponents +subfolder +subfolders +subheader +subheaders +subkey +subroutes +subtree +superfences +Superfences +superset +supertype +SVGs +talkdesk +Talkdesk +Tanzu +tasklist +techdocs +Telenor +telus +templated +templater +Templater +templaters +Templaters +TFRecord +theia +thumbsup +todo +todos +togglable +tolerations +Tolerations +toolchain +toolsets +tooltip +tooltips +touchpoint +transpilation +transpiled +transpiler +transpilers +truthy +TSDoc +typeahead +ui +unbreak +Unconference +unmanaged +unregister +unregistering +unregistration +untracked +upsert +upvote +URIs +URLs +utils +Valentina +validator +validators +varchar +VMware +VPCs +VSCode +Wayfair +Weaveworks +Webpack +widget's +winston +www +WWW +XCMetrics +XML +xyz +yaml +Zalando +Zhou +zod +Zolotusky +zoomable +zsh +Lainfiesta +allowlisted +Dominik +Henneke +Kuang From 3d679f83c1d17a5a145288e600e497d14649e291 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 22 Dec 2022 19:28:28 +0000 Subject: [PATCH 048/141] address review comments Signed-off-by: Brian Fletcher --- .../CardActionComponents/EmailCardAction.tsx | 17 ++- .../EntityCardActions.tsx | 28 +++-- .../EntityNotFoundCard.tsx | 41 ------- .../EntityPeekAheadPopover.stories.tsx | 60 +++++++++- .../EntityPeekAheadPopover.tsx | 105 +++++++++--------- 5 files changed, 136 insertions(+), 115 deletions(-) delete mode 100644 plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx index ed9ac7b9aa..2fcb89eed1 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EmailCardAction.tsx @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Button, Tooltip } from '@material-ui/core'; +import { IconButton } from '@material-ui/core'; import EmailIcon from '@material-ui/icons/Email'; import React from 'react'; +import { Link } from '@backstage/core-components'; /** * Email Card action link @@ -24,10 +25,14 @@ import React from 'react'; */ export const EmailCardAction = ({ email }: { email: string }) => { return ( - - - + + + ); }; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx index d021a9f69d..fc8b5f4007 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/CardActionComponents/EntityCardActions.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ import { entityRouteRef } from '../../../routes'; -import { Tooltip } from '@material-ui/core'; +import { IconButton } from '@material-ui/core'; import InfoIcon from '@material-ui/icons/Info'; import React from 'react'; import { useRouteRef } from '@backstage/core-plugin-api'; @@ -30,19 +30,17 @@ export const EntityCardActions = ({ entity }: { entity: Entity }) => { const entityRoute = useRouteRef(entityRouteRef); return ( - <> - - - - - - + + + ); }; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx deleted file mode 100644 index 08d92cab22..0000000000 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityNotFoundCard.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { Card, CardContent } from '@material-ui/core'; -import { Alert } from '@material-ui/lab'; -import React from 'react'; - -/** - * Entity not found card - * - * @private - */ -export const EntityNotFoundCard = ({ - entityRef, - error, -}: { - entityRef: string; - error?: Error; -}) => { - return ( - - - - {entityRef} was not found {error?.message} - - - - ); -}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx index bb24f293cb..132042452b 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.stories.tsx @@ -22,9 +22,15 @@ import { import Button from '@material-ui/core/Button'; import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils'; import { catalogApiRef } from '../../api'; -import { CompoundEntityRef } from '@backstage/catalog-model'; +import { + CompoundEntityRef, + parseEntityRef, + stringifyEntityRef, +} from '@backstage/catalog-model'; import { entityRouteRef } from '../../routes'; import { CatalogApi } from '@backstage/catalog-client'; +import { Table, TableColumn } from '@backstage/core-components'; +import { EntityRefLink } from '../EntityRefLink'; const mockCatalogApi = { getEntityByRef: async (entityRef: CompoundEntityRef) => { @@ -137,3 +143,55 @@ export const SlowCatalogItem = (args: EntityPeekAheadPopoverProps) => ( SlowCatalogItem.args = { entityRef: 'component:default/slow.catalog.item', }; + +const columns: TableColumn[] = [ + { + title: 'entity', + render: entityRef => { + return ( + + + + ); + }, + }, + { + title: 'owner', + render: () => { + return ( + + + + ); + }, + }, + { + title: 'name', + render: entityRef => stringifyEntityRef(entityRef), + }, +]; +export const TableOfItems = (args: { data: CompoundEntityRef[] }) => ( + +); + +TableOfItems.args = { + data: [ + { + name: 'playback', + kind: 'component', + namespace: 'default', + }, + { + name: 'playback', + kind: 'component', + namespace: 'default', + }, + { + name: 'playback', + kind: 'component', + namespace: 'default', + }, + ], +}; diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx index 41b8cfbfb2..05a818fa1f 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.tsx @@ -38,13 +38,12 @@ import { isUserEntity, parseEntityRef, } from '@backstage/catalog-model'; -import { Progress } from '@backstage/core-components'; +import { Progress, ResponseErrorPanel } from '@backstage/core-components'; import { EntityCardActions, UserCardActions, GroupCardActions, } from './CardActionComponents'; -import { EntityNotFoundCard } from './EntityNotFoundCard'; import { debounce } from 'lodash'; /** @@ -126,11 +125,7 @@ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { return ( <> - {' '} - + {children} @@ -149,56 +144,62 @@ export const EntityPeekAheadPopover = (props: EntityPeekAheadPopoverProps) => { vertical: 'top', horizontal: 'center', }} + onMouseLeave={handleOnMouseLeave} > <> - {loading && } - {!entity && !loading && ( - - )} - {entity && ( - - - - {compoundEntityRef.namespace} - - - {compoundEntityRef.name} - - {entity.kind} - - {entity.metadata.description} - - {entity.spec?.type} - - {(entity.metadata.tags || []) - .slice(0, maxTagChips) - .map(tag => { - return ; - })} - {entity.metadata.tags?.length && - entity.metadata.tags?.length > maxTagChips && ( - - - - )} - - - + {error && } + + {loading && } + + + {entity && ( <> - {isUserEntity(entity) && ( - - )} - {isGroupEntity(entity) && ( - - )} - + + {compoundEntityRef.namespace} + + + {compoundEntityRef.name} + + {entity.kind} + + {entity.metadata.description} + + {entity.spec?.type} + + {(entity.metadata.tags || []) + .slice(0, maxTagChips) + .map(tag => { + return ; + })} + {entity.metadata.tags?.length && + entity.metadata.tags?.length > maxTagChips && ( + + + + )} + + )} + + {!error && ( + + {entity && ( + <> + {isUserEntity(entity) && ( + + )} + {isGroupEntity(entity) && ( + + )} + + + )} - - )} + )} + )} From a06b01ee381adf4bb825d2fc58a5a214438c2c3a Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Thu, 22 Dec 2022 21:42:41 +0000 Subject: [PATCH 049/141] fixes test Signed-off-by: Brian Fletcher --- .../EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx index f7c4d1cffa..2fc630313f 100644 --- a/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx +++ b/plugins/catalog-react/src/components/EntityPeekAheadPopover/EntityPeekAheadPopover.test.tsx @@ -78,7 +78,7 @@ describe('', () => { expect(screen.queryByText('service2')).toBeNull(); fireEvent.mouseOver(screen.getByTestId('popover2')); expect( - await screen.findByText(/service2 was not found/), + await screen.findByText('Error: service2 was not found'), ).toBeInTheDocument(); }); }); From 5b6a1920cd2da8948c4285a4ccdbacf5484a7864 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Fri, 23 Dec 2022 09:24:53 -0500 Subject: [PATCH 050/141] Changed endpoint names Signed-off-by: Robert Bunning --- .../adr-backend/src/service/router.test.ts | 25 +++++++++---------- plugins/adr-backend/src/service/router.ts | 4 +-- plugins/adr/src/hooks/adrFileFetcher.ts | 4 +-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/plugins/adr-backend/src/service/router.test.ts b/plugins/adr-backend/src/service/router.test.ts index 6cfccb0a40..76b0f5552d 100644 --- a/plugins/adr-backend/src/service/router.test.ts +++ b/plugins/adr-backend/src/service/router.test.ts @@ -24,6 +24,9 @@ import express from 'express'; import request from 'supertest'; import { createRouter } from './router'; +const listEndpointName = '/list'; +const fileEndpointName = '/file'; + const makeBufferFromString = (string: string) => async () => Buffer.from(string); @@ -97,16 +100,14 @@ describe('createRouter', () => { app = express().use(router); }); - describe('GET /getAdrFilesAtUrl', () => { + describe(`GET ${listEndpointName}`, () => { it('returns bad request (400) when no url is provided', async () => { - const urlNotSpecifiedRequest = await request(app).get( - '/getAdrFilesAtUrl', - ); + const urlNotSpecifiedRequest = await request(app).get(listEndpointName); const urlNotSpecifiedStatus = urlNotSpecifiedRequest.status; const urlNotSpecifiedMessage = urlNotSpecifiedRequest.body.message; const urlNotFilledRequest = await request(app).get( - '/getAdrFilesAtUrl?url=', + `${listEndpointName}?url=`, ); const urlNotFilledStatus = urlNotFilledRequest.status; const urlNotFilledMessage = urlNotFilledRequest.body.message; @@ -122,7 +123,7 @@ describe('createRouter', () => { }); it('returns the correct listing when reading a url', async () => { - const result = await request(app).get('/getAdrFilesAtUrl?url=testing'); + const result = await request(app).get(`${listEndpointName}?url=testing`); const { status, body, error } = result; const expectedStatusCode = 200; @@ -152,16 +153,14 @@ describe('createRouter', () => { }); }); - describe('GET /readAdrFileAtUrl', () => { + describe(`GET ${fileEndpointName}`, () => { it('returns bad request (400) when no url is provided', async () => { - const urlNotSpecifiedRequest = await request(app).get( - '/readAdrFileAtUrl', - ); + const urlNotSpecifiedRequest = await request(app).get(fileEndpointName); const urlNotSpecifiedStatus = urlNotSpecifiedRequest.status; const urlNotSpecifiedMessage = urlNotSpecifiedRequest.body.message; const urlNotFilledRequest = await request(app).get( - '/readAdrFileAtUrl?url=', + `${fileEndpointName}?url=`, ); const urlNotFilledStatus = urlNotFilledRequest.status; const urlNotFilledMessage = urlNotFilledRequest.body.message; @@ -178,14 +177,14 @@ describe('createRouter', () => { it('returns the correct file contents when reading a url', async () => { const fileOneResponse = await request(app).get( - '/readAdrFileAtUrl?url=testFileOne', + `${fileEndpointName}?url=testFileOne`, ); const fileOneStatus = fileOneResponse.status; const fileOneBody = fileOneResponse.body; const fileOneError = fileOneResponse.error; const fileTwoResponse = await request(app).get( - '/readAdrFileAtUrl?url=testFileTwo', + `${fileEndpointName}?url=testFileTwo`, ); const fileTwoStatus = fileTwoResponse.status; const fileTwoBody = fileTwoResponse.body; diff --git a/plugins/adr-backend/src/service/router.ts b/plugins/adr-backend/src/service/router.ts index 1b896e2805..26bf381596 100644 --- a/plugins/adr-backend/src/service/router.ts +++ b/plugins/adr-backend/src/service/router.ts @@ -23,7 +23,7 @@ export async function createRouter(reader: UrlReader): Promise { const router = Router(); router.use(express.json()); - router.get('/getAdrFilesAtUrl', async (req, res) => { + router.get('/list', async (req, res) => { const urlToProcess = req.query.url as string; if (!urlToProcess) { res.statusCode = 400; @@ -44,7 +44,7 @@ export async function createRouter(reader: UrlReader): Promise { res.json({ data: fileData }); }); - router.get('/readAdrFileAtUrl', async (req, res) => { + router.get('/file', async (req, res) => { const urlToProcess = req.query.url as string; if (!urlToProcess) { res.statusCode = 400; diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts index fa690556e6..d5e7c97f04 100644 --- a/plugins/adr/src/hooks/adrFileFetcher.ts +++ b/plugins/adr/src/hooks/adrFileFetcher.ts @@ -62,8 +62,8 @@ export interface AdrFileFetcher { useReadAdrFileAtUrl: (url: string) => any; } -const getAdrFilesEndpoint = 'getAdrFilesAtUrl'; -const readAdrFileEndpoint = 'readAdrFileAtUrl'; +const getAdrFilesEndpoint = 'list'; +const readAdrFileEndpoint = 'file'; /** * An AdrFileFetcher that uses UrlReaders to fetch adr files From 30519deddc9d976883309e99aa0236e0f0b6cfa4 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Fri, 23 Dec 2022 09:40:21 -0500 Subject: [PATCH 051/141] Updated documentation Changed the wording in the changeset. Fixed a grammar mistake in the backend plugin's readme. Signed-off-by: Robert Bunning --- .changeset/dull-taxis-carry.md | 2 +- plugins/adr-backend/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/dull-taxis-carry.md b/.changeset/dull-taxis-carry.md index 6f2901bac2..3cc4bbdde3 100644 --- a/.changeset/dull-taxis-carry.md +++ b/.changeset/dull-taxis-carry.md @@ -3,4 +3,4 @@ '@backstage/plugin-adr-backend': patch --- -The ADR plugin can now work with sites other than GitHub. Expanded the ADR backend plugin to provide endpoints to facilitate this and changed EntityAdrContent and AdrReader to take an optional property, adrFileFetcher, to allow switching between the new implementation and the octokit one. By default, the octokit version is used. +The ADR plugin can now work with sites other than GitHub. Expanded the ADR backend plugin to provide endpoints to facilitate this. diff --git a/plugins/adr-backend/README.md b/plugins/adr-backend/README.md index ab81c34c82..83c87530ff 100644 --- a/plugins/adr-backend/README.md +++ b/plugins/adr-backend/README.md @@ -4,7 +4,7 @@ This ADR backend plugin is primarily responsible for the following: - Provides a `DefaultAdrCollatorFactory`, which can be used in the search backend to index ADR documents associated with entities to your Backstage Search. -- Provides endpoints that use UrlReaders for getting a ADR documents (used in the [ADR frontend plugin](../adr/README.md)). +- Provides endpoints that use UrlReaders for getting ADR documents (used in the [ADR frontend plugin](../adr/README.md)). ## Indexing ADR documents for search From b267b6c04535d8b8cc37df158ba43f88011009a9 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Fri, 23 Dec 2022 10:07:05 -0500 Subject: [PATCH 052/141] Adjusted dependencies Changed @types imports to be dev dependencies. Changed import of DiscoveryApi to remove reference to @backstage/plugin-permission-common Signed-off-by: Robert Bunning --- plugins/adr-backend/package.json | 2 +- plugins/adr/package.json | 1 - plugins/adr/src/hooks/adrFileFetcher.ts | 7 +++++-- yarn.lock | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/adr-backend/package.json b/plugins/adr-backend/package.json index 3b1f19ec01..82af1cbc0b 100644 --- a/plugins/adr-backend/package.json +++ b/plugins/adr-backend/package.json @@ -36,7 +36,6 @@ "@backstage/integration": "workspace:^", "@backstage/plugin-adr-common": "workspace:^", "@backstage/plugin-search-common": "workspace:^", - "@types/express": "^4.17.15", "express": "^4.18.2", "express-promise-router": "^4.1.1", "luxon": "^3.0.0", @@ -47,6 +46,7 @@ }, "devDependencies": { "@backstage/cli": "workspace:^", + "@types/express": "^4.17.15", "@types/marked": "^4.0.0", "@types/supertest": "^2.0.8", "msw": "^0.49.0", diff --git a/plugins/adr/package.json b/plugins/adr/package.json index dd705e7ad2..06d1f90273 100644 --- a/plugins/adr/package.json +++ b/plugins/adr/package.json @@ -28,7 +28,6 @@ "@backstage/integration-react": "workspace:^", "@backstage/plugin-adr-common": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", - "@backstage/plugin-permission-common": "workspace:^", "@backstage/plugin-search-common": "workspace:^", "@backstage/plugin-search-react": "workspace:^", "@backstage/theme": "workspace:^", diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts index d5e7c97f04..b2c198336b 100644 --- a/plugins/adr/src/hooks/adrFileFetcher.ts +++ b/plugins/adr/src/hooks/adrFileFetcher.ts @@ -14,8 +14,11 @@ * limitations under the License. */ -import { discoveryApiRef, useApi } from '@backstage/core-plugin-api'; -import { DiscoveryApi } from '@backstage/plugin-permission-common'; +import { + discoveryApiRef, + useApi, + DiscoveryApi, +} from '@backstage/core-plugin-api'; import useAsync from 'react-use/lib/useAsync'; import { useOctokitRequest } from './useOctokitRequest'; diff --git a/yarn.lock b/yarn.lock index 7cf10f6d49..4543e82276 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4153,7 +4153,6 @@ __metadata: "@backstage/plugin-adr-common": "workspace:^" "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" - "@backstage/plugin-permission-common": "workspace:^" "@backstage/plugin-permission-react": "workspace:^" "@backstage/plugin-search-common": "workspace:^" "@backstage/plugin-search-react": "workspace:^" From ef795700d62903e86abc1661d56a474a35506c9d Mon Sep 17 00:00:00 2001 From: Salih Candir Date: Wed, 14 Dec 2022 11:27:47 +0100 Subject: [PATCH 053/141] fix: use '../' instead of '../../' for relative paths With `../../audit/` we navigate from `//audit/` to `/audit/` but this is wrong because the base path is missing. Therefore we use `../audit/` and this will navigate to the right url with respect to the base path. Signed-off-by: Salih Candir --- .../src/components/AuditView/index.test.tsx | 22 +++++++++++++++++++ .../src/components/AuditView/index.tsx | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/lighthouse/src/components/AuditView/index.test.tsx b/plugins/lighthouse/src/components/AuditView/index.test.tsx index c68daddc67..d19543d679 100644 --- a/plugins/lighthouse/src/components/AuditView/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.test.tsx @@ -149,6 +149,28 @@ describe('AuditView', () => { ).toHaveAttribute('href', `/audit/${a.id}`); }); }); + + it('navigates to the next report with respect to the base path', async () => { + // TODO: I would need help here. How to set the base path for the test? + const basePath = `/lighthouse`; + const rendered = render( + wrapInTestApp( + + + , + { routeEntries: [basePath] }, + ), + ); + + await rendered.findByTestId('audit-sidebar'); + + websiteResponse.audits.forEach(a => { + expect( + rendered.getByText(formatTime(a.timeCreated)).parentElement + ?.parentElement, + ).toHaveAttribute('href', `${basePath}/audits/${a.id}`); + }); + }); }); describe('when the request for the website by id is pending', () => { diff --git a/plugins/lighthouse/src/components/AuditView/index.tsx b/plugins/lighthouse/src/components/AuditView/index.tsx index e377894c90..52a087fd8e 100644 --- a/plugins/lighthouse/src/components/AuditView/index.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.tsx @@ -80,7 +80,7 @@ const AuditLinkList = ({ audits = [], selectedId }: AuditLinkListProps) => ( button component={Link} replace - to={resolvePath(generatePath('audit/:id', { id: audit.id }), '../../')} + to={resolvePath(generatePath('audit/:id', { id: audit.id }), '../')} > @@ -178,7 +178,7 @@ export const AuditViewContent = () => { From 2f1b283de2b8062d2e308981b90b8307128e0e2b Mon Sep 17 00:00:00 2001 From: Salih Candir Date: Wed, 14 Dec 2022 13:40:23 +0100 Subject: [PATCH 054/141] docs: add .changeset Signed-off-by: Salih Candir --- .changeset/ninety-bags-turn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ninety-bags-turn.md diff --git a/.changeset/ninety-bags-turn.md b/.changeset/ninety-bags-turn.md new file mode 100644 index 0000000000..27b9a94ad2 --- /dev/null +++ b/.changeset/ninety-bags-turn.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-lighthouse': patch +--- + +Fixed bug in Lighthouse Plugin where audit list item and create audit button navigated to a wrong URL. From 1bb26305637e3aa8a81688fb69f6db5bc1cde6c8 Mon Sep 17 00:00:00 2001 From: Salih Candir Date: Wed, 21 Dec 2022 11:37:08 +0100 Subject: [PATCH 055/141] fix: use right url path Signed-off-by: Salih Candir Signed-off-by: Salih Candir --- plugins/lighthouse/src/components/AuditView/index.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/lighthouse/src/components/AuditView/index.test.tsx b/plugins/lighthouse/src/components/AuditView/index.test.tsx index d19543d679..d58c0d1ce4 100644 --- a/plugins/lighthouse/src/components/AuditView/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.test.tsx @@ -168,7 +168,7 @@ describe('AuditView', () => { expect( rendered.getByText(formatTime(a.timeCreated)).parentElement ?.parentElement, - ).toHaveAttribute('href', `${basePath}/audits/${a.id}`); + ).toHaveAttribute('href', `${basePath}/audit/${a.id}`); }); }); }); From 1c0fcca4b857572e9eec84d351b3abac5c34d180 Mon Sep 17 00:00:00 2001 From: Salih Candir Date: Fri, 23 Dec 2022 17:08:10 +0100 Subject: [PATCH 056/141] refactor: use route ref instead of relative paths Using `useRouteRef` allows us to make the component testable, with a relative path we cannot use `mountedRoutes` within `wrapInTestApp` Signed-off-by: Salih Candir --- .../src/components/AuditView/index.test.tsx | 43 ++++++++++---- .../src/components/AuditView/index.tsx | 58 +++++++++++-------- 2 files changed, 65 insertions(+), 36 deletions(-) diff --git a/plugins/lighthouse/src/components/AuditView/index.test.tsx b/plugins/lighthouse/src/components/AuditView/index.test.tsx index d58c0d1ce4..d555133f3e 100644 --- a/plugins/lighthouse/src/components/AuditView/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.test.tsx @@ -16,6 +16,8 @@ /* eslint-disable jest/no-disabled-tests */ +import { configApiRef } from '@backstage/core-plugin-api'; + jest.mock('react-router-dom', () => { const actual = jest.requireActual('react-router-dom'); const mockNavigation = jest.fn(); @@ -28,6 +30,7 @@ jest.mock('react-router-dom', () => { import { setupRequestMockHandlers, + TestApiProvider, TestApiRegistry, wrapInTestApp, } from '@backstage/test-utils'; @@ -39,13 +42,18 @@ import { Audit, lighthouseApiRef, LighthouseRestApi, Website } from '../../api'; import { formatTime } from '../../utils'; import * as data from '../../__fixtures__/website-response.json'; import AuditView from './index'; -import { ApiProvider } from '@backstage/core-app-api'; +import { ApiProvider, ConfigReader } from '@backstage/core-app-api'; +import { rootRouteRef } from '../../plugin'; const { useParams }: { useParams: jest.Mock } = jest.requireMock('react-router-dom'); const websiteResponse = data as Website; describe('AuditView', () => { + const lighthouseRestApiMock = new LighthouseRestApi('https://lighthouse'); + const testAppOptions = { + mountedRoutes: { '/': rootRouteRef }, + }; let apis: TestApiRegistry; let id: string; @@ -59,10 +67,7 @@ describe('AuditView', () => { ), ); - apis = TestApiRegistry.from([ - lighthouseApiRef, - new LighthouseRestApi('https://lighthouse'), - ]); + apis = TestApiRegistry.from([lighthouseApiRef, lighthouseRestApiMock]); id = websiteResponse.audits.find(a => a.status === 'COMPLETED') ?.id as string; useParams.mockReturnValue({ id }); @@ -74,6 +79,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); @@ -91,6 +97,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); @@ -109,6 +116,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); @@ -137,6 +145,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); @@ -151,14 +160,22 @@ describe('AuditView', () => { }); it('navigates to the next report with respect to the base path', async () => { - // TODO: I would need help here. How to set the base path for the test? - const basePath = `/lighthouse`; + const configApiMock = new ConfigReader({ + app: { baseUrl: `http://localhost:3000/example` }, + }); const rendered = render( wrapInTestApp( - + - , - { routeEntries: [basePath] }, + , + { + mountedRoutes: { [`/example/lighthouse`]: rootRouteRef }, + }, ), ); @@ -168,7 +185,7 @@ describe('AuditView', () => { expect( rendered.getByText(formatTime(a.timeCreated)).parentElement ?.parentElement, - ).toHaveAttribute('href', `${basePath}/audit/${a.id}`); + ).toHaveAttribute('href', `/example/lighthouse/audit/${a.id}`); }); }); }); @@ -181,6 +198,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); expect(await rendered.findByTestId('progress')).toBeInTheDocument(); @@ -199,6 +217,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); expect(await rendered.findByText(/failed to fetch/)).toBeInTheDocument(); @@ -216,6 +235,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); @@ -236,6 +256,7 @@ describe('AuditView', () => { , + testAppOptions, ), ); diff --git a/plugins/lighthouse/src/components/AuditView/index.tsx b/plugins/lighthouse/src/components/AuditView/index.tsx index 52a087fd8e..ade485b09a 100644 --- a/plugins/lighthouse/src/components/AuditView/index.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.tsx @@ -47,7 +47,8 @@ import { Page, Progress, } from '@backstage/core-components'; -import { useApi } from '@backstage/core-plugin-api'; +import { useApi, useRouteRef } from '@backstage/core-plugin-api'; +import { rootRouteRef } from '../../plugin'; // TODO(freben): move all of this out of index @@ -67,29 +68,35 @@ interface AuditLinkListProps { audits?: Audit[]; selectedId: string; } -const AuditLinkList = ({ audits = [], selectedId }: AuditLinkListProps) => ( - - {audits.map(audit => ( - - - - - - - ))} - -); +const AuditLinkList = ({ audits = [], selectedId }: AuditLinkListProps) => { + const fromPath = useRouteRef(rootRouteRef)?.() ?? '../'; + return ( + + {audits.map(audit => ( + + + + + + + ))} + + ); +}; const AuditView = ({ audit }: { audit?: Audit }) => { const classes = useStyles(); @@ -119,6 +126,7 @@ const AuditView = ({ audit }: { audit?: Audit }) => { export const AuditViewContent = () => { const lighthouseApi = useApi(lighthouseApiRef); + const fromPath = useRouteRef(rootRouteRef)?.() ?? '../'; const params = useParams() as { id: string }; const classes = useStyles(); const navigate = useNavigate(); @@ -178,7 +186,7 @@ export const AuditViewContent = () => { From 654e8ac5afdc20874f97a3559081caf677b43dad Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Fri, 23 Dec 2022 13:11:49 -0500 Subject: [PATCH 057/141] Added api for adr plugin Switched to using an AdrApi and removed the fetchers for adr reading. Signed-off-by: Robert Bunning --- plugins/adr/src/api/AdrClient.ts | 66 +++++++++ plugins/adr/src/{hooks => api}/index.ts | 11 +- plugins/adr/src/api/types.ts | 74 ++++++++++ .../components/AdrReader/AdrReader.test.tsx | 129 ---------------- .../src/components/AdrReader/AdrReader.tsx | 17 +-- .../EntityAdrContent.test.tsx | 139 ------------------ .../EntityAdrContent/EntityAdrContent.tsx | 23 ++- plugins/adr/src/hooks/adrFileFetcher.ts | 99 ------------- plugins/adr/src/hooks/useOctokitRequest.ts | 59 -------- plugins/adr/src/index.ts | 4 +- plugins/adr/src/plugin.ts | 15 +- 11 files changed, 184 insertions(+), 452 deletions(-) create mode 100644 plugins/adr/src/api/AdrClient.ts rename plugins/adr/src/{hooks => api}/index.ts (73%) create mode 100644 plugins/adr/src/api/types.ts delete mode 100644 plugins/adr/src/components/AdrReader/AdrReader.test.tsx delete mode 100644 plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx delete mode 100644 plugins/adr/src/hooks/adrFileFetcher.ts delete mode 100644 plugins/adr/src/hooks/useOctokitRequest.ts diff --git a/plugins/adr/src/api/AdrClient.ts b/plugins/adr/src/api/AdrClient.ts new file mode 100644 index 0000000000..d79a327db3 --- /dev/null +++ b/plugins/adr/src/api/AdrClient.ts @@ -0,0 +1,66 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DiscoveryApi } from '@backstage/core-plugin-api'; +import { AdrApi, AdrListResult, AdrReadResult } from './types'; + +/** + * Options for creating an AdrClient. + * + * @public + */ +export interface AdrClientOptions { + discoveryApi: DiscoveryApi; +} + +const readEndpoint = 'file'; +const listEndpoint = 'list'; + +/** + * An implementation of the AdrApi that communicates with the ADR backend plugin. + * + * @public + */ +export class AdrClient implements AdrApi { + private readonly discoveryApi: DiscoveryApi; + + constructor(options: AdrClientOptions) { + this.discoveryApi = options.discoveryApi; + } + + private async fetchAdrApi(endpoint: string, fileUrl: string): Promise { + const baseUrl = await this.discoveryApi.getBaseUrl('adr'); + const targetUrl = `${baseUrl}/${endpoint}?url=${encodeURIComponent( + fileUrl, + )}`; + + const result = await fetch(targetUrl); + const data = await result.json(); + + if (!result.ok) { + throw new Error(data.error.message); + } + return data; + } + + async listAdrs(url: string): Promise { + return this.fetchAdrApi(listEndpoint, url); + } + + async readAdr(url: string): Promise { + return this.fetchAdrApi(readEndpoint, url); + } +} diff --git a/plugins/adr/src/hooks/index.ts b/plugins/adr/src/api/index.ts similarity index 73% rename from plugins/adr/src/hooks/index.ts rename to plugins/adr/src/api/index.ts index d5aa102fb8..095da3519d 100644 --- a/plugins/adr/src/hooks/index.ts +++ b/plugins/adr/src/api/index.ts @@ -13,4 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export * from './useOctokitRequest'; + +export { AdrClient } from './AdrClient'; +export type { AdrClientOptions } from './AdrClient'; +export { adrApiRef } from './types'; +export type { + AdrApi, + AdrFileInfo, + AdrListResult, + AdrReadResult, +} from './types'; diff --git a/plugins/adr/src/api/types.ts b/plugins/adr/src/api/types.ts new file mode 100644 index 0000000000..e4632e171a --- /dev/null +++ b/plugins/adr/src/api/types.ts @@ -0,0 +1,74 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createApiRef } from '@backstage/core-plugin-api'; + +/** + * Contains information about an ADR file. + * + * @public + */ +export type AdrFileInfo = { + /** The file type. */ + type: string; + + /** The relative path of the ADR file. */ + path: string; + + /** The name of the ADR file. */ + name: string; +}; + +/** + * The result of listing ADRs. + * + * @public + */ +export type AdrListResult = { + data: AdrFileInfo[]; +}; + +/** + * The result of reading an ADR. + * + * @public + */ +export type AdrReadResult = { + /** The contents of the read ADR file. */ + data: string; +}; + +/** + * The API used by the adr plugin to list and read ADRs. + * + * @public + */ +export interface AdrApi { + /** Lists the ADRs at the provided url. */ + listAdrs(url: string): Promise; + + /** Reads the contents of the ADR at the provided url. */ + readAdr(url: string): Promise; +} + +/** + * ApiRef for the AdrApi. + * + * @public + */ +export const adrApiRef = createApiRef({ + id: 'plugin.adr.api', +}); diff --git a/plugins/adr/src/components/AdrReader/AdrReader.test.tsx b/plugins/adr/src/components/AdrReader/AdrReader.test.tsx deleted file mode 100644 index 1b1cdcf851..0000000000 --- a/plugins/adr/src/components/AdrReader/AdrReader.test.tsx +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import { EntityLayout } from '@backstage/plugin-catalog'; -import { Entity, ANNOTATION_SOURCE_LOCATION } from '@backstage/catalog-model'; -import { ApiProvider } from '@backstage/core-app-api'; -import { CatalogApi } from '@backstage/catalog-client'; -import { - EntityProvider, - catalogApiRef, - starredEntitiesApiRef, - MockStarredEntitiesApi, -} from '@backstage/plugin-catalog-react'; -import { scmIntegrationsApiRef } from '@backstage/integration-react'; -import { permissionApiRef } from '@backstage/plugin-permission-react'; -import { - renderInTestApp, - TestApiRegistry, - MockPermissionApi, -} from '@backstage/test-utils'; -import { AdrReader } from './AdrReader'; -import { ScmIntegrationRegistry } from '@backstage/integration'; -import { ANNOTATION_ADR_LOCATION } from '@backstage/plugin-adr-common'; -import { - octokitAdrFileFetcher, - urlReaderAdrFileFetcher, -} from '../../hooks/adrFileFetcher'; - -const mockApis = TestApiRegistry.from( - [catalogApiRef, {} as CatalogApi], - [starredEntitiesApiRef, new MockStarredEntitiesApi()], - [permissionApiRef, new MockPermissionApi()], - [ - scmIntegrationsApiRef, - { - resolveUrl: options => `${options.url}`, - } as ScmIntegrationRegistry, - ], -); - -const mockEntity: Entity = { - kind: 'TestEntity', - metadata: { - name: 'Testing Entity 1', - annotations: { - [ANNOTATION_ADR_LOCATION]: 'testAdrFolder', - [ANNOTATION_SOURCE_LOCATION]: 'source:location', - }, - }, - apiVersion: '', -}; - -afterEach(() => { - jest.resetAllMocks(); -}); - -describe('AdrReader', () => { - it('Falls back to octokitAdrFileFetcher when adrFileFetcher is not specified', async () => { - const spyInstance = jest - .spyOn(octokitAdrFileFetcher, 'useReadAdrFileAtUrl') - .mockImplementation(() => { - return { data: '' }; - }); - - await renderInTestApp( - - - - - - - - - , - ); - - expect(spyInstance).toHaveBeenCalled(); - }); - - it('Uses an alternative AdrFileFetcher when provided', async () => { - const octokitSpyInstance = jest - .spyOn(octokitAdrFileFetcher, 'useReadAdrFileAtUrl') - .mockImplementation(() => { - return { - data: '', - }; - }); - - const urlReadersSpyInstance = jest - .spyOn(urlReaderAdrFileFetcher, 'useReadAdrFileAtUrl') - .mockImplementation(() => { - return { - data: '', - }; - }); - - await renderInTestApp( - - - - - - - - - , - ); - - expect(octokitSpyInstance).not.toHaveBeenCalled(); - expect(urlReadersSpyInstance).toHaveBeenCalled(); - }); -}); diff --git a/plugins/adr/src/components/AdrReader/AdrReader.tsx b/plugins/adr/src/components/AdrReader/AdrReader.tsx index 6f76295e8c..ad99ce3a5a 100644 --- a/plugins/adr/src/components/AdrReader/AdrReader.tsx +++ b/plugins/adr/src/components/AdrReader/AdrReader.tsx @@ -28,10 +28,8 @@ import { useEntity } from '@backstage/plugin-catalog-react'; import { adrDecoratorFactories } from './decorators'; import { AdrContentDecorator } from './types'; -import { - AdrFileFetcher, - octokitAdrFileFetcher, -} from '../../hooks/adrFileFetcher'; +import { adrApiRef } from '../../api'; +import useAsync from 'react-use/lib/useAsync'; /** * Component to fetch and render an ADR. @@ -41,16 +39,17 @@ import { export const AdrReader = (props: { adr: string; decorators?: AdrContentDecorator[]; - adrFileFetcher?: AdrFileFetcher; }) => { - const { adr, decorators, adrFileFetcher } = props; + const { adr, decorators } = props; const { entity } = useEntity(); const scmIntegrations = useApi(scmIntegrationsApiRef); + const adrApi = useApi(adrApiRef); const adrLocationUrl = getAdrLocationUrl(entity, scmIntegrations); - const targetAdrFileFetcher = adrFileFetcher ?? octokitAdrFileFetcher; - const { value, loading, error } = targetAdrFileFetcher.useReadAdrFileAtUrl( - `${adrLocationUrl.replace(/\/$/, '')}/${adr}`, + const url = `${adrLocationUrl.replace(/\/$/, '')}/${adr}`; + const { value, loading, error } = useAsync( + async () => adrApi.readAdr(url), + [url], ); const adrContent = useMemo(() => { diff --git a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx deleted file mode 100644 index ca6397e736..0000000000 --- a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.test.tsx +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import { EntityLayout } from '@backstage/plugin-catalog'; -import { Entity, ANNOTATION_SOURCE_LOCATION } from '@backstage/catalog-model'; -import { ApiProvider } from '@backstage/core-app-api'; -import { CatalogApi } from '@backstage/catalog-client'; -import { - EntityProvider, - catalogApiRef, - starredEntitiesApiRef, - MockStarredEntitiesApi, -} from '@backstage/plugin-catalog-react'; -import { scmIntegrationsApiRef } from '@backstage/integration-react'; -import { permissionApiRef } from '@backstage/plugin-permission-react'; -import { - renderInTestApp, - TestApiRegistry, - MockPermissionApi, -} from '@backstage/test-utils'; -import { ScmIntegrationRegistry } from '@backstage/integration'; -import { ANNOTATION_ADR_LOCATION } from '@backstage/plugin-adr-common'; -import { - octokitAdrFileFetcher, - urlReaderAdrFileFetcher, -} from '../../hooks/adrFileFetcher'; -import { EntityAdrContent } from './EntityAdrContent'; -import { rootRouteRef } from '../../routes'; - -const mockApis = TestApiRegistry.from( - [catalogApiRef, {} as CatalogApi], - [starredEntitiesApiRef, new MockStarredEntitiesApi()], - [permissionApiRef, new MockPermissionApi()], - [ - scmIntegrationsApiRef, - { - resolveUrl: options => `${options.url}`, - } as ScmIntegrationRegistry, - ], -); - -const mockEntity: Entity = { - kind: 'TestEntity', - metadata: { - name: 'Testing Entity 1', - annotations: { - [ANNOTATION_ADR_LOCATION]: 'testAdrFolder', - [ANNOTATION_SOURCE_LOCATION]: 'source:location', - }, - }, - apiVersion: '', -}; - -afterEach(() => { - jest.resetAllMocks(); -}); - -describe('EntityAdrContent', () => { - it('Falls back to octokitAdrFileFetcher when adrFileFetcher is not specified', async () => { - const getAdrFilesSpyInstance = jest - .spyOn(octokitAdrFileFetcher, 'useGetAdrFilesAtUrl') - .mockImplementation(() => { - return { - data: [], - }; - }); - - await renderInTestApp( - - - - - - - - - , - { - mountedRoutes: { - '/adr': rootRouteRef, - }, - }, - ); - - expect(getAdrFilesSpyInstance).toHaveBeenCalled(); - }); - - it('Uses an alternative AdrFileFetcher when provided', async () => { - const octokitGetAdrFilesSpyInstance = jest - .spyOn(octokitAdrFileFetcher, 'useGetAdrFilesAtUrl') - .mockImplementation(() => { - return { - data: [], - }; - }); - - const urlReadersGetAdrFilesSpyInstance = jest - .spyOn(urlReaderAdrFileFetcher, 'useGetAdrFilesAtUrl') - .mockImplementation(() => { - return { - data: [], - }; - }); - - await renderInTestApp( - - - - - - - - - , - { - mountedRoutes: { - '/adr': rootRouteRef, - }, - }, - ); - - expect(octokitGetAdrFilesSpyInstance).not.toHaveBeenCalled(); - expect(urlReadersGetAdrFilesSpyInstance).toHaveBeenCalled(); - }); -}); diff --git a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx index 1a75856ab1..a698cffd26 100644 --- a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx +++ b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx @@ -46,10 +46,8 @@ import { import { rootRouteRef } from '../../routes'; import { AdrContentDecorator, AdrReader } from '../AdrReader'; -import { - AdrFileFetcher, - octokitAdrFileFetcher, -} from '../../hooks/adrFileFetcher'; +import { adrApiRef } from '../../api'; +import useAsync from 'react-use/lib/useAsync'; const useStyles = makeStyles((theme: Theme) => ({ adrMenu: { @@ -64,20 +62,21 @@ const useStyles = makeStyles((theme: Theme) => ({ export const EntityAdrContent = (props: { contentDecorators?: AdrContentDecorator[]; filePathFilterFn?: AdrFilePathFilterFn; - adrFileFetcher?: AdrFileFetcher; }) => { - const { contentDecorators, filePathFilterFn, adrFileFetcher } = props; + const { contentDecorators, filePathFilterFn } = props; const classes = useStyles(); const { entity } = useEntity(); const rootLink = useRouteRef(rootRouteRef); const [adrList, setAdrList] = useState([]); const [searchParams, setSearchParams] = useSearchParams(); const scmIntegrations = useApi(scmIntegrationsApiRef); + const adrApi = useApi(adrApiRef); const entityHasAdrs = isAdrAvailable(entity); - const targetAdrFileFetcher = adrFileFetcher ?? octokitAdrFileFetcher; - const { value, loading, error } = targetAdrFileFetcher.useGetAdrFilesAtUrl( - getAdrLocationUrl(entity, scmIntegrations), + const url = getAdrLocationUrl(entity, scmIntegrations); + const { value, loading, error } = useAsync( + async () => adrApi.listAdrs(url), + [url], ); const selectedAdr = @@ -147,11 +146,7 @@ export const EntityAdrContent = (props: { - + ) : ( diff --git a/plugins/adr/src/hooks/adrFileFetcher.ts b/plugins/adr/src/hooks/adrFileFetcher.ts deleted file mode 100644 index b2c198336b..0000000000 --- a/plugins/adr/src/hooks/adrFileFetcher.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - discoveryApiRef, - useApi, - DiscoveryApi, -} from '@backstage/core-plugin-api'; -import useAsync from 'react-use/lib/useAsync'; -import { useOctokitRequest } from './useOctokitRequest'; - -const useAdrApi = ( - endpoint: string, - fileUrl: string, - discoveryApi: DiscoveryApi, -) => { - return async () => { - const baseUrl = await discoveryApi.getBaseUrl('adr'); - const targetUrl = `${baseUrl}/${endpoint}?url=${encodeURIComponent( - fileUrl, - )}`; - - const result = await fetch(targetUrl); - const data = await result.json(); - - if (!result.ok) { - throw data; - } - return data; - }; -}; - -/** - * Represents something that is capable of fetching a listing of adr files at a provided url - * and fetching the contents of an adr file at a provided url. - * - * @public - */ -export interface AdrFileFetcher { - /** - * A hook to get a listing of adr files that exist at the provided url - * - * @param url - The url to get files from - */ - useGetAdrFilesAtUrl: (url: string) => any; - - /** - * A hook to get the contents of the adr file at the provided url - * - * @param url - The url of the adr file - */ - useReadAdrFileAtUrl: (url: string) => any; -} - -const getAdrFilesEndpoint = 'list'; -const readAdrFileEndpoint = 'file'; - -/** - * An AdrFileFetcher that uses UrlReaders to fetch adr files - * - * @public - */ -export const urlReaderAdrFileFetcher: AdrFileFetcher = { - useGetAdrFilesAtUrl(url: string) { - const discoveryApi = useApi(discoveryApiRef); - return useAsync(useAdrApi(getAdrFilesEndpoint, url, discoveryApi), [ - url, - ]); - }, - useReadAdrFileAtUrl(url: string) { - const discoveryApi = useApi(discoveryApiRef); - return useAsync(useAdrApi(readAdrFileEndpoint, url, discoveryApi), [ - url, - ]); - }, -}; - -/** - * An AdrFileFetcher that uses the useOctokitRequest hook for fetching adr files - * - * @public - */ -export const octokitAdrFileFetcher: AdrFileFetcher = { - useGetAdrFilesAtUrl: (url: string) => useOctokitRequest(url), - useReadAdrFileAtUrl: (url: string) => useOctokitRequest(url), -}; diff --git a/plugins/adr/src/hooks/useOctokitRequest.ts b/plugins/adr/src/hooks/useOctokitRequest.ts deleted file mode 100644 index f160651169..0000000000 --- a/plugins/adr/src/hooks/useOctokitRequest.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import parseGitUrl from 'git-url-parse'; -import useAsync from 'react-use/lib/useAsync'; -import { Octokit } from 'octokit'; -import { useApi } from '@backstage/core-plugin-api'; -import { - scmAuthApiRef, - scmIntegrationsApiRef, -} from '@backstage/integration-react'; - -/** - * Hook for triggering authenticated Octokit requests against the GitHub Content API - * @public - */ -export const useOctokitRequest = (request: string): any => { - const authApi = useApi(scmAuthApiRef); - const scmIntegrations = useApi(scmIntegrationsApiRef); - - const { owner, name, ref, filepath } = parseGitUrl(request); - const path = filepath.replace(/^\//, ''); - const baseUrl = scmIntegrations.github.byUrl(request)?.config.apiBaseUrl; - - return useAsync(async () => { - const { token } = await authApi.getCredentials({ - url: request, - additionalScope: { - customScopes: { - github: ['repo'], - }, - }, - }); - const octokit = new Octokit({ - auth: token, - baseUrl, - }); - - return octokit.request( - `GET /repos/${owner}/${name}/contents/${path}?ref=${ref}`, - { - headers: { Accept: 'application/vnd.github.v3.raw' }, - }, - ); - }, [request]); -}; diff --git a/plugins/adr/src/index.ts b/plugins/adr/src/index.ts index 1b8406330f..54cf26d85e 100644 --- a/plugins/adr/src/index.ts +++ b/plugins/adr/src/index.ts @@ -13,13 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * ADR frontend plugin * * @packageDocumentation */ + +export { adrApiRef, AdrClient } from './api'; export { isAdrAvailable } from '@backstage/plugin-adr-common'; export * from './components/AdrReader'; export { adrPlugin, EntityAdrContent } from './plugin'; export * from './search'; -export * from './hooks/adrFileFetcher'; diff --git a/plugins/adr/src/plugin.ts b/plugins/adr/src/plugin.ts index 03437b1f0b..f23df826cd 100644 --- a/plugins/adr/src/plugin.ts +++ b/plugins/adr/src/plugin.ts @@ -14,11 +14,13 @@ * limitations under the License. */ +import { adrApiRef, AdrClient } from './api'; import { + createApiFactory, createPlugin, createRoutableExtension, + discoveryApiRef, } from '@backstage/core-plugin-api'; - import { rootRouteRef } from './routes'; /** @@ -27,6 +29,17 @@ import { rootRouteRef } from './routes'; */ export const adrPlugin = createPlugin({ id: 'adr', + apis: [ + createApiFactory({ + api: adrApiRef, + deps: { + discoveryApi: discoveryApiRef, + }, + factory({ discoveryApi }) { + return new AdrClient({ discoveryApi }); + }, + }), + ], routes: { root: rootRouteRef, }, From 42ecf54e483fda7f47ba0ca92586b8c017d421b2 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Fri, 23 Dec 2022 13:32:18 -0500 Subject: [PATCH 058/141] Export api types Signed-off-by: Robert Bunning --- plugins/adr/src/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/adr/src/index.ts b/plugins/adr/src/index.ts index 54cf26d85e..2ec76b0fd6 100644 --- a/plugins/adr/src/index.ts +++ b/plugins/adr/src/index.ts @@ -21,6 +21,13 @@ */ export { adrApiRef, AdrClient } from './api'; +export type { + AdrApi, + AdrClientOptions, + AdrFileInfo, + AdrListResult, + AdrReadResult, +} from './api'; export { isAdrAvailable } from '@backstage/plugin-adr-common'; export * from './components/AdrReader'; export { adrPlugin, EntityAdrContent } from './plugin'; From 54baecbd1a56d00de487cb11d828c8a9fd30bf5c Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Fri, 23 Dec 2022 16:26:33 -0500 Subject: [PATCH 059/141] Implement caching via response etags for adr backend Signed-off-by: Robert Bunning --- packages/backend/src/plugins/adr.ts | 6 +- .../adr-backend/src/service/router.test.ts | 30 +++++- plugins/adr-backend/src/service/router.ts | 96 ++++++++++++++++--- plugins/adr/src/api/AdrClient.ts | 2 +- 4 files changed, 116 insertions(+), 18 deletions(-) diff --git a/packages/backend/src/plugins/adr.ts b/packages/backend/src/plugins/adr.ts index dceb4d0c69..6fa0d72969 100644 --- a/packages/backend/src/plugins/adr.ts +++ b/packages/backend/src/plugins/adr.ts @@ -21,5 +21,9 @@ import { PluginEnvironment } from '../types'; export default async function createPlugin( env: PluginEnvironment, ): Promise { - return await createRouter(env.reader); + return await createRouter({ + reader: env.reader, + cacheClient: env.cache.getClient(), + logger: env.logger, + }); } diff --git a/plugins/adr-backend/src/service/router.test.ts b/plugins/adr-backend/src/service/router.test.ts index 76b0f5552d..74955fcc6a 100644 --- a/plugins/adr-backend/src/service/router.test.ts +++ b/plugins/adr-backend/src/service/router.test.ts @@ -15,6 +15,7 @@ */ import { + CacheClient, ReadTreeResponse, ReadTreeResponseFile, ReadUrlResponse, @@ -23,6 +24,7 @@ import { import express from 'express'; import request from 'supertest'; import { createRouter } from './router'; +import { Logger } from 'winston'; const listEndpointName = '/list'; const fileEndpointName = '/file'; @@ -90,13 +92,39 @@ const mockUrlReader: UrlReader = { }, }; +class MockCacheClient implements CacheClient { + private itemRegistry: { [key: string]: any }; + + constructor() { + this.itemRegistry = {}; + } + + async get(key: string) { + return this.itemRegistry[key]; + } + + async set(key: string, value: any) { + this.itemRegistry[key] = value; + } + + async delete(key: string) { + delete this.itemRegistry[key]; + } +} + describe('createRouter', () => { let app: express.Express; beforeEach(async () => { jest.resetAllMocks(); - const router = await createRouter(mockUrlReader); + const router = await createRouter({ + reader: mockUrlReader, + cacheClient: new MockCacheClient(), + logger: { + error: (message: any) => message, + } as Logger, + }); app = express().use(router); }); diff --git a/plugins/adr-backend/src/service/router.ts b/plugins/adr-backend/src/service/router.ts index 26bf381596..9c21b03d04 100644 --- a/plugins/adr-backend/src/service/router.ts +++ b/plugins/adr-backend/src/service/router.ts @@ -14,12 +14,24 @@ * limitations under the License. */ -import { UrlReader } from '@backstage/backend-common'; +import { CacheClient, UrlReader } from '@backstage/backend-common'; +import { NotModifiedError, stringifyError } from '@backstage/errors'; +import { Logger } from 'winston'; import express from 'express'; import Router from 'express-promise-router'; +export type AdrRouterOptions = { + reader: UrlReader; + cacheClient: CacheClient; + logger: Logger; +}; + /** @public */ -export async function createRouter(reader: UrlReader): Promise { +export async function createRouter( + options: AdrRouterOptions, +): Promise { + const { reader, cacheClient, logger } = options; + const router = Router(); router.use(express.json()); @@ -31,17 +43,46 @@ export async function createRouter(reader: UrlReader): Promise { return; } - const treeGetResponse = await reader.readTree(urlToProcess); - const files = await treeGetResponse.files(); - const fileData = files.map(file => { - return { - type: 'file', - name: file.path.substring(file.path.lastIndexOf('/') + 1), - path: file.path, - }; - }); + const cachedTree = (await cacheClient.get(urlToProcess)) as { + data: { + type: string; + name: string; + path: string; + }[]; + etag: string; + }; + const cachedData = cachedTree?.data; - res.json({ data: fileData }); + try { + const treeGetResponse = await reader.readTree(urlToProcess, { + etag: cachedTree?.etag, + }); + const files = await treeGetResponse.files(); + const data = files.map(file => { + return { + type: 'file', + name: file.path.substring(file.path.lastIndexOf('/') + 1), + path: file.path, + }; + }); + + await cacheClient.set(urlToProcess, { + data, + etag: treeGetResponse.etag, + }); + + res.json({ data }); + } catch (error: any) { + if (cachedData && error.name === NotModifiedError.name) { + res.json({ data: cachedData }); + return; + } + + const message = stringifyError(error); + logger.error(`Unable to fetch ADRs from ${urlToProcess}: ${message}`); + res.statusCode = 500; + res.json({ message }); + } }); router.get('/file', async (req, res) => { @@ -52,10 +93,35 @@ export async function createRouter(reader: UrlReader): Promise { return; } - const fileGetResponse = await reader.readUrl(urlToProcess); - const fileBuffer = await fileGetResponse.buffer(); + const cachedFileContent = (await cacheClient.get(urlToProcess)) as { + data: string; + etag: string; + }; - res.json({ data: fileBuffer.toString() }); + try { + const fileGetResponse = await reader.readUrl(urlToProcess, { + etag: cachedFileContent?.etag, + }); + const fileBuffer = await fileGetResponse.buffer(); + const data = fileBuffer.toString(); + + await cacheClient.set(urlToProcess, { + data, + etag: fileGetResponse.etag, + }); + + res.json({ data }); + } catch (error) { + if (cachedFileContent && error.name === NotModifiedError.name) { + res.json({ data: cachedFileContent.data }); + return; + } + + const message = stringifyError(error); + logger.error(`Unable to fetch ADRs from ${urlToProcess}: ${message}`); + res.statusCode = 500; + res.json({ message }); + } }); return router; diff --git a/plugins/adr/src/api/AdrClient.ts b/plugins/adr/src/api/AdrClient.ts index d79a327db3..da1adc04e4 100644 --- a/plugins/adr/src/api/AdrClient.ts +++ b/plugins/adr/src/api/AdrClient.ts @@ -51,7 +51,7 @@ export class AdrClient implements AdrApi { const data = await result.json(); if (!result.ok) { - throw new Error(data.error.message); + throw new Error(`${data.message}`); } return data; } From 0d514d6e1077397ef2dbb5d5e53203e3a8fa27c2 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Tue, 27 Dec 2022 09:13:14 -0500 Subject: [PATCH 060/141] Regenerate api reports Signed-off-by: Robert Bunning --- plugins/adr-backend/api-report.md | 12 ++++- plugins/adr-backend/src/service/index.ts | 1 + plugins/adr-backend/src/service/router.ts | 1 + plugins/adr/api-report.md | 58 ++++++++++++++++------- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/plugins/adr-backend/api-report.md b/plugins/adr-backend/api-report.md index 24e54e8eb5..d5645ad3a7 100644 --- a/plugins/adr-backend/api-report.md +++ b/plugins/adr-backend/api-report.md @@ -7,6 +7,7 @@ import { AdrDocument } from '@backstage/plugin-adr-common'; import { AdrFilePathFilterFn } from '@backstage/plugin-adr-common'; +import { CacheClient } from '@backstage/backend-common'; import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { DocumentCollatorFactory } from '@backstage/plugin-search-common'; @@ -42,11 +43,20 @@ export type AdrParserContext = { path: string; }; +// @public (undocumented) +export type AdrRouterOptions = { + reader: UrlReader; + cacheClient: CacheClient; + logger: Logger; +}; + // @public export const createMadrParser: (options?: MadrParserOptions) => AdrParser; // @public (undocumented) -export function createRouter(reader: UrlReader): Promise; +export function createRouter( + options: AdrRouterOptions, +): Promise; // @public export class DefaultAdrCollatorFactory implements DocumentCollatorFactory { diff --git a/plugins/adr-backend/src/service/index.ts b/plugins/adr-backend/src/service/index.ts index 434446cf3f..3736acb188 100644 --- a/plugins/adr-backend/src/service/index.ts +++ b/plugins/adr-backend/src/service/index.ts @@ -15,3 +15,4 @@ */ export { createRouter } from './router'; +export type { AdrRouterOptions } from './router'; diff --git a/plugins/adr-backend/src/service/router.ts b/plugins/adr-backend/src/service/router.ts index 9c21b03d04..e6603ab346 100644 --- a/plugins/adr-backend/src/service/router.ts +++ b/plugins/adr-backend/src/service/router.ts @@ -20,6 +20,7 @@ import { Logger } from 'winston'; import express from 'express'; import Router from 'express-promise-router'; +/** @public */ export type AdrRouterOptions = { reader: UrlReader; cacheClient: CacheClient; diff --git a/plugins/adr/api-report.md b/plugins/adr/api-report.md index 2a49e89b2d..d6480cd090 100644 --- a/plugins/adr/api-report.md +++ b/plugins/adr/api-report.md @@ -7,11 +7,37 @@ import { AdrDocument } from '@backstage/plugin-adr-common'; import { AdrFilePathFilterFn } from '@backstage/plugin-adr-common'; +import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; +import { DiscoveryApi } from '@backstage/core-plugin-api'; import { isAdrAvailable } from '@backstage/plugin-adr-common'; import { ResultHighlight } from '@backstage/plugin-search-common'; import { RouteRef } from '@backstage/core-plugin-api'; +// @public +export interface AdrApi { + listAdrs(url: string): Promise; + readAdr(url: string): Promise; +} + +// @public +export const adrApiRef: ApiRef; + +// @public +export class AdrClient implements AdrApi { + constructor(options: AdrClientOptions); + // (undocumented) + listAdrs(url: string): Promise; + // (undocumented) + readAdr(url: string): Promise; +} + +// @public +export interface AdrClientOptions { + // (undocumented) + discoveryApi: DiscoveryApi; +} + // @public export type AdrContentDecorator = (adrInfo: { baseUrl: string; @@ -21,10 +47,16 @@ export type AdrContentDecorator = (adrInfo: { }; // @public -export interface AdrFileFetcher { - useGetAdrFilesAtUrl: (url: string) => any; - useReadAdrFileAtUrl: (url: string) => any; -} +export type AdrFileInfo = { + type: string; + path: string; + name: string; +}; + +// @public +export type AdrListResult = { + data: AdrFileInfo[]; +}; // @public export const adrPlugin: BackstagePlugin< @@ -37,17 +69,18 @@ export const adrPlugin: BackstagePlugin< // @public export const AdrReader: { - (props: { - adr: string; - decorators?: AdrContentDecorator[]; - adrFileFetcher?: AdrFileFetcher; - }): JSX.Element; + (props: { adr: string; decorators?: AdrContentDecorator[] }): JSX.Element; decorators: Readonly<{ createRewriteRelativeLinksDecorator(): AdrContentDecorator; createRewriteRelativeEmbedsDecorator(): AdrContentDecorator; }>; }; +// @public +export type AdrReadResult = { + data: string; +}; + // @public export function AdrSearchResultListItem(props: { lineClamp?: number; @@ -60,14 +93,7 @@ export function AdrSearchResultListItem(props: { export const EntityAdrContent: (props: { contentDecorators?: AdrContentDecorator[] | undefined; filePathFilterFn?: AdrFilePathFilterFn | undefined; - adrFileFetcher?: AdrFileFetcher | undefined; }) => JSX.Element; export { isAdrAvailable }; - -// @public -export const octokitAdrFileFetcher: AdrFileFetcher; - -// @public -export const urlReaderAdrFileFetcher: AdrFileFetcher; ``` From 83dc6e47853bce9b4bd8acbb9ccec4fcdb297e08 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Tue, 27 Dec 2022 10:18:20 -0500 Subject: [PATCH 061/141] Update version bump Changed plugin-adr's bump to minor and added breaking changes warning Signed-off-by: Robert Bunning --- .changeset/dull-taxis-carry.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.changeset/dull-taxis-carry.md b/.changeset/dull-taxis-carry.md index 3cc4bbdde3..1466f1246a 100644 --- a/.changeset/dull-taxis-carry.md +++ b/.changeset/dull-taxis-carry.md @@ -1,6 +1,8 @@ --- -'@backstage/plugin-adr': patch +'@backstage/plugin-adr': minor '@backstage/plugin-adr-backend': patch --- The ADR plugin can now work with sites other than GitHub. Expanded the ADR backend plugin to provide endpoints to facilitate this. + +**BREAKING** The ADR plugin now uses UrlReaders. You will have to [configure integrations](https://backstage.io/docs/integrations/index#configuration) for all sites you want to get ADRs from. If you would like to create your own implementation that has different behavior, you can override the AdrApi [just like you can with other apis.](https://backstage.io/docs/api/utility-apis#app-apis) The previously used Octokit implementation has been completely removed. From 015e76cbfd389ff2e0ff2d6c7b7c2f22784cf907 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Tue, 27 Dec 2022 10:37:40 -0500 Subject: [PATCH 062/141] Updated adr plugin's readme Signed-off-by: Robert Bunning --- plugins/adr/README.md | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/plugins/adr/README.md b/plugins/adr/README.md index 2478622560..dde270af11 100644 --- a/plugins/adr/README.md +++ b/plugins/adr/README.md @@ -4,17 +4,19 @@ Welcome to the ADR plugin! This plugin allows you to browse ADRs associated with your entities as well as a way to discover ADRs across others entities via Backstage Search. Use this to learn from the past experience of other projects to guide your own architecture decisions. -NOTE: By default, this plugin only supports entities/ADRs registered via GitHub integration. To get ADRs from other sites, see the [Using ADR plugin with sites other than GitHub](#using-adr-plugin-with-sites-other-than-github) section. - ## Setup -Install this plugin: +1. Install this plugin: ```bash # From your Backstage root directory yarn --cwd packages/app add @backstage/plugin-adr ``` +2. Make sure the [ADR backend plugin](../adr-backend/README.md) is installed. + +3. [Configure integrations](https://backstage.io/docs/integrations/) for all sites you would like to pull ADRs from. + ### Entity Pages 1. Add the plugin as a tab to your Entity pages: @@ -77,29 +79,6 @@ case 'adr': ); ``` -## Using ADR plugin with sites other than GitHub - -By default, the ADR plugin will only be able to retrieve ADRs through GitHub. If you would like to use it with other sites (for instance, AzureDevops): - -1. Make sure the [ADR backend plugin](../adr-backend/README.md) is installed. -2. [Configure an integration](https://backstage.io/docs/integrations/) for the site you would like to pull ADRs from. -3. Set the adrFileFetcher property on EntityAdrContent to urlReaderAdrFileFetcher: - -```jsx -// In packages/app/src/components/catalog/EntityPage.tsx -import { EntityAdrContent, isAdrAvailable, urlReaderAdrFileFetcher } from '@backstage/plugin-adr'; - -... - -const serviceEntityPage = ( - - {/* other tabs... */} - - - - -``` - ## Custom ADR formats By default, this plugin will parse ADRs according to the format specified by the [Markdown Architecture Decision Record (MADR)](https://adr.github.io/madr/) template. If your ADRs are written using a different format, you can apply the following customizations to correctly identify and parse your documents: From a36fe7b64cd2802c3a020b8cd8ddc58fbb5a4f53 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 14:08:18 +0000 Subject: [PATCH 063/141] fix(deps): update aws-sdk-js-v3 monorepo to v3.238.0 Signed-off-by: Renovate Bot --- yarn.lock | 138 +++++++++++++++++++++++++++--------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/yarn.lock b/yarn.lock index 61e18b2e18..d4f56659c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -408,15 +408,15 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/client-cognito-identity@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/client-cognito-identity@npm:3.236.0" +"@aws-sdk/client-cognito-identity@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/client-cognito-identity@npm:3.238.0" dependencies: "@aws-crypto/sha256-browser": 2.0.0 "@aws-crypto/sha256-js": 2.0.0 - "@aws-sdk/client-sts": 3.236.0 + "@aws-sdk/client-sts": 3.238.0 "@aws-sdk/config-resolver": 3.234.0 - "@aws-sdk/credential-provider-node": 3.236.0 + "@aws-sdk/credential-provider-node": 3.238.0 "@aws-sdk/fetch-http-handler": 3.226.0 "@aws-sdk/hash-node": 3.226.0 "@aws-sdk/invalid-dependency": 3.226.0 @@ -448,20 +448,20 @@ __metadata: "@aws-sdk/util-utf8-browser": 3.188.0 "@aws-sdk/util-utf8-node": 3.208.0 tslib: ^2.3.1 - checksum: 808339bd0113f65674dea0d65af25c350ff5a8f2595f9dd11215b6e457df5d243db156042dc4bfbb39b302d6f871a71fbbed20f403207fb6e4c9e444eb802bf1 + checksum: 7068b6d82d6053ac7f9baefad610b7b9972763bed4bb5f61ec9d5504501fb5d54e573efe5735f4746393f2098d1a20b9991b0f398081a19f3671fbe7be398c84 languageName: node linkType: hard "@aws-sdk/client-s3@npm:^3.208.0": - version: 3.236.0 - resolution: "@aws-sdk/client-s3@npm:3.236.0" + version: 3.238.0 + resolution: "@aws-sdk/client-s3@npm:3.238.0" dependencies: "@aws-crypto/sha1-browser": 2.0.0 "@aws-crypto/sha256-browser": 2.0.0 "@aws-crypto/sha256-js": 2.0.0 - "@aws-sdk/client-sts": 3.236.0 + "@aws-sdk/client-sts": 3.238.0 "@aws-sdk/config-resolver": 3.234.0 - "@aws-sdk/credential-provider-node": 3.236.0 + "@aws-sdk/credential-provider-node": 3.238.0 "@aws-sdk/eventstream-serde-browser": 3.226.0 "@aws-sdk/eventstream-serde-config-resolver": 3.226.0 "@aws-sdk/eventstream-serde-node": 3.226.0 @@ -511,19 +511,19 @@ __metadata: "@aws-sdk/xml-builder": 3.201.0 fast-xml-parser: 4.0.11 tslib: ^2.3.1 - checksum: 6a8953c229a1824bf1639dfa1a593bff3419c2c338da8df956d5cd3098dc3c1236ee63564347a22f40dc5947322b3f315ae7e39dd9c115ccf8a28199168c6d3b + checksum: f066ad581bdbcd9595ff9226c81b59876b833d6e07dc755b6f70ec0c2c5eab909c9d009ec8faa45a60d650d553ca965f271d244d870f4a938751e65e6d521d6e languageName: node linkType: hard "@aws-sdk/client-sqs@npm:^3.208.0": - version: 3.236.0 - resolution: "@aws-sdk/client-sqs@npm:3.236.0" + version: 3.238.0 + resolution: "@aws-sdk/client-sqs@npm:3.238.0" dependencies: "@aws-crypto/sha256-browser": 2.0.0 "@aws-crypto/sha256-js": 2.0.0 - "@aws-sdk/client-sts": 3.236.0 + "@aws-sdk/client-sts": 3.238.0 "@aws-sdk/config-resolver": 3.234.0 - "@aws-sdk/credential-provider-node": 3.236.0 + "@aws-sdk/credential-provider-node": 3.238.0 "@aws-sdk/fetch-http-handler": 3.226.0 "@aws-sdk/hash-node": 3.226.0 "@aws-sdk/invalid-dependency": 3.226.0 @@ -558,13 +558,13 @@ __metadata: "@aws-sdk/util-utf8-node": 3.208.0 fast-xml-parser: 4.0.11 tslib: ^2.3.1 - checksum: c1d3eb3886d8d799afd081cf76822627e359495daa94edb615a001704933b31d276249828c5e5823af49ba08826875a4c768d8e6b4493abe9b65583a585839b7 + checksum: 5ffd1393aabbcc2aa799d823ae9cca154c432cb926eae05d7f41ef6074a6e95083906744c509c2cf4bc65a5029b14552296bf97c6f8976ad92d72c28980fbbb6 languageName: node linkType: hard -"@aws-sdk/client-sso-oidc@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/client-sso-oidc@npm:3.236.0" +"@aws-sdk/client-sso-oidc@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/client-sso-oidc@npm:3.238.0" dependencies: "@aws-crypto/sha256-browser": 2.0.0 "@aws-crypto/sha256-js": 2.0.0 @@ -599,13 +599,13 @@ __metadata: "@aws-sdk/util-utf8-browser": 3.188.0 "@aws-sdk/util-utf8-node": 3.208.0 tslib: ^2.3.1 - checksum: 6fbbebb37547bafc9345c1fd03692728d6b6015f7583f22b2542beaac7f395ab29af884f1a353e78dd147ebf8b109b1d6678f9d1ae18c2b70739e9ceee6781ef + checksum: b2f0df1168d2e20ccf1d598b76be4141b6a27068ad9dea74570aa3ab8c94c103537463c58d8296e76d2457f5afb5253cbf2b1f665411981f5939c85667dd1aff languageName: node linkType: hard -"@aws-sdk/client-sso@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/client-sso@npm:3.236.0" +"@aws-sdk/client-sso@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/client-sso@npm:3.238.0" dependencies: "@aws-crypto/sha256-browser": 2.0.0 "@aws-crypto/sha256-js": 2.0.0 @@ -640,18 +640,18 @@ __metadata: "@aws-sdk/util-utf8-browser": 3.188.0 "@aws-sdk/util-utf8-node": 3.208.0 tslib: ^2.3.1 - checksum: 15cb25a3c12fe0f11ed320c8f02f72ee0d43291a14c06fce81f608fbc75a85785698fbffc3112e7e92ece25460d24670ba345535b43003b20798a0fcc8a7b31d + checksum: dbd993e569a3858fd80222cd61e5df5813b3ef6579cfd393925679f71af57f3d9277f470d868f93dbda2f797a8e0be7da9f0678ee80a97103ea2612e2e1ef793 languageName: node linkType: hard -"@aws-sdk/client-sts@npm:3.236.0, @aws-sdk/client-sts@npm:^3.208.0": - version: 3.236.0 - resolution: "@aws-sdk/client-sts@npm:3.236.0" +"@aws-sdk/client-sts@npm:3.238.0, @aws-sdk/client-sts@npm:^3.208.0": + version: 3.238.0 + resolution: "@aws-sdk/client-sts@npm:3.238.0" dependencies: "@aws-crypto/sha256-browser": 2.0.0 "@aws-crypto/sha256-js": 2.0.0 "@aws-sdk/config-resolver": 3.234.0 - "@aws-sdk/credential-provider-node": 3.236.0 + "@aws-sdk/credential-provider-node": 3.238.0 "@aws-sdk/fetch-http-handler": 3.226.0 "@aws-sdk/hash-node": 3.226.0 "@aws-sdk/invalid-dependency": 3.226.0 @@ -685,7 +685,7 @@ __metadata: "@aws-sdk/util-utf8-node": 3.208.0 fast-xml-parser: 4.0.11 tslib: ^2.3.1 - checksum: 98463fe50a588032b82be5289445c6e7250bd947076e5981ba7c126386d567f3b1ea9a9652c032da919503cdba2c3b517061911ddffae0c91f880f7eabaeaa08 + checksum: 323677f17a1cfec54022a7af941db636ed9201d0a188b10e367663c422d931508728705633d01943d8bd0439edc20b39b619a8dd87d2ee55f3ca2df923e4c0dc languageName: node linkType: hard @@ -702,15 +702,15 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/credential-provider-cognito-identity@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/credential-provider-cognito-identity@npm:3.236.0" +"@aws-sdk/credential-provider-cognito-identity@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/credential-provider-cognito-identity@npm:3.238.0" dependencies: - "@aws-sdk/client-cognito-identity": 3.236.0 + "@aws-sdk/client-cognito-identity": 3.238.0 "@aws-sdk/property-provider": 3.226.0 "@aws-sdk/types": 3.226.0 tslib: ^2.3.1 - checksum: 29d3178f490cbb711553103c0fb544604c5e70e36395f1edc6b9bd2ee0e928160b911b4893fe89418c182548d0dddfbd44e9ef629ad690ab1724a2a693368c16 + checksum: f885ba267deacec45e1fb59e46ec225b7dcd53c863a0236272948820afe15ed036ea3b039bdfbf6ae7d05054a50582366fa0b258eb8eed1364fca6fad206a63e languageName: node linkType: hard @@ -738,38 +738,38 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/credential-provider-ini@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/credential-provider-ini@npm:3.236.0" +"@aws-sdk/credential-provider-ini@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/credential-provider-ini@npm:3.238.0" dependencies: "@aws-sdk/credential-provider-env": 3.226.0 "@aws-sdk/credential-provider-imds": 3.226.0 "@aws-sdk/credential-provider-process": 3.226.0 - "@aws-sdk/credential-provider-sso": 3.236.0 + "@aws-sdk/credential-provider-sso": 3.238.0 "@aws-sdk/credential-provider-web-identity": 3.226.0 "@aws-sdk/property-provider": 3.226.0 "@aws-sdk/shared-ini-file-loader": 3.226.0 "@aws-sdk/types": 3.226.0 tslib: ^2.3.1 - checksum: e748aba37dab11ed395fa60c7eee119b997e4c64b1a838c93258cfe6a6e289dfa0aa20d292b94d06da8148b7cb32604b24f84aadc2a389bf8248c64d80ef44d5 + checksum: bf792096935a915ff1bf26c53408d7265d2dd5cb2093d5b51862cf21a1418801454362842cd7c59a8738af1bb12713afb354e55d3057e92f30f2caa327ff3eb9 languageName: node linkType: hard -"@aws-sdk/credential-provider-node@npm:3.236.0, @aws-sdk/credential-provider-node@npm:^3.208.0": - version: 3.236.0 - resolution: "@aws-sdk/credential-provider-node@npm:3.236.0" +"@aws-sdk/credential-provider-node@npm:3.238.0, @aws-sdk/credential-provider-node@npm:^3.208.0": + version: 3.238.0 + resolution: "@aws-sdk/credential-provider-node@npm:3.238.0" dependencies: "@aws-sdk/credential-provider-env": 3.226.0 "@aws-sdk/credential-provider-imds": 3.226.0 - "@aws-sdk/credential-provider-ini": 3.236.0 + "@aws-sdk/credential-provider-ini": 3.238.0 "@aws-sdk/credential-provider-process": 3.226.0 - "@aws-sdk/credential-provider-sso": 3.236.0 + "@aws-sdk/credential-provider-sso": 3.238.0 "@aws-sdk/credential-provider-web-identity": 3.226.0 "@aws-sdk/property-provider": 3.226.0 "@aws-sdk/shared-ini-file-loader": 3.226.0 "@aws-sdk/types": 3.226.0 tslib: ^2.3.1 - checksum: d5a26b40a985edfef5006efde921d58b78829b67eed9fea56e108b99eec437a02721b93ef0e2dcd9a4739716c85d8db75935a71d2afa1190b0f1d0010511f649 + checksum: 7d9e56dd53db5ef1d5600502a407a81500b0dde6c2c6164c88f88dffb20a24b9e256ebd329b2afb3992fa16514173bb8509ab410d651b0e6fb6f4cb713e22d11 languageName: node linkType: hard @@ -785,17 +785,17 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/credential-provider-sso@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/credential-provider-sso@npm:3.236.0" +"@aws-sdk/credential-provider-sso@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/credential-provider-sso@npm:3.238.0" dependencies: - "@aws-sdk/client-sso": 3.236.0 + "@aws-sdk/client-sso": 3.238.0 "@aws-sdk/property-provider": 3.226.0 "@aws-sdk/shared-ini-file-loader": 3.226.0 - "@aws-sdk/token-providers": 3.236.0 + "@aws-sdk/token-providers": 3.238.0 "@aws-sdk/types": 3.226.0 tslib: ^2.3.1 - checksum: 215e0cd08c4dca453a80ce695bf4dddb94ce7562100bfa64e2ba5406ab3aeb6cf92882bd714b6ee95d3f13c45f3286eb616d32e1ffc58728f1e21e7eb171b301 + checksum: 4ac0451f85eb34eba78f4462daace270f0ff3d0d536a5093621923fc4391e9196cb500ffa382b5e4730f9562f005fb01d3cc2364dcfc9e04ce5e9715a151ce96 languageName: node linkType: hard @@ -811,25 +811,25 @@ __metadata: linkType: hard "@aws-sdk/credential-providers@npm:^3.208.0": - version: 3.236.0 - resolution: "@aws-sdk/credential-providers@npm:3.236.0" + version: 3.238.0 + resolution: "@aws-sdk/credential-providers@npm:3.238.0" dependencies: - "@aws-sdk/client-cognito-identity": 3.236.0 - "@aws-sdk/client-sso": 3.236.0 - "@aws-sdk/client-sts": 3.236.0 - "@aws-sdk/credential-provider-cognito-identity": 3.236.0 + "@aws-sdk/client-cognito-identity": 3.238.0 + "@aws-sdk/client-sso": 3.238.0 + "@aws-sdk/client-sts": 3.238.0 + "@aws-sdk/credential-provider-cognito-identity": 3.238.0 "@aws-sdk/credential-provider-env": 3.226.0 "@aws-sdk/credential-provider-imds": 3.226.0 - "@aws-sdk/credential-provider-ini": 3.236.0 - "@aws-sdk/credential-provider-node": 3.236.0 + "@aws-sdk/credential-provider-ini": 3.238.0 + "@aws-sdk/credential-provider-node": 3.238.0 "@aws-sdk/credential-provider-process": 3.226.0 - "@aws-sdk/credential-provider-sso": 3.236.0 + "@aws-sdk/credential-provider-sso": 3.238.0 "@aws-sdk/credential-provider-web-identity": 3.226.0 "@aws-sdk/property-provider": 3.226.0 "@aws-sdk/shared-ini-file-loader": 3.226.0 "@aws-sdk/types": 3.226.0 tslib: ^2.3.1 - checksum: 3105661946fa12322b18a2227f26a8b734072850882e771493b398e714b433c024873a4495a18d55a4213022b07c658cb7ed38859b5fa152fc2ce1e02b408ca1 + checksum: f5767eafd9ce88a6085f05847d6b99a49d56974d903050957bffd5fb0afcfa39f82fe3d507cf482d23b30f1976a0d8430793e6cd0d8f843b7571f300ce5a12ca languageName: node linkType: hard @@ -967,8 +967,8 @@ __metadata: linkType: hard "@aws-sdk/lib-storage@npm:^3.208.0": - version: 3.236.0 - resolution: "@aws-sdk/lib-storage@npm:3.236.0" + version: 3.238.0 + resolution: "@aws-sdk/lib-storage@npm:3.238.0" dependencies: "@aws-sdk/middleware-endpoint": 3.226.0 "@aws-sdk/smithy-client": 3.234.0 @@ -979,7 +979,7 @@ __metadata: peerDependencies: "@aws-sdk/abort-controller": ^3.0.0 "@aws-sdk/client-s3": ^3.0.0 - checksum: 783b67c4605a4f7d4072ce38b2b2416a0a6771784f9ba5b1608be3777e7d21a18c820fff94218856607f984c453376e25e80393ef233365476850e354f8e15f8 + checksum: 97336b3911c0803bbe5dfbbc96d950e3e38c65007a0b76971748a8d10bd34137eeaae2c986eca4c54a2b7ab7cc791bbd40a3175e76ee583abc5c26cc7959ecd9 languageName: node linkType: hard @@ -1355,16 +1355,16 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/token-providers@npm:3.236.0": - version: 3.236.0 - resolution: "@aws-sdk/token-providers@npm:3.236.0" +"@aws-sdk/token-providers@npm:3.238.0": + version: 3.238.0 + resolution: "@aws-sdk/token-providers@npm:3.238.0" dependencies: - "@aws-sdk/client-sso-oidc": 3.236.0 + "@aws-sdk/client-sso-oidc": 3.238.0 "@aws-sdk/property-provider": 3.226.0 "@aws-sdk/shared-ini-file-loader": 3.226.0 "@aws-sdk/types": 3.226.0 tslib: ^2.3.1 - checksum: c5e6c88f22d35002f2d575d23ba5a530ee195b7220d7c0c58603bc2fafb6632a6755bc863cb7519eadda110d2f3193a144f34cc0236df285fcde40c980ba653a + checksum: 5627cda5accc45efb50636d839ed3e6d820a139495fdc03f95cb49267d2c67182fa88d6e46a70fe9ccf34cc8a30df390ded8e94af9daeb3581c22ab0d4940ec5 languageName: node linkType: hard From 659c92a1dcd50acdd73d25a713ddca1d14a38495 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 15:44:56 +0000 Subject: [PATCH 064/141] fix(deps): update dependency use-immer to ^0.8.0 Signed-off-by: Renovate Bot --- .changeset/renovate-0783312.md | 5 +++++ plugins/scaffolder/package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/renovate-0783312.md diff --git a/.changeset/renovate-0783312.md b/.changeset/renovate-0783312.md new file mode 100644 index 0000000000..ef3a1c0bfa --- /dev/null +++ b/.changeset/renovate-0783312.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Updated dependency `use-immer` to `^0.8.0`. diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 4bb7b29068..581a09e9fe 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -72,7 +72,7 @@ "luxon": "^3.0.0", "qs": "^6.9.4", "react-use": "^17.2.4", - "use-immer": "^0.7.0", + "use-immer": "^0.8.0", "yaml": "^2.0.0", "zen-observable": "^0.10.0", "zod": "~3.18.0", diff --git a/yarn.lock b/yarn.lock index e4d547b58b..3e12deed28 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7426,7 +7426,7 @@ __metadata: msw: ^0.49.0 qs: ^6.9.4 react-use: ^17.2.4 - use-immer: ^0.7.0 + use-immer: ^0.8.0 yaml: ^2.0.0 zen-observable: ^0.10.0 zod: ~3.18.0 @@ -37753,13 +37753,13 @@ __metadata: languageName: node linkType: hard -"use-immer@npm:^0.7.0": - version: 0.7.0 - resolution: "use-immer@npm:0.7.0" +"use-immer@npm:^0.8.0": + version: 0.8.1 + resolution: "use-immer@npm:0.8.1" peerDependencies: immer: ">=2.0.0" react: ^16.8.0 || ^17.0.1 || ^18.0.0 - checksum: 4711403fa2c3648c06b8e6795433eb43adb2c6e9bd00f45971ce6948ba8fc1c3e3cf73820a8d597b22979caa6445d0b791508e147975c3cc435a1ec1e5ce47db + checksum: 9ffc1a201a92b6b026c420718e6a00e72ba48b62420bb515927b379bb1d791b5b4766b57c755b4851c0e1f80000e639bc1cf8e73424e44466741c159391d35dd languageName: node linkType: hard From 65abaf3ae9c029ebfcd9c019efad0a9229d05d04 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:20:43 +0000 Subject: [PATCH 065/141] chore(deps): update actions/stale action to v7 Signed-off-by: Renovate Bot --- .github/workflows/automate_stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automate_stale.yml b/.github/workflows/automate_stale.yml index 1d8aa525a9..452ecc48d6 100644 --- a/.github/workflows/automate_stale.yml +++ b/.github/workflows/automate_stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v6 + - uses: actions/stale@v7 id: stale with: stale-issue-message: > From ebe652df00acd011cffec3f101cd021638e6fce5 Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Wed, 28 Dec 2022 13:24:42 -0500 Subject: [PATCH 066/141] Update dependencies Signed-off-by: Robert Bunning --- plugins/adr-backend/package.json | 2 +- plugins/adr/package.json | 3 --- yarn.lock | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/plugins/adr-backend/package.json b/plugins/adr-backend/package.json index cbafc29c6d..2203cfaf5c 100644 --- a/plugins/adr-backend/package.json +++ b/plugins/adr-backend/package.json @@ -36,6 +36,7 @@ "@backstage/integration": "workspace:^", "@backstage/plugin-adr-common": "workspace:^", "@backstage/plugin-search-common": "workspace:^", + "@types/express": "^4.17.15", "express": "^4.18.2", "express-promise-router": "^4.1.1", "luxon": "^3.0.0", @@ -46,7 +47,6 @@ }, "devDependencies": { "@backstage/cli": "workspace:^", - "@types/express": "^4.17.15", "@types/marked": "^4.0.0", "@types/supertest": "^2.0.8", "msw": "^0.49.0", diff --git a/plugins/adr/package.json b/plugins/adr/package.json index dc3a8d46eb..2bd06c4891 100644 --- a/plugins/adr/package.json +++ b/plugins/adr/package.json @@ -49,9 +49,6 @@ "@backstage/cli": "workspace:^", "@backstage/core-app-api": "workspace:^", "@backstage/dev-utils": "workspace:^", - "@backstage/integration": "workspace:^", - "@backstage/plugin-catalog": "workspace:^", - "@backstage/plugin-permission-react": "workspace:^", "@backstage/test-utils": "workspace:^", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^12.1.3", diff --git a/yarn.lock b/yarn.lock index 31bd5f6cb7..2c6c8a4878 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4243,12 +4243,9 @@ __metadata: "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" - "@backstage/integration": "workspace:^" "@backstage/integration-react": "workspace:^" "@backstage/plugin-adr-common": "workspace:^" - "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" - "@backstage/plugin-permission-react": "workspace:^" "@backstage/plugin-search-common": "workspace:^" "@backstage/plugin-search-react": "workspace:^" "@backstage/test-utils": "workspace:^" From 9f4c06badb5013c68b039fd3f20ef023d5ba3b64 Mon Sep 17 00:00:00 2001 From: zcason Date: Tue, 27 Dec 2022 17:48:34 -0600 Subject: [PATCH 067/141] feature flag filter replacement Signed-off-by: zcason --- .../FeatureFlags/UserSettingsFeatureFlags.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx b/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx index 21aafc089e..29b2e141b5 100644 --- a/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx +++ b/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx @@ -73,25 +73,17 @@ export const UserSettingsFeatureFlags = () => { inputRef?.current?.focus(); }; - let filteredFeatureFlags = Array.from(featureFlags); - - const filterInputParts = filterInput - .split(/\s/) - .map(part => part.trim().toLocaleLowerCase('en-US')); - - filterInputParts.forEach( - part => - (filteredFeatureFlags = filteredFeatureFlags.filter(featureFlag => - featureFlag.name.toLocaleLowerCase('en-US').includes(part), - )), - ); + const filteredFeatureFlags = featureFlags.filter(featureFlag => { + const featureFlagName = featureFlag.name.toLocaleLowerCase('en-US'); + return featureFlagName.includes(filterInput.toLocaleLowerCase('en-US')); + }); const Header = () => ( Feature Flags - {featureFlags.length >= 10 && ( + {10 && ( Date: Tue, 27 Dec 2022 18:08:35 -0600 Subject: [PATCH 068/141] restored filter render condition Signed-off-by: zcason --- .../src/components/FeatureFlags/UserSettingsFeatureFlags.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx b/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx index 29b2e141b5..a3b5f593ae 100644 --- a/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx +++ b/plugins/user-settings/src/components/FeatureFlags/UserSettingsFeatureFlags.tsx @@ -83,7 +83,7 @@ export const UserSettingsFeatureFlags = () => { Feature Flags - {10 && ( + {featureFlags.length >= 10 && ( Date: Wed, 28 Dec 2022 12:48:55 -0600 Subject: [PATCH 069/141] added changeset Signed-off-by: zcason --- .changeset/loud-beds-occur.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/loud-beds-occur.md diff --git a/.changeset/loud-beds-occur.md b/.changeset/loud-beds-occur.md new file mode 100644 index 0000000000..585a4799b6 --- /dev/null +++ b/.changeset/loud-beds-occur.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-user-settings': major +--- + +Rafector for the feature flag filter functionality From 8e073173daadf0c16dd7a03608a93580e8e065ff Mon Sep 17 00:00:00 2001 From: zcason Date: Wed, 28 Dec 2022 12:56:34 -0600 Subject: [PATCH 070/141] new changeset Signed-off-by: zcason --- .changeset/sixty-suits-battle.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sixty-suits-battle.md diff --git a/.changeset/sixty-suits-battle.md b/.changeset/sixty-suits-battle.md new file mode 100644 index 0000000000..f8eaf2ed17 --- /dev/null +++ b/.changeset/sixty-suits-battle.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-user-settings': major +--- + +Feature flag filter functionality refactor From 3285590de4532fcb6fc73dd46e9636533542cd8b Mon Sep 17 00:00:00 2001 From: zcason Date: Wed, 28 Dec 2022 13:01:07 -0600 Subject: [PATCH 071/141] Revert "new changeset" This reverts commit 54dc33e6d6d98196c509dbe5353efec7bea20a52. Signed-off-by: zcason --- .changeset/sixty-suits-battle.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/sixty-suits-battle.md diff --git a/.changeset/sixty-suits-battle.md b/.changeset/sixty-suits-battle.md deleted file mode 100644 index f8eaf2ed17..0000000000 --- a/.changeset/sixty-suits-battle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-user-settings': major ---- - -Feature flag filter functionality refactor From 4c0c2d3a1f641bcb7d75a079ce72b88e49f6524b Mon Sep 17 00:00:00 2001 From: zcason Date: Wed, 28 Dec 2022 13:03:23 -0600 Subject: [PATCH 072/141] updated change set summary Signed-off-by: zcason --- .changeset/loud-beds-occur.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/loud-beds-occur.md b/.changeset/loud-beds-occur.md index 585a4799b6..cad6ccf139 100644 --- a/.changeset/loud-beds-occur.md +++ b/.changeset/loud-beds-occur.md @@ -2,4 +2,4 @@ '@backstage/plugin-user-settings': major --- -Rafector for the feature flag filter functionality +Refactor for the feature flag filter functionality From 888a53b9b7c2cbde0b74b9b294179fdca73d4eba Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Thu, 29 Dec 2022 08:57:17 -0500 Subject: [PATCH 073/141] Remove unneeded dependencies Signed-off-by: Robert Bunning --- plugins/adr/package.json | 3 --- yarn.lock | 3 --- 2 files changed, 6 deletions(-) diff --git a/plugins/adr/package.json b/plugins/adr/package.json index 2bd06c4891..016e779bf7 100644 --- a/plugins/adr/package.json +++ b/plugins/adr/package.json @@ -34,8 +34,6 @@ "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.57", - "git-url-parse": "^13.0.0", - "octokit": "^2.0.0", "react-markdown": "^8.0.0", "react-use": "^17.2.4", "remark-gfm": "^3.0.1" @@ -45,7 +43,6 @@ "react-router-dom": "6.0.0-beta.0 || ^6.3.0" }, "devDependencies": { - "@backstage/catalog-client": "workspace:^", "@backstage/cli": "workspace:^", "@backstage/core-app-api": "workspace:^", "@backstage/dev-utils": "workspace:^", diff --git a/yarn.lock b/yarn.lock index 9fe2584a3b..76a82ba929 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4236,7 +4236,6 @@ __metadata: version: 0.0.0-use.local resolution: "@backstage/plugin-adr@workspace:plugins/adr" dependencies: - "@backstage/catalog-client": "workspace:^" "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/core-app-api": "workspace:^" @@ -4259,9 +4258,7 @@ __metadata: "@types/git-url-parse": ^9.0.0 "@types/node": "*" cross-fetch: ^3.1.5 - git-url-parse: ^13.0.0 msw: ^0.49.0 - octokit: ^2.0.0 react-markdown: ^8.0.0 react-use: ^17.2.4 remark-gfm: ^3.0.1 From 74ad3d33957b413fe483dff3e911e1d7c8916c28 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 29 Dec 2022 16:29:51 +0100 Subject: [PATCH 074/141] chore: added a mock template for testing Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index 56055c8342..f45b640b35 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -36,6 +36,9 @@ catalog: - type: url target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml + - type: url + target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/react-ssr-template/template.yaml + proxy: '/circleci/api': target: https://circleci.com/api/v1.1 From 14f3ffb6631283724a32cf42a565b0dcda32ca0c Mon Sep 17 00:00:00 2001 From: zcason Date: Thu, 29 Dec 2022 10:33:23 -0600 Subject: [PATCH 075/141] updated changeset bump Signed-off-by: zcason --- .changeset/loud-beds-occur.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/loud-beds-occur.md b/.changeset/loud-beds-occur.md index cad6ccf139..546805e592 100644 --- a/.changeset/loud-beds-occur.md +++ b/.changeset/loud-beds-occur.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-user-settings': major +'@backstage/plugin-user-settings': patch --- Refactor for the feature flag filter functionality From e2d61b82fbde63ecfb7c0229c23316d671beaaf1 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 29 Dec 2022 13:11:50 -0500 Subject: [PATCH 076/141] chore: Remove duplicate config flag Signed-off-by: Adam Harvey --- scripts/check-docs-quality.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check-docs-quality.js b/scripts/check-docs-quality.js index 9c7f444033..10c4b99976 100755 --- a/scripts/check-docs-quality.js +++ b/scripts/check-docs-quality.js @@ -99,7 +99,7 @@ async function main() { if (process.argv.includes('--ci-args')) { process.stdout.write( // Workaround for not being able to pass arguments to the vale action - JSON.stringify(['--config=.github/vale/config.ini', ...files]), + JSON.stringify([...files]), ); return; } From 4b88c9b48a8a6b58d1817c179d0da61d24410e5f Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 29 Dec 2022 19:23:07 +0100 Subject: [PATCH 077/141] chore: fixing importing of the urls Signed-off-by: blam --- .github/uffizzi/uffizzi.production.app-config.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/uffizzi/uffizzi.production.app-config.yaml b/.github/uffizzi/uffizzi.production.app-config.yaml index f45b640b35..2e45740875 100644 --- a/.github/uffizzi/uffizzi.production.app-config.yaml +++ b/.github/uffizzi/uffizzi.production.app-config.yaml @@ -37,7 +37,14 @@ catalog: target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all.yaml - type: url - target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/react-ssr-template/template.yaml + target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme-corp.yaml + rules: + - allow: [User, Group] + + - type: url + target: https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml + rules: + - allow: [Template] proxy: '/circleci/api': From 0df82646197a53c6fbbd9b50ccdaad785cdf7ae9 Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Thu, 22 Dec 2022 18:20:08 +0100 Subject: [PATCH 078/141] WIP Update api extractor Signed-off-by: Juan Pablo Garcia Ripa --- packages/repo-tools/package.json | 4 +- yarn.lock | 116 ++++++++++++------------------- 2 files changed, 46 insertions(+), 74 deletions(-) diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index a638496887..7f0eaa5c6c 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -33,8 +33,8 @@ "@backstage/cli-common": "workspace:^", "@backstage/errors": "workspace:^", "@manypkg/get-packages": "^1.1.3", - "@microsoft/api-documenter": "^7.17.11", - "@microsoft/api-extractor": "^7.23.0", + "@microsoft/api-documenter": "^7.19.27", + "@microsoft/api-extractor": "^7.33.7", "chalk": "^4.0.0", "commander": "^9.1.0", "fs-extra": "10.1.0", diff --git a/yarn.lock b/yarn.lock index 9027ba0f74..4282304749 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8443,8 +8443,8 @@ __metadata: "@backstage/cli-common": "workspace:^" "@backstage/errors": "workspace:^" "@manypkg/get-packages": ^1.1.3 - "@microsoft/api-documenter": ^7.17.11 - "@microsoft/api-extractor": ^7.23.0 + "@microsoft/api-documenter": ^7.19.27 + "@microsoft/api-extractor": ^7.33.7 "@types/is-glob": ^4.0.2 "@types/mock-fs": ^4.13.0 chalk: ^4.0.0 @@ -11541,53 +11541,53 @@ __metadata: languageName: node linkType: hard -"@microsoft/api-documenter@npm:^7.17.11": - version: 7.17.11 - resolution: "@microsoft/api-documenter@npm:7.17.11" +"@microsoft/api-documenter@npm:^7.19.27": + version: 7.19.27 + resolution: "@microsoft/api-documenter@npm:7.19.27" dependencies: - "@microsoft/api-extractor-model": 7.17.2 - "@microsoft/tsdoc": 0.14.1 - "@rushstack/node-core-library": 3.45.4 - "@rushstack/ts-command-line": 4.10.10 + "@microsoft/api-extractor-model": 7.25.3 + "@microsoft/tsdoc": 0.14.2 + "@rushstack/node-core-library": 3.53.3 + "@rushstack/ts-command-line": 4.13.1 colors: ~1.2.1 js-yaml: ~3.13.1 - resolve: ~1.17.0 + resolve: ~1.22.1 bin: api-documenter: bin/api-documenter - checksum: 55f5c5d15dc8d97fc0582dc501e84f4ef9b9cbff71e9bf662d6262751ed38e691907f34ab4d57785cf2f03acf82c4957def804f77d1c85383ff2a80da51c7a60 + checksum: f243f473e1fe58e1cd6e32aad223724b6b621f569276415380abc4845859bf5c23fbe0e370be2a218f362a6c85b01b44b5427336f55800f2ea8bf3f398b0ee41 languageName: node linkType: hard -"@microsoft/api-extractor-model@npm:7.17.2": - version: 7.17.2 - resolution: "@microsoft/api-extractor-model@npm:7.17.2" +"@microsoft/api-extractor-model@npm:7.25.3": + version: 7.25.3 + resolution: "@microsoft/api-extractor-model@npm:7.25.3" dependencies: - "@microsoft/tsdoc": 0.14.1 + "@microsoft/tsdoc": 0.14.2 "@microsoft/tsdoc-config": ~0.16.1 - "@rushstack/node-core-library": 3.45.4 - checksum: 94c1c63674d85bf69cff9abbf94a1b2d2f5b6e3b651b8483d8949e39424cb29df156b589a297ca19f85ad1ff6380389e58a03198e7fe1ec34b59d5cae2166de7 + "@rushstack/node-core-library": 3.53.3 + checksum: 532ca30606b5649e90035ef70ff46868f6ccc63181e10b783bc5092e580bcb133112b300799b8f71a19da2b79f685a55f7ddbe84c8fe7ad93d71359c1763c521 languageName: node linkType: hard -"@microsoft/api-extractor@npm:^7.23.0": - version: 7.23.0 - resolution: "@microsoft/api-extractor@npm:7.23.0" +"@microsoft/api-extractor@npm:^7.33.7": + version: 7.33.7 + resolution: "@microsoft/api-extractor@npm:7.33.7" dependencies: - "@microsoft/api-extractor-model": 7.17.2 - "@microsoft/tsdoc": 0.14.1 + "@microsoft/api-extractor-model": 7.25.3 + "@microsoft/tsdoc": 0.14.2 "@microsoft/tsdoc-config": ~0.16.1 - "@rushstack/node-core-library": 3.45.4 - "@rushstack/rig-package": 0.3.11 - "@rushstack/ts-command-line": 4.10.10 + "@rushstack/node-core-library": 3.53.3 + "@rushstack/rig-package": 0.3.17 + "@rushstack/ts-command-line": 4.13.1 colors: ~1.2.1 lodash: ~4.17.15 resolve: ~1.17.0 semver: ~7.3.0 source-map: ~0.6.1 - typescript: ~4.6.3 + typescript: ~4.8.4 bin: api-extractor: bin/api-extractor - checksum: 61d3609d7aa76bece292551eb9c7a1c04c2fa304962c8b7e97aa3b3add0431a225c022e32993e384a51290e121542c6a6b3ad4be24f5315a4c1501cf821018a2 + checksum: 3f9034ca8e7bc7a6622cb8ac1f53f7f265ebca529e17f4abb2bef0ca297011cfa0927c0703a819607d974ca79b8f5307371491cfb192788e723cfd316250f9a6 languageName: node linkType: hard @@ -11610,13 +11610,6 @@ __metadata: languageName: node linkType: hard -"@microsoft/tsdoc@npm:0.14.1": - version: 0.14.1 - resolution: "@microsoft/tsdoc@npm:0.14.1" - checksum: e4ad038ccff2cd96e0d53ee42e2136f0f5a925b16cfda14261f1c2eb55ba0088a0e3b08ff819b476ddc69b2242a391925fab7f6ae2afabb19b96f87e19c114fc - languageName: node - linkType: hard - "@microsoft/tsdoc@npm:0.14.2": version: 0.14.2 resolution: "@microsoft/tsdoc@npm:0.14.2" @@ -13029,9 +13022,9 @@ __metadata: languageName: node linkType: hard -"@rushstack/node-core-library@npm:3.45.4": - version: 3.45.4 - resolution: "@rushstack/node-core-library@npm:3.45.4" +"@rushstack/node-core-library@npm:3.53.3": + version: 3.53.3 + resolution: "@rushstack/node-core-library@npm:3.53.3" dependencies: "@types/node": 12.20.24 colors: ~1.2.1 @@ -13040,31 +13033,30 @@ __metadata: jju: ~1.4.0 resolve: ~1.17.0 semver: ~7.3.0 - timsort: ~0.3.0 z-schema: ~5.0.2 - checksum: f7049be8c145ef1d1ee2ee29b917440a3c88a5e4906c5b6bebe0d4c7854c93b759b7563475be383a4cedf8afd3914b34a6b988fe67b8dfce33545223b2a46cca + checksum: 265d18e176079b8e90cd507e5d4d45f3afb1f811efdf491ea26f25f0397b77c0e9d42065166bf79a04503426c844ea92034cd3f8d5961b2a116de82e45cf6d6a languageName: node linkType: hard -"@rushstack/rig-package@npm:0.3.11": - version: 0.3.11 - resolution: "@rushstack/rig-package@npm:0.3.11" +"@rushstack/rig-package@npm:0.3.17": + version: 0.3.17 + resolution: "@rushstack/rig-package@npm:0.3.17" dependencies: resolve: ~1.17.0 strip-json-comments: ~3.1.1 - checksum: a6354152a9ac7503a217e7903d2739d35f305b2331f880fca94e6f309ba78e86b58fa8eda888238429bc4203a5cef4df4218f80e636fa75290e68875b971697a + checksum: 54eeea471c85b547575d7efc84fad3c9588f10106e2bfd8cd022bccb02c2fb0bf8ff597fab9114450b3c262abab0f0a4e52dd074bfd120e850b95037cd7b3102 languageName: node linkType: hard -"@rushstack/ts-command-line@npm:4.10.10": - version: 4.10.10 - resolution: "@rushstack/ts-command-line@npm:4.10.10" +"@rushstack/ts-command-line@npm:4.13.1": + version: 4.13.1 + resolution: "@rushstack/ts-command-line@npm:4.13.1" dependencies: "@types/argparse": 1.0.38 argparse: ~1.0.9 colors: ~1.2.1 string-argv: ~0.3.1 - checksum: e2d47cbe6df4c47e297ef84b83f1f6f2306ae14cd765066ea966f3e6ed48e1382d20c942a324ff9e389f5e673a9e1ba477f5b9514303709fcf85f28e14cdd26c + checksum: fea24b2549ecb7d3409b6b485d7c58bf8af8f8d1dd19c43a6b3532c45579ffc546bc4533b5db29c91ae1716581fdee4cb725f6a81ecb300e902ef06600e59f1d languageName: node linkType: hard @@ -34110,7 +34102,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.0": +"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.0, resolve@npm:~1.22.1": version: 1.22.1 resolution: "resolve@npm:1.22.1" dependencies: @@ -34152,7 +34144,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.0#~builtin": +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.19.0#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.22.0#~builtin, resolve@patch:resolve@~1.22.1#~builtin": version: 1.22.1 resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin::version=1.22.1&hash=07638b" dependencies: @@ -36736,7 +36728,7 @@ __metadata: languageName: node linkType: hard -"timsort@npm:^0.3.0, timsort@npm:~0.3.0": +"timsort@npm:^0.3.0": version: 0.3.0 resolution: "timsort@npm:0.3.0" checksum: 1a66cb897dacabd7dd7c91b7e2301498ca9e224de2edb9e42d19f5b17c4b6dc62a8d4cbc64f28be82aaf1541cb5a78ab49aa818f42a2989ebe049a64af731e2a @@ -37297,16 +37289,6 @@ __metadata: languageName: node linkType: hard -"typescript@npm:~4.6.3": - version: 4.6.4 - resolution: "typescript@npm:4.6.4" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: e7bfcc39cd4571a63a54e5ea21f16b8445268b9900bf55aee0e02ad981be576acc140eba24f1af5e3c1457767c96cea6d12861768fb386cf3ffb34013718631a - languageName: node - linkType: hard - "typescript@npm:~4.7.0": version: 4.7.4 resolution: "typescript@npm:4.7.4" @@ -37317,7 +37299,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:~4.8.2": +"typescript@npm:~4.8.2, typescript@npm:~4.8.4": version: 4.8.4 resolution: "typescript@npm:4.8.4" bin: @@ -37327,16 +37309,6 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@~4.6.3#~builtin": - version: 4.6.4 - resolution: "typescript@patch:typescript@npm%3A4.6.4#~builtin::version=4.6.4&hash=a1c5e5" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 1cb434fbc637d347be90e3a0c6cd05e33c38f941713c8786d3031faf1842c2c148ba91d2fac01e7276b0ae3249b8633f1660e32686cc7a8c6a8fd5361dc52c66 - languageName: node - linkType: hard - "typescript@patch:typescript@~4.7.0#~builtin": version: 4.7.4 resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin::version=4.7.4&hash=a1c5e5" @@ -37347,7 +37319,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@~4.8.2#~builtin": +"typescript@patch:typescript@~4.8.2#~builtin, typescript@patch:typescript@~4.8.4#~builtin": version: 4.8.4 resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin::version=4.8.4&hash=a1c5e5" bin: From 8f6ec37f79d6019e9b669e5ee54c9c472483bfd3 Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Tue, 27 Dec 2022 19:51:56 +0100 Subject: [PATCH 079/141] omit .d.ts warning Signed-off-by: Juan Pablo Garcia Ripa --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 609d68a4b5..a827ae478c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build:backend": "yarn workspace backend build", "build:all": "backstage-cli repo build --all", "build:api-reports": "yarn build:api-reports:only --tsc", - "build:api-reports:only": "backstage-repo-tools api-reports --allow-warnings 'packages/core-components,plugins/+(catalog|catalog-import|git-release-manager|jenkins|kubernetes)'", + "build:api-reports:only": "backstage-repo-tools api-reports --allow-warnings 'packages/core-components,plugins/+(catalog|catalog-import|git-release-manager|jenkins|kubernetes)' -o ae-wrong-input-file-type", "build:api-docs": "LANG=en_EN yarn build:api-reports --docs", "tsc": "tsc", "tsc:full": "backstage-cli repo clean && tsc --skipLibCheck false --incremental false", From b70b23272f0829fdeee20256543712a4982d5f5f Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Tue, 27 Dec 2022 20:43:46 +0100 Subject: [PATCH 080/141] update api-reports with warnings Signed-off-by: Juan Pablo Garcia Ripa --- plugins/git-release-manager/api-report.md | 594 +--------------------- plugins/jenkins/api-report.md | 14 +- plugins/kubernetes/api-report.md | 68 +-- 3 files changed, 45 insertions(+), 631 deletions(-) diff --git a/plugins/git-release-manager/api-report.md b/plugins/git-release-manager/api-report.md index d34b6c07fb..96d2948f50 100644 --- a/plugins/git-release-manager/api-report.md +++ b/plugins/git-release-manager/api-report.md @@ -12,182 +12,19 @@ import { default as React_2 } from 'react'; import { ReactNode } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; -// Warning: (ae-missing-release-tag) "A_CALVER_VERSION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const A_CALVER_VERSION = '2020.01.01_1'; - -// Warning: (ae-missing-release-tag) "A_SEMVER_VERSION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const A_SEMVER_VERSION = '1.2.3'; - -// Warning: (ae-missing-release-tag) "calverRegexp" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const calverRegexp: RegExp; - -// Warning: (ae-forgotten-export) The symbol "GetBranchResult" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "createMockBranch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public -const createMockBranch: ({ - ...rest -}?: Partial) => GetBranchResult['branch']; - -// Warning: (ae-forgotten-export) The symbol "GetCommitResult" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "createMockCommit" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const createMockCommit: ( - overrides: Partial, -) => GetCommitResult; - -// Warning: (ae-forgotten-export) The symbol "GetRecentCommitsResultSingle" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "createMockRecentCommit" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public -const createMockRecentCommit: ({ - ...rest -}: Partial) => GetRecentCommitsResultSingle; - -// Warning: (ae-forgotten-export) The symbol "GetLatestReleaseResult" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "createMockRelease" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public -const createMockRelease: ({ - id, - prerelease, - ...rest -}?: Partial< - NonNullable ->) => NonNullable; - -// Warning: (ae-forgotten-export) The symbol "GetTagResult" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "createMockTag" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const createMockTag: (overrides: Partial) => GetTagResult; - -// Warning: (ae-forgotten-export) The symbol "DifferProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "Differ" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const Differ: ({ current, next, icon }: DifferProps) => JSX.Element; - -// Warning: (ae-missing-release-tag) "DISABLE_CACHE" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const DISABLE_CACHE: { - readonly headers: { - readonly 'If-None-Match': ''; - }; -}; - -// Warning: (ae-missing-release-tag) "Divider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const Divider: () => JSX.Element; - -// Warning: (ae-forgotten-export) The symbol "SemverTagParts" needs to be exported by the entry point index.d.ts -// -// @public -function getBumpedSemverTagParts( - tagParts: SemverTagParts, - semverBumpLevel: keyof typeof SEMVER_PARTS, -): { - bumpedTagParts: { - prefix: string; - major: number; - minor: number; - patch: number; - }; -}; - -// @public -function getBumpedTag(options: { - project: Project; - tag: string; - bumpLevel: keyof typeof SEMVER_PARTS; -}): - | { - bumpedTag: string; - tagParts: CalverTagParts; - error: undefined; - } - | { - bumpedTag: string; - tagParts: { - prefix: string; - major: number; - minor: number; - patch: number; - }; - error: undefined; - } - | { - error: AlertError; - }; - -// Warning: (ae-missing-release-tag) "getCalverTagParts" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function getCalverTagParts(tag: string): - | { - error: AlertError; - tagParts?: undefined; - } - | { - tagParts: CalverTagParts; - error?: undefined; - }; - -// Warning: (ae-missing-release-tag) "getSemverTagParts" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function getSemverTagParts(tag: string): - | { - error: AlertError; - tagParts?: undefined; - } - | { - tagParts: SemverTagParts; - error?: undefined; - }; - -// Warning: (ae-missing-release-tag) "getShortCommitHash" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function getShortCommitHash(hash: string): string; - -// @public -function getTagParts(options: { project: Project; tag: string }): - | { - error: AlertError; - tagParts?: undefined; - } - | { - tagParts: CalverTagParts; - error?: undefined; - } - | { - tagParts: SemverTagParts; - error?: undefined; - }; - // Warning: (ae-forgotten-export) The symbol "GitReleaseApi" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "gitReleaseManagerApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "gitReleaseManagerApiRef" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const gitReleaseManagerApiRef: ApiRef; // Warning: (ae-forgotten-export) The symbol "GitReleaseManager" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "GitReleaseManagerPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "GitReleaseManagerPage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const GitReleaseManagerPage: GitReleaseManager; -// Warning: (ae-missing-release-tag) "gitReleaseManagerPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "gitReleaseManagerPlugin" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const gitReleaseManagerPlugin: BackstagePlugin< @@ -198,10 +35,7 @@ export const gitReleaseManagerPlugin: BackstagePlugin< {} >; -// @public (undocumented) -const InfoCardPlus: (props: { children?: React_2.ReactNode }) => JSX.Element; - -// Warning: (ae-missing-release-tag) "internals" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "internals" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const internals: { @@ -211,428 +45,8 @@ export const internals: { testHelpers: typeof testHelpers; }; -// Warning: (ae-missing-release-tag) "isCalverTagParts" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function isCalverTagParts( - project: Project, - _tagParts: unknown, -): _tagParts is CalverTagParts; - -// Warning: (ae-missing-release-tag) "isProjectValid" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function isProjectValid(project: any): project is Project; - -// Warning: (ae-missing-release-tag) "LinearProgressWithLabel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -function LinearProgressWithLabel(props: { - progress: number; - responseSteps: ResponseStep[]; -}): JSX.Element; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_BRANCH_NAME_CALVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_BRANCH_NAME_CALVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_BRANCH_NAME_SEMVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_BRANCH_NAME_SEMVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_NAME_CALVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_NAME_CALVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_NAME_SEMVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_NAME_SEMVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_VERSION_TAG_NAME_CALVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_VERSION_TAG_NAME_CALVER: string; - -// Warning: (ae-missing-release-tag) "MOCK_RELEASE_VERSION_TAG_NAME_SEMVER" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const MOCK_RELEASE_VERSION_TAG_NAME_SEMVER: string; - -// Warning: (ae-missing-release-tag) "mockBumpedTag" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockBumpedTag = 'rc-2020.01.01_1337'; - -// Warning: (ae-missing-release-tag) "mockCalverProject" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockCalverProject: Project; - -// Warning: (ae-missing-release-tag) "mockCtaMessage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockCtaMessage = 'Patch Release Candidate'; - -// Warning: (ae-missing-release-tag) "mockDefaultBranch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockDefaultBranch = 'mock_defaultBranch'; - -// Warning: (ae-missing-release-tag) "mockEmail" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockEmail = 'mock_email'; - -// Warning: (ae-forgotten-export) The symbol "getReleaseCandidateGitInfo" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "mockNextGitInfoCalver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockNextGitInfoCalver: ReturnType; - -// Warning: (ae-missing-release-tag) "mockNextGitInfoSemver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockNextGitInfoSemver: ReturnType; - -// Warning: (ae-missing-release-tag) "mockOwner" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockOwner = 'mock_owner'; - -// Warning: (ae-missing-release-tag) "mockReleaseBranch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockReleaseBranch: { - name: string; - links: { - html: string; - }; - commit: { - sha: string; - commit: { - tree: { - sha: string; - }; - }; - }; -}; - -// Warning: (ae-missing-release-tag) "mockReleaseCandidateCalver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockReleaseCandidateCalver: { - targetCommitish: string; - tagName: string; - prerelease: boolean; - id: number; - htmlUrl: string; - body?: string | null | undefined; -}; - -// Warning: (ae-missing-release-tag) "mockReleaseCandidateSemver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockReleaseCandidateSemver: { - targetCommitish: string; - tagName: string; - prerelease: boolean; - id: number; - htmlUrl: string; - body?: string | null | undefined; -}; - -// Warning: (ae-forgotten-export) The symbol "ReleaseStats" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "mockReleaseStats" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockReleaseStats: ReleaseStats; - -// Warning: (ae-missing-release-tag) "mockReleaseVersionCalver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockReleaseVersionCalver: { - targetCommitish: string; - tagName: string; - prerelease: boolean; - id: number; - htmlUrl: string; - body?: string | null | undefined; -}; - -// Warning: (ae-missing-release-tag) "mockReleaseVersionSemver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockReleaseVersionSemver: { - targetCommitish: string; - tagName: string; - prerelease: boolean; - id: number; - htmlUrl: string; - body?: string | null | undefined; -}; - -// Warning: (ae-missing-release-tag) "mockRepo" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockRepo = 'mock_repo'; - -// Warning: (ae-missing-release-tag) "mockSearchCalver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockSearchCalver: string; - -// Warning: (ae-missing-release-tag) "mockSearchSemver" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockSearchSemver: string; - -// Warning: (ae-missing-release-tag) "mockSelectedPatchCommit" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockSelectedPatchCommit: { - htmlUrl: string; - sha: string; - author: { - htmlUrl?: string | undefined; - login?: string | undefined; - }; - commit: { - message: string; - }; - firstParentSha?: string | undefined; -}; - -// Warning: (ae-missing-release-tag) "mockSemverProject" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockSemverProject: Project; - -// Warning: (ae-missing-release-tag) "mockTagParts" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockTagParts: CalverTagParts; - -// Warning: (ae-missing-release-tag) "mockUser" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockUser: { - username: string; - email: string; -}; - -// Warning: (ae-missing-release-tag) "mockUsername" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const mockUsername = 'mock_username'; - -// Warning: (ae-missing-release-tag) "NoLatestRelease" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const NoLatestRelease: () => JSX.Element; - -// Warning: (ae-forgotten-export) The symbol "DialogProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ResponseStepDialog" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const ResponseStepDialog: ({ - progress, - responseSteps, - title, -}: DialogProps) => JSX.Element; - -// Warning: (ae-forgotten-export) The symbol "ResponseStepListProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ResponseStepList" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const ResponseStepList: ({ - responseSteps, - animationDelay, - loading, - denseList, - children, -}: PropsWithChildren) => JSX.Element; - -// Warning: (ae-forgotten-export) The symbol "ResponseStepListItemProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ResponseStepListItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const ResponseStepListItem: ({ - responseStep, - animationDelay, -}: ResponseStepListItemProps) => JSX.Element; - -// Warning: (ae-missing-release-tag) "SEMVER_PARTS" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const SEMVER_PARTS: { - major: 'major'; - minor: 'minor'; - patch: 'patch'; -}; - -// Warning: (ae-missing-release-tag) "semverRegexp" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const semverRegexp: RegExp; - -declare namespace stats { - export { mockReleaseStats }; -} - -// Warning: (ae-missing-release-tag) "TAG_OBJECT_MESSAGE" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const TAG_OBJECT_MESSAGE = - 'Tag generated by your friendly neighborhood Backstage Release Manager'; - -// Warning: (ae-missing-release-tag) "TEST_IDS" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const TEST_IDS: { - info: { - info: string; - infoFeaturePlus: string; - }; - createRc: { - cta: string; - semverSelect: string; - }; - promoteRc: { - mockedPromoteRcBody: string; - notRcWarning: string; - promoteRc: string; - cta: string; - }; - patch: { - error: string; - loading: string; - notPrerelease: string; - body: string; - }; - form: { - owner: { - loading: string; - select: string; - error: string; - empty: string; - }; - repo: { - loading: string; - select: string; - error: string; - empty: string; - }; - versioningStrategy: { - radioGroup: string; - }; - }; - components: { - divider: string; - noLatestRelease: string; - circularProgress: string; - responseStepListDialogContent: string; - responseStepListItem: string; - responseStepListItemIconSuccess: string; - responseStepListItemIconFailure: string; - responseStepListItemIconLink: string; - responseStepListItemIconDefault: string; - differ: { - current: string; - next: string; - icons: { - tag: string; - branch: string; - github: string; - slack: string; - versioning: string; - }; - }; - linearProgressWithLabel: string; - }; -}; - -declare namespace testHelpers_2 { - export { - mockUsername, - mockEmail, - mockOwner, - mockRepo, - A_CALVER_VERSION, - MOCK_RELEASE_NAME_CALVER, - MOCK_RELEASE_BRANCH_NAME_CALVER, - MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, - MOCK_RELEASE_VERSION_TAG_NAME_CALVER, - A_SEMVER_VERSION, - MOCK_RELEASE_NAME_SEMVER, - MOCK_RELEASE_BRANCH_NAME_SEMVER, - MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER, - MOCK_RELEASE_VERSION_TAG_NAME_SEMVER, - createMockTag, - createMockCommit, - mockUser, - mockSemverProject, - mockCalverProject, - mockSearchCalver, - mockSearchSemver, - mockDefaultBranch, - mockNextGitInfoSemver, - mockNextGitInfoCalver, - mockTagParts, - mockCtaMessage, - mockBumpedTag, - createMockRelease, - mockReleaseCandidateCalver, - mockReleaseVersionCalver, - mockReleaseCandidateSemver, - mockReleaseVersionSemver, - createMockBranch, - mockReleaseBranch, - createMockRecentCommit, - mockSelectedPatchCommit, - }; -} - -declare namespace testIds { - export { TEST_IDS }; -} - -// @public (undocumented) -const validateTagName: (options: { project: Project; tagName?: string }) => - | { - tagNameError: null; - } - | { - tagNameError: AlertError | undefined; - }; - -// Warning: (ae-missing-release-tag) "VERSIONING_STRATEGIES" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -const VERSIONING_STRATEGIES: { - semver: 'semver'; - calver: 'calver'; -}; - // Warnings were encountered during analysis: // -// src/components/ResponseStepDialog/LinearProgressWithLabel.d.ts:5:5 - (ae-forgotten-export) The symbol "ResponseStep" needs to be exported by the entry point index.d.ts -// src/helpers/getBumpedTag.d.ts:16:5 - (ae-forgotten-export) The symbol "Project" needs to be exported by the entry point index.d.ts -// src/helpers/getBumpedTag.d.ts:21:5 - (ae-forgotten-export) The symbol "CalverTagParts" needs to be exported by the entry point index.d.ts -// src/helpers/getBumpedTag.d.ts:33:5 - (ae-forgotten-export) The symbol "AlertError" needs to be exported by the entry point index.d.ts // src/index.d.ts:9:5 - (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts // src/index.d.ts:10:5 - (ae-forgotten-export) The symbol "constants" needs to be exported by the entry point index.d.ts // src/index.d.ts:11:5 - (ae-forgotten-export) The symbol "helpers" needs to be exported by the entry point index.d.ts diff --git a/plugins/jenkins/api-report.md b/plugins/jenkins/api-report.md index 59e3dc636e..a2ae16988b 100644 --- a/plugins/jenkins/api-report.md +++ b/plugins/jenkins/api-report.md @@ -28,12 +28,12 @@ const isJenkinsAvailable: (entity: Entity) => boolean; export { isJenkinsAvailable }; export { isJenkinsAvailable as isPluginApplicableToEntity }; -// Warning: (ae-missing-release-tag) "JENKINS_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "JENKINS_ANNOTATION" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const JENKINS_ANNOTATION = 'jenkins.io/job-full-name'; -// Warning: (ae-missing-release-tag) "JenkinsApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "JenkinsApi" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface JenkinsApi { @@ -58,12 +58,12 @@ export interface JenkinsApi { }): Promise; } -// Warning: (ae-missing-release-tag) "jenkinsApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "jenkinsApiRef" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const jenkinsApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "JenkinsClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "JenkinsClient" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export class JenkinsClient implements JenkinsApi { @@ -103,7 +103,7 @@ const jenkinsPlugin: BackstagePlugin< export { jenkinsPlugin }; export { jenkinsPlugin as plugin }; -// Warning: (ae-missing-release-tag) "LatestRunCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "LatestRunCard" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const LatestRunCard: (props: { @@ -111,12 +111,12 @@ export const LatestRunCard: (props: { variant?: InfoCardVariants; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "LEGACY_JENKINS_ANNOTATION" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "LEGACY_JENKINS_ANNOTATION" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const LEGACY_JENKINS_ANNOTATION = 'jenkins.io/github-folder'; -// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Router" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const Router: () => JSX.Element; diff --git a/plugins/kubernetes/api-report.md b/plugins/kubernetes/api-report.md index 3e1b2f0198..463b4126eb 100644 --- a/plugins/kubernetes/api-report.md +++ b/plugins/kubernetes/api-report.md @@ -36,7 +36,7 @@ import { V1StatefulSet } from '@kubernetes/client-node'; import { WorkloadsByEntityRequest } from '@backstage/plugin-kubernetes-common'; // Warning: (ae-forgotten-export) The symbol "ClusterProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "Cluster" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Cluster" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const Cluster: ({ @@ -44,19 +44,19 @@ export const Cluster: ({ podsWithErrors, }: ClusterProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "ClusterContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ClusterContext" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const ClusterContext: React_2.Context; -// Warning: (ae-missing-release-tag) "ClusterLinksFormatter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ClusterLinksFormatter" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type ClusterLinksFormatter = ( options: ClusterLinksFormatterOptions, ) => URL; -// Warning: (ae-missing-release-tag) "ClusterLinksFormatterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ClusterLinksFormatterOptions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface ClusterLinksFormatterOptions { @@ -70,24 +70,24 @@ export interface ClusterLinksFormatterOptions { object: any; } -// Warning: (ae-missing-release-tag) "clusterLinksFormatters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "clusterLinksFormatters" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const clusterLinksFormatters: Record; // Warning: (ae-forgotten-export) The symbol "CronJobsAccordionsProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "CronJobsAccordions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "CronJobsAccordions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const CronJobsAccordions: ({}: CronJobsAccordionsProps) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "CustomResourcesProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "CustomResources" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "CustomResources" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const CustomResources: ({}: CustomResourcesProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "DeploymentResources" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "DeploymentResources" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface DeploymentResources { @@ -125,7 +125,7 @@ export const detectErrors: ( objects: ObjectsByEntityResponse, ) => DetectedErrorsByCluster; -// Warning: (ae-missing-release-tag) "EntityKubernetesContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "EntityKubernetesContent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const EntityKubernetesContent: ( @@ -144,7 +144,7 @@ export type ErrorDetectableKind = | 'HorizontalPodAutoscaler'; // Warning: (ae-forgotten-export) The symbol "ErrorPanelProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ErrorPanel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ErrorPanel" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const ErrorPanel: ({ @@ -154,7 +154,7 @@ export const ErrorPanel: ({ }: ErrorPanelProps) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "ErrorReportingProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ErrorReporting" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ErrorReporting" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const ErrorReporting: ({ @@ -165,7 +165,7 @@ export const ErrorReporting: ({ export type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; // Warning: (ae-forgotten-export) The symbol "FormatClusterLinkOptions" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "formatClusterLink" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "formatClusterLink" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function formatClusterLink( @@ -173,7 +173,7 @@ export function formatClusterLink( ): string | undefined; // Warning: (ae-forgotten-export) The symbol "KubernetesAuthProvider" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "GoogleKubernetesAuthProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "GoogleKubernetesAuthProvider" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export class GoogleKubernetesAuthProvider implements KubernetesAuthProvider { @@ -186,7 +186,7 @@ export class GoogleKubernetesAuthProvider implements KubernetesAuthProvider { ): Promise; } -// Warning: (ae-missing-release-tag) "GroupedResponses" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "GroupedResponses" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface GroupedResponses extends DeploymentResources { @@ -206,7 +206,7 @@ export interface GroupedResponses extends DeploymentResources { statefulsets: V1StatefulSet[]; } -// Warning: (ae-missing-release-tag) "GroupedResponsesContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "GroupedResponsesContext" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const GroupedResponsesContext: React_2.Context; @@ -219,23 +219,23 @@ export const HorizontalPodAutoscalerDrawer: (props: { }) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "IngressesAccordionsProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "IngressesAccordions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "IngressesAccordions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const IngressesAccordions: ({}: IngressesAccordionsProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "isKubernetesAvailable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "isKubernetesAvailable" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const isKubernetesAvailable: (entity: Entity) => boolean; // Warning: (ae-forgotten-export) The symbol "JobsAccordionsProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "JobsAccordions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "JobsAccordions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const JobsAccordions: ({ jobs }: JobsAccordionsProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "KubernetesApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesApi" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface KubernetesApi { @@ -261,12 +261,12 @@ export interface KubernetesApi { ): Promise; } -// Warning: (ae-missing-release-tag) "kubernetesApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "kubernetesApiRef" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const kubernetesApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "KubernetesAuthProviders" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesAuthProviders" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export class KubernetesAuthProviders implements KubernetesAuthProvidersApi { @@ -283,7 +283,7 @@ export class KubernetesAuthProviders implements KubernetesAuthProvidersApi { ): Promise; } -// Warning: (ae-missing-release-tag) "KubernetesAuthProvidersApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesAuthProvidersApi" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface KubernetesAuthProvidersApi { @@ -294,12 +294,12 @@ export interface KubernetesAuthProvidersApi { ): Promise; } -// Warning: (ae-missing-release-tag) "kubernetesAuthProvidersApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "kubernetesAuthProvidersApiRef" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const kubernetesAuthProvidersApiRef: ApiRef; -// Warning: (ae-missing-release-tag) "KubernetesBackendClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesBackendClient" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export class KubernetesBackendClient implements KubernetesApi { @@ -329,7 +329,7 @@ export class KubernetesBackendClient implements KubernetesApi { } // Warning: (ae-forgotten-export) The symbol "KubernetesContentProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "KubernetesContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesContent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const KubernetesContent: ({ @@ -339,7 +339,7 @@ export const KubernetesContent: ({ // Warning: (ae-forgotten-export) The symbol "KubernetesDrawerable" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "KubernetesDrawerProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "KubernetesDrawer" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesDrawer" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const KubernetesDrawer: ({ @@ -351,7 +351,7 @@ export const KubernetesDrawer: ({ children, }: KubernetesDrawerProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "KubernetesObjects" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "KubernetesObjects" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface KubernetesObjects { @@ -363,7 +363,7 @@ export interface KubernetesObjects { loading: boolean; } -// Warning: (ae-missing-release-tag) "kubernetesPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "kubernetesPlugin" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) const kubernetesPlugin: BackstagePlugin< @@ -382,12 +382,12 @@ export const PodDrawer: (props: { expanded?: boolean; }) => JSX.Element; -// Warning: (ae-missing-release-tag) "PodNamesWithErrorsContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "PodNamesWithErrorsContext" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const PodNamesWithErrorsContext: React_2.Context>; -// Warning: (ae-missing-release-tag) "PodNamesWithMetricsContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "PodNamesWithMetricsContext" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const PodNamesWithMetricsContext: React_2.Context< @@ -395,7 +395,7 @@ export const PodNamesWithMetricsContext: React_2.Context< >; // Warning: (ae-forgotten-export) The symbol "PodsTablesProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "PodsTable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "PodsTable" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const PodsTable: ({ @@ -403,7 +403,7 @@ export const PodsTable: ({ extraColumns, }: PodsTablesProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "Router" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Router" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const Router: (props: { refreshIntervalMs?: number }) => JSX.Element; @@ -419,7 +419,7 @@ export class ServerSideKubernetesAuthProvider } // Warning: (ae-forgotten-export) The symbol "ServicesAccordionsProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ServicesAccordions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ServicesAccordions" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const ServicesAccordions: ({}: ServicesAccordionsProps) => JSX.Element; @@ -431,7 +431,7 @@ export const useCustomResources: ( intervalMs?: number, ) => KubernetesObjects; -// Warning: (ae-missing-release-tag) "useKubernetesObjects" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "useKubernetesObjects" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const useKubernetesObjects: ( From 84cda2bd56de61c936a807278c7388230b791f3d Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Wed, 28 Dec 2022 01:48:46 +0100 Subject: [PATCH 081/141] check for disambiguated symbol names Signed-off-by: Juan Pablo Garcia Ripa --- packages/core-components/api-report.md | 230 +++++++++--------- .../src/commands/api-reports/api-extractor.ts | 12 +- plugins/catalog-import/api-report.md | 4 +- 3 files changed, 127 insertions(+), 119 deletions(-) diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md index c46b3637cb..4cdc42ee79 100644 --- a/packages/core-components/api-report.md +++ b/packages/core-components/api-report.md @@ -113,7 +113,7 @@ export type BottomLinkProps = { onClick?: (event: React_2.MouseEvent) => void; }; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_19" needs to be exported by the entry point index.d.ts // // @public export function Breadcrumbs(props: Props_19): JSX.Element; @@ -168,7 +168,7 @@ export interface CodeSnippetProps { text: string; } -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_13" needs to be exported by the entry point index.d.ts // // @public export function Content(props: PropsWithChildren): JSX.Element; @@ -320,7 +320,7 @@ export function DocsIcon(props: IconComponentProps): JSX.Element; // @public (undocumented) export function EmailIcon(props: IconComponentProps): JSX.Element; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_2" needs to be exported by the entry point index.d.ts // // @public export function EmptyState(props: Props_2): JSX.Element; @@ -375,7 +375,7 @@ export type FeatureCalloutCircleClassKey = | 'pulseCircle' | 'text'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_4" needs to be exported by the entry point index.d.ts // // @public export function FeatureCalloutCircular( @@ -388,7 +388,7 @@ export type FiltersContainerClassKey = 'root' | 'title'; // @public export function Gauge(props: GaugeProps): JSX.Element; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_10" needs to be exported by the entry point index.d.ts // // @public export function GaugeCard(props: Props_10): JSX.Element; @@ -432,7 +432,7 @@ export function GitHubIcon(props: IconComponentProps): JSX.Element; // @public (undocumented) export function GroupIcon(props: IconComponentProps): JSX.Element; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_14" needs to be exported by the entry point index.d.ts // // @public export function Header(props: PropsWithChildren): JSX.Element; @@ -466,7 +466,7 @@ export type HeaderClassKey = | 'breadcrumbType' | 'breadcrumbTitle'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_5" needs to be exported by the entry point index.d.ts // // @public export function HeaderIconLinkRow(props: Props_5): JSX.Element; @@ -497,7 +497,7 @@ export type HeaderTabsClassKey = // @public (undocumented) export function HelpIcon(props: IconComponentProps): JSX.Element; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_6" needs to be exported by the entry point index.d.ts // // @public export function HorizontalScrollGrid( @@ -524,7 +524,7 @@ export type IconLinkVerticalClassKey = | 'secondary' | 'label'; -// Warning: (ae-missing-release-tag) "IconLinkVerticalProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "IconLinkVerticalProps" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type IconLinkVerticalProps = { @@ -540,7 +540,7 @@ export type IconLinkVerticalProps = { // @public (undocumented) export type IdentityProviders = ('guest' | 'custom' | SignInProviderConfig)[]; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Props_15" needs to be exported by the entry point index.d.ts // // @public export function InfoCard(props: Props_15): JSX.Element; @@ -564,7 +564,7 @@ export type InfoCardVariants = 'flex' | 'fullHeight' | 'gridItem'; export function IntroCard(props: IntroCardProps): JSX.Element; // Warning: (ae-forgotten-export) The symbol "ItemCardProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ItemCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ItemCard" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public @deprecated export function ItemCard(props: ItemCardProps): JSX.Element; @@ -588,7 +588,7 @@ export function ItemCardHeader(props: ItemCardHeaderProps): JSX.Element; // @public (undocumented) export type ItemCardHeaderClassKey = 'root'; -// Warning: (ae-forgotten-export) The symbol "styles" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "styles_2" needs to be exported by the entry point index.d.ts // // @public (undocumented) export type ItemCardHeaderProps = Partial> & { @@ -607,29 +607,29 @@ enum LabelPosition { RIGHT = 'r', } -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "Lifecycle" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_7" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "Lifecycle" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function Lifecycle(props: Props_7): JSX.Element; -// Warning: (ae-missing-release-tag) "LifecycleClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "LifecycleClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type LifecycleClassKey = 'alpha' | 'beta'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "LinearGauge" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_11" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "LinearGauge" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function LinearGauge(props: Props_11): JSX.Element | null; -// Warning: (ae-missing-release-tag) "Link" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Link" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export const Link: (props: LinkProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "LinkProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "LinkProps" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type LinkProps = Omit & @@ -639,7 +639,7 @@ export type LinkProps = Omit & noTrack?: boolean; }; -// Warning: (ae-missing-release-tag) "LoginRequestListItemClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "LoginRequestListItemClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type LoginRequestListItemClassKey = 'root'; @@ -688,49 +688,49 @@ export interface LogViewerProps { text: string; } -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "MarkdownContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_8" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "MarkdownContent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export function MarkdownContent(props: Props_8): JSX.Element; -// Warning: (ae-missing-release-tag) "MarkdownContentClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MarkdownContentClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MarkdownContentClassKey = 'markdown'; -// Warning: (ae-missing-release-tag) "MetadataTableCellClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MetadataTableCellClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MetadataTableCellClassKey = 'root'; -// Warning: (ae-missing-release-tag) "MetadataTableListClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MetadataTableListClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MetadataTableListClassKey = 'root'; -// Warning: (ae-missing-release-tag) "MetadataTableListItemClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MetadataTableListItemClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MetadataTableListItemClassKey = 'root' | 'random'; -// Warning: (ae-missing-release-tag) "MetadataTableTitleCellClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MetadataTableTitleCellClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MetadataTableTitleCellClassKey = 'root'; -// Warning: (ae-missing-release-tag) "MicDropClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MicDropClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MicDropClassKey = 'micDrop'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "MissingAnnotationEmptyState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_3" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "MissingAnnotationEmptyState" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function MissingAnnotationEmptyState(props: Props_3): JSX.Element; -// Warning: (ae-missing-release-tag) "MissingAnnotationEmptyStateClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "MissingAnnotationEmptyStateClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type MissingAnnotationEmptyStateClassKey = 'code'; @@ -743,12 +743,12 @@ export type MobileSidebarProps = { children?: React_2.ReactNode; }; -// Warning: (ae-missing-release-tag) "OAuthRequestDialog" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "OAuthRequestDialog" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function OAuthRequestDialog(_props: {}): JSX.Element; -// Warning: (ae-missing-release-tag) "OAuthRequestDialogClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "OAuthRequestDialogClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type OAuthRequestDialogClassKey = @@ -757,42 +757,42 @@ export type OAuthRequestDialogClassKey = | 'contentList' | 'actionButtons'; -// Warning: (ae-missing-release-tag) "OpenedDropdownClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "OpenedDropdownClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type OpenedDropdownClassKey = 'icon'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "OverflowTooltip" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_9" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "OverflowTooltip" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function OverflowTooltip(props: Props_9): JSX.Element; -// Warning: (ae-missing-release-tag) "OverflowTooltipClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "OverflowTooltipClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type OverflowTooltipClassKey = 'container'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "Page" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_16" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "Page" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function Page(props: Props_16): JSX.Element; -// Warning: (ae-missing-release-tag) "PageClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "PageClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type PageClassKey = 'root'; // Warning: (ae-forgotten-export) The symbol "PageWithHeaderProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "PageWithHeader" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "PageWithHeader" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function PageWithHeader( props: PropsWithChildren, ): JSX.Element; -// Warning: (ae-missing-release-tag) "Progress" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Progress" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function Progress( @@ -810,7 +810,7 @@ export type ProxiedSignInPageProps = SignInPageProps & { headers?: HeadersInit | (() => HeadersInit) | (() => Promise); }; -// Warning: (ae-missing-release-tag) "Ranker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Ranker" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public enum Ranker { @@ -819,14 +819,14 @@ enum Ranker { TIGHT_TREE = 'tight-tree', } -// Warning: (ae-missing-release-tag) "RenderLabelFunction" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "RenderLabelFunction" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public type RenderLabelFunction = ( props: RenderLabelProps, ) => React_2.ReactNode; -// Warning: (ae-missing-release-tag) "RenderLabelProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "RenderLabelProps" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver // @@ -835,7 +835,7 @@ type RenderLabelProps = { edge: DependencyEdge; }; -// Warning: (ae-missing-release-tag) "RenderNodeFunction" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "RenderNodeFunction" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver // // @public @@ -843,7 +843,7 @@ type RenderNodeFunction = ( props: RenderNodeProps, ) => React_2.ReactNode; -// Warning: (ae-missing-release-tag) "RenderNodeProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "RenderNodeProps" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver // @@ -852,17 +852,17 @@ type RenderNodeProps = { node: DependencyNode; }; -// Warning: (ae-missing-release-tag) "ResponseErrorPanel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ResponseErrorPanel" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export function ResponseErrorPanel(props: ErrorPanelProps): JSX.Element; -// Warning: (ae-missing-release-tag) "ResponseErrorPanelClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ResponseErrorPanelClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type ResponseErrorPanelClassKey = 'text' | 'divider'; -// Warning: (ae-missing-release-tag) "RoutedTabs" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "RoutedTabs" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function RoutedTabs(props: { routes: SubRoute_2[] }): JSX.Element; @@ -896,7 +896,7 @@ export type SelectItem = { // @public export const Sidebar: (props: SidebarProps) => JSX.Element; -// Warning: (ae-missing-release-tag) "SIDEBAR_INTRO_LOCAL_STORAGE" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SIDEBAR_INTRO_LOCAL_STORAGE" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const SIDEBAR_INTRO_LOCAL_STORAGE = @@ -905,7 +905,7 @@ export const SIDEBAR_INTRO_LOCAL_STORAGE = // @public (undocumented) export type SidebarClassKey = 'drawer' | 'drawerOpen'; -// Warning: (ae-missing-release-tag) "sidebarConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "sidebarConfig" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const sidebarConfig: { @@ -933,7 +933,7 @@ export type SidebarContextType = { setOpen: (open: boolean) => void; }; -// Warning: (ae-missing-release-tag) "SidebarDivider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarDivider" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const SidebarDivider: React_2.ComponentType< @@ -942,7 +942,7 @@ export const SidebarDivider: React_2.ComponentType< StyledComponentProps<'root'> >; -// Warning: (ae-missing-release-tag) "SidebarDividerClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarDividerClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SidebarDividerClassKey = 'root'; @@ -960,7 +960,7 @@ export interface SidebarGroupProps extends BottomNavigationActionProps { to?: string; } -// Warning: (ae-missing-release-tag) "SidebarIntro" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarIntro" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SidebarIntro(_props: {}): JSX.Element | null; @@ -974,7 +974,7 @@ export type SidebarIntroClassKey = | 'introDismissIcon'; // Warning: (ae-forgotten-export) The symbol "SidebarItemProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SidebarItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarItem" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export const SidebarItem: (props: SidebarItemProps) => JSX.Element; @@ -1018,12 +1018,12 @@ export type SidebarOptions = { drawerWidthOpen?: number; }; -// Warning: (ae-missing-release-tag) "SidebarPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarPage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SidebarPage(props: SidebarPageProps): JSX.Element; -// Warning: (ae-missing-release-tag) "SidebarPageClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarPageClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SidebarPageClassKey = 'root'; @@ -1066,7 +1066,7 @@ export type SidebarProps = { children?: React_2.ReactNode; }; -// Warning: (ae-missing-release-tag) "SidebarScrollWrapper" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarScrollWrapper" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const SidebarScrollWrapper: React_2.ComponentType< @@ -1076,12 +1076,12 @@ export const SidebarScrollWrapper: React_2.ComponentType< >; // Warning: (ae-forgotten-export) The symbol "SidebarSearchFieldProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SidebarSearchField" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarSearchField" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SidebarSearchField(props: SidebarSearchFieldProps): JSX.Element; -// Warning: (ae-missing-release-tag) "SidebarSpace" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarSpace" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const SidebarSpace: React_2.ComponentType< @@ -1090,12 +1090,12 @@ export const SidebarSpace: React_2.ComponentType< StyledComponentProps<'root'> >; -// Warning: (ae-missing-release-tag) "SidebarSpaceClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarSpaceClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SidebarSpaceClassKey = 'root'; -// Warning: (ae-missing-release-tag) "SidebarSpacer" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarSpacer" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export const SidebarSpacer: React_2.ComponentType< @@ -1104,7 +1104,7 @@ export const SidebarSpacer: React_2.ComponentType< StyledComponentProps<'root'> >; -// Warning: (ae-missing-release-tag) "SidebarSpacerClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SidebarSpacerClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SidebarSpacerClassKey = 'root'; @@ -1138,18 +1138,18 @@ export type SidebarSubmenuProps = { children: ReactNode; }; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SignInPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_17" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "SignInPage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SignInPage(props: Props_17): JSX.Element; -// Warning: (ae-missing-release-tag) "SignInPageClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SignInPageClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SignInPageClassKey = 'container' | 'item'; -// Warning: (ae-missing-release-tag) "SignInProviderConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SignInProviderConfig" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SignInProviderConfig = { @@ -1160,37 +1160,37 @@ export type SignInProviderConfig = { }; // Warning: (ae-forgotten-export) The symbol "StepperProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SimpleStepper" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SimpleStepper" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SimpleStepper( props: PropsWithChildren, ): JSX.Element; -// Warning: (ae-missing-release-tag) "SimpleStepperFooterClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SimpleStepperFooterClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SimpleStepperFooterClassKey = 'root'; // Warning: (ae-forgotten-export) The symbol "StepProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SimpleStepperStep" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SimpleStepperStep" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SimpleStepperStep( props: PropsWithChildren, ): JSX.Element; -// Warning: (ae-missing-release-tag) "SimpleStepperStepClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SimpleStepperStepClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SimpleStepperStepClassKey = 'end'; -// Warning: (ae-missing-release-tag) "StatusAborted" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusAborted" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StatusAborted(props: PropsWithChildren<{}>): JSX.Element; -// Warning: (ae-missing-release-tag) "StatusClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type StatusClassKey = @@ -1202,43 +1202,43 @@ export type StatusClassKey = | 'running' | 'aborted'; -// Warning: (ae-missing-release-tag) "StatusError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusError" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StatusError(props: PropsWithChildren<{}>): JSX.Element; -// Warning: (ae-missing-release-tag) "StatusOK" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusOK" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StatusOK(props: PropsWithChildren<{}>): JSX.Element; -// Warning: (ae-missing-release-tag) "StatusPending" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusPending" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StatusPending(props: PropsWithChildren<{}>): JSX.Element; -// Warning: (ae-missing-release-tag) "StatusRunning" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusRunning" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StatusRunning(props: PropsWithChildren<{}>): JSX.Element; -// Warning: (ae-missing-release-tag) "StatusWarning" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StatusWarning" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StatusWarning(props: PropsWithChildren<{}>): JSX.Element; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "StructuredMetadataTable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_12" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "StructuredMetadataTable" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function StructuredMetadataTable(props: Props_12): JSX.Element; -// Warning: (ae-missing-release-tag) "StructuredMetadataTableListClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StructuredMetadataTableListClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type StructuredMetadataTableListClassKey = 'root'; -// Warning: (ae-missing-release-tag) "StructuredMetadataTableNestedListClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "StructuredMetadataTableNestedListClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type StructuredMetadataTableNestedListClassKey = 'root'; @@ -1250,28 +1250,28 @@ export type SubmenuOptions = { }; // Warning: (ae-forgotten-export) The symbol "SubvalueCellProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SubvalueCell" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SubvalueCell" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SubvalueCell(props: SubvalueCellProps): JSX.Element; -// Warning: (ae-missing-release-tag) "SubvalueCellClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SubvalueCellClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SubvalueCellClassKey = 'value' | 'subvalue'; // Warning: (ae-forgotten-export) The symbol "SupportButtonProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "SupportButton" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SupportButton" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function SupportButton(props: SupportButtonProps): JSX.Element; -// Warning: (ae-missing-release-tag) "SupportButtonClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SupportButtonClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SupportButtonClassKey = 'popoverList'; -// Warning: (ae-missing-release-tag) "SupportConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SupportConfig" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SupportConfig = { @@ -1279,7 +1279,7 @@ export type SupportConfig = { items: SupportItem[]; }; -// Warning: (ae-missing-release-tag) "SupportItem" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SupportItem" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SupportItem = { @@ -1288,7 +1288,7 @@ export type SupportItem = { links: SupportItemLink[]; }; -// Warning: (ae-missing-release-tag) "SupportItemLink" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SupportItemLink" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type SupportItemLink = { @@ -1296,7 +1296,7 @@ export type SupportItemLink = { title: string; }; -// Warning: (ae-missing-release-tag) "Tab" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Tab" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type Tab = { @@ -1310,24 +1310,24 @@ export type Tab = { >; }; -// Warning: (ae-missing-release-tag) "TabBarClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TabBarClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TabBarClassKey = 'indicator' | 'flexContainer' | 'root'; -// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "TabbedCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-forgotten-export) The symbol "Props_18" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "TabbedCard" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function TabbedCard(props: PropsWithChildren): JSX.Element; -// Warning: (ae-missing-release-tag) "TabbedCardClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TabbedCardClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TabbedCardClassKey = 'root' | 'indicator'; -// Warning: (ae-missing-release-tag) "TabbedLayout" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// Warning: (ae-missing-release-tag) "TabbedLayout" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TabbedLayout" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TabbedLayout" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export function TabbedLayout(props: PropsWithChildren<{}>): JSX.Element; @@ -1343,12 +1343,12 @@ export namespace TabbedLayout { // @public (undocumented) export type TabClassKey = 'root' | 'selected'; -// Warning: (ae-missing-release-tag) "TabIconClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TabIconClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TabIconClassKey = 'root'; -// Warning: (ae-missing-release-tag) "Table" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Table" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function Table(props: TableProps): JSX.Element; @@ -1359,12 +1359,12 @@ export namespace Table { icons: Readonly; } -// Warning: (ae-missing-release-tag) "TableClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TableClassKey = 'root'; -// Warning: (ae-missing-release-tag) "TableColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableColumn" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface TableColumn extends Column { @@ -1374,7 +1374,7 @@ export interface TableColumn extends Column { width?: string; } -// Warning: (ae-missing-release-tag) "TableFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableFilter" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TableFilter = { @@ -1382,17 +1382,17 @@ export type TableFilter = { type: 'select' | 'multiple-select'; }; -// Warning: (ae-missing-release-tag) "TableFiltersClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableFiltersClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TableFiltersClassKey = 'root' | 'value' | 'heder' | 'filters'; -// Warning: (ae-missing-release-tag) "TableHeaderClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableHeaderClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TableHeaderClassKey = 'header'; -// Warning: (ae-missing-release-tag) "TableProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableProps" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export interface TableProps @@ -1411,7 +1411,7 @@ export interface TableProps subtitle?: string; } -// Warning: (ae-missing-release-tag) "TableState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableState" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TableState = { @@ -1420,23 +1420,23 @@ export type TableState = { filters?: SelectedFilters; }; -// Warning: (ae-missing-release-tag) "TableToolbarClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TableToolbarClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TableToolbarClassKey = 'root' | 'title' | 'searchField'; // Warning: (ae-forgotten-export) The symbol "TabsProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "Tabs" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "Tabs" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function Tabs(props: TabsProps): JSX.Element; -// Warning: (ae-missing-release-tag) "TabsClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TabsClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type TabsClassKey = 'root' | 'styledTabs' | 'appbar'; -// Warning: (ae-missing-release-tag) "TrendLine" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "TrendLine" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function TrendLine( @@ -1453,7 +1453,7 @@ export function useContent(): { }; // Warning: (ae-forgotten-export) The symbol "SetQueryParams" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "useQueryParamState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "useQueryParamState" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function useQueryParamState( @@ -1502,7 +1502,7 @@ export const useSidebarOpenState: () => SidebarOpenState; // @public export const useSidebarPinState: () => SidebarPinState; -// Warning: (ae-missing-release-tag) "useSupportConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "useSupportConfig" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export function useSupportConfig(): SupportConfig; @@ -1511,12 +1511,12 @@ export function useSupportConfig(): SupportConfig; export function WarningIcon(props: IconComponentProps): JSX.Element; // Warning: (ae-forgotten-export) The symbol "WarningProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "WarningPanel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "WarningPanel" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public export function WarningPanel(props: WarningProps): JSX.Element; -// Warning: (ae-missing-release-tag) "WarningPanelClassKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "WarningPanelClassKey" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type WarningPanelClassKey = @@ -1530,7 +1530,7 @@ export type WarningPanelClassKey = // // src/components/DependencyGraph/types.d.ts:16:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-components" does not have an export "DependencyNode" // src/components/DependencyGraph/types.d.ts:20:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-components" does not have an export "DependencyNode" -// src/components/TabbedLayout/RoutedTabs.d.ts:9:5 - (ae-forgotten-export) The symbol "SubRoute" needs to be exported by the entry point index.d.ts +// src/components/TabbedLayout/RoutedTabs.d.ts:9:5 - (ae-forgotten-export) The symbol "SubRoute_2" needs to be exported by the entry point index.d.ts // src/components/Table/Table.d.ts:20:5 - (ae-forgotten-export) The symbol "SelectedFilters" needs to be exported by the entry point index.d.ts // src/layout/ErrorBoundary/ErrorBoundary.d.ts:8:5 - (ae-forgotten-export) The symbol "SlackChannel" needs to be exported by the entry point index.d.ts ``` diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 9e844d97c8..10b58c4dad 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -134,7 +134,6 @@ ApiReportGenerator.generateReviewFileContent = ...moreArgs: any[] ) { const program = collector.program as Program; - // The purpose of this override is to allow the @ignore tag to be used to ignore warnings // of the form "Warning: (ae-forgotten-export) The symbol "FooBar" needs to be exported by the entry point index.d.ts" patchFileMessageFetcher( @@ -166,7 +165,16 @@ ApiReportGenerator.generateReviewFileContent = } // The local name of the symbol within the file, rather than the exported name - const localName = (sourceFile as any).identifiers?.get(symbolName); + let localName = (sourceFile as any).identifiers?.get(symbolName); + + if (!localName) { + // Sometimes the symbol name is suffixed with a number to disambiguate, + // e.g. "Props_14" instead of "Props" if there are multiple Props interfaces + // so we tyry to strip that suffix and look up the symbol again. + const [, trimmedSymbolName] = symbolName.match(/(.*)_\d+/) || []; + localName = (sourceFile as any).identifiers?.get(trimmedSymbolName); + } + if (!localName) { throw new Error( `Unable to find local name of "${symbolName}" in ${sourceFile.fileName}`, diff --git a/plugins/catalog-import/api-report.md b/plugins/catalog-import/api-report.md index 90c01255b0..b4c8e854aa 100644 --- a/plugins/catalog-import/api-report.md +++ b/plugins/catalog-import/api-report.md @@ -193,7 +193,7 @@ export interface ImportInfoCardProps { } // Warning: (ae-forgotten-export) The symbol "State" needs to be exported by the entry point index.d.ts -// Warning: (ae-missing-release-tag) "ImportState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "ImportState" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) export type ImportState = State & { @@ -346,7 +346,7 @@ export interface StepPrepareCreatePullRequestProps { notRepeatable?: boolean; }, ) => void; - // Warning: (ae-forgotten-export) The symbol "FormData" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "FormData_2" needs to be exported by the entry point index.d.ts // // (undocumented) renderFormFields: ( From 9a7ceeb774d5739a71887c1296021991dafe186f Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Wed, 28 Dec 2022 10:29:36 +0100 Subject: [PATCH 082/141] remove no longer needed patch Signed-off-by: Juan Pablo Garcia Ripa --- packages/repo-tools/package.json | 1 - .../src/commands/api-reports/api-extractor.ts | 28 +------------------ yarn.lock | 1 - 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 7f0eaa5c6c..6e6b1e92b0 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -53,7 +53,6 @@ "@microsoft/api-extractor-model": "*", "@microsoft/tsdoc": "*", "@microsoft/tsdoc-config": "*", - "@rushstack/node-core-library": "*", "prettier": "^2.8.1", "typescript": "> 3.0.0" }, diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 10b58c4dad..89eeb7454c 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -18,7 +18,6 @@ import { resolve as resolvePath, relative as relativePath, basename, - dirname, join, } from 'path'; import { execFile } from 'child_process'; @@ -70,32 +69,7 @@ const tmpDir = cliPaths.resolveTargetRoot( ); /** - * All of this monkey patching below is because MUI has these bare package.json file as a method - * for making TypeScript accept imports like `@material-ui/core/Button`, and improve tree-shaking - * by declaring them side effect free. - * - * The package.json lookup logic in api-extractor really doesn't like that though, as it enforces - * that the 'name' field exists in all package.json files that it discovers. This below is just - * making sure that we ignore those file package.json files instead of crashing. - */ -const { - PackageJsonLookup, -} = require('@rushstack/node-core-library/lib/PackageJsonLookup'); - -const old = PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor; -PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor = - function tryGetPackageJsonFilePathForPatch(path: string) { - if ( - path.includes('@material-ui') && - !dirname(path).endsWith('@material-ui') - ) { - return undefined; - } - return old.call(this, path); - }; - -/** - * Another monkey patch where we apply prettier to the API reports. This has to be patched into + * All of this monkey patching below is for apply prettier to the API reports. This has to be patched into * the middle of the process as API Extractor does a comparison of the contents of the old * and new files during generation. This inserts the formatting just before that comparison. */ diff --git a/yarn.lock b/yarn.lock index 4282304749..aad88b373f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8459,7 +8459,6 @@ __metadata: "@microsoft/api-extractor-model": "*" "@microsoft/tsdoc": "*" "@microsoft/tsdoc-config": "*" - "@rushstack/node-core-library": "*" prettier: ^2.8.1 typescript: "> 3.0.0" peerDependenciesMeta: From 76fc6f7ec83726ac41e506514db0c9e58a55cbca Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Wed, 28 Dec 2022 11:57:10 +0100 Subject: [PATCH 083/141] add changeset Signed-off-by: Juan Pablo Garcia Ripa --- .changeset/spotty-numbers-dream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spotty-numbers-dream.md diff --git a/.changeset/spotty-numbers-dream.md b/.changeset/spotty-numbers-dream.md new file mode 100644 index 0000000000..a40aa1e781 --- /dev/null +++ b/.changeset/spotty-numbers-dream.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Updates Api-extractor and api-documenter version From 32ab23801d4055926e9f4c107b597b80760ca43f Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Fri, 30 Dec 2022 11:29:38 +0100 Subject: [PATCH 084/141] fix missing exports Signed-off-by: Juan Pablo Garcia Ripa --- .../src/commands/api-reports/api-extractor.ts | 5 +- plugins/git-release-manager/api-report.md | 747 +++++++++++++++++- .../git-release-manager/src/helpers/index.tsx | 1 + plugins/git-release-manager/src/index.ts | 13 + 4 files changed, 758 insertions(+), 8 deletions(-) diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 89eeb7454c..b037f40be6 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -21,7 +21,6 @@ import { join, } from 'path'; import { execFile } from 'child_process'; -import type prettierType from 'prettier'; import fs from 'fs-extra'; import { Extractor, @@ -195,7 +194,7 @@ ApiReportGenerator.generateReviewFileContent = ); try { - const prettier = require('prettier') as typeof prettierType; + const prettier = require('prettier') as typeof import('prettier'); const config = prettier.resolveConfig.sync(cliPaths.targetRoot) ?? {}; return prettier.format(content, { @@ -203,7 +202,6 @@ ApiReportGenerator.generateReviewFileContent = parser: 'markdown', }); } catch (e) { - // console.warn('Failed to format API report with prettier', e); return content; } }; @@ -416,6 +414,7 @@ export async function runApiExtraction({ configObjectFullPath: projectFolder, packageJsonFullPath: resolvePath(projectFolder, 'package.json'), tsdocConfigFile: await getTsDocConfig(), + ignoreMissingEntryPoint: true, }); // The `packageFolder` needs to point to the location within `dist-types` in order for relative diff --git a/plugins/git-release-manager/api-report.md b/plugins/git-release-manager/api-report.md index 96d2948f50..90394afdc7 100644 --- a/plugins/git-release-manager/api-report.md +++ b/plugins/git-release-manager/api-report.md @@ -12,6 +12,240 @@ import { default as React_2 } from 'react'; import { ReactNode } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; +// Warning: (ae-missing-release-tag) "A_CALVER_VERSION" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const A_CALVER_VERSION = '2020.01.01_1'; + +// Warning: (ae-missing-release-tag) "A_SEMVER_VERSION" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const A_SEMVER_VERSION = '1.2.3'; + +// Warning: (ae-missing-release-tag) "AlertError" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface AlertError { + // (undocumented) + subtitle: string; + // (undocumented) + title?: string; +} + +// Warning: (ae-missing-release-tag) "calverRegexp" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const calverRegexp: RegExp; + +// Warning: (ae-missing-release-tag) "CalverTagParts" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +type CalverTagParts = { + prefix: string; + calver: string; + patch: number; +}; + +// Warning: (ae-missing-release-tag) "ComponentConfig" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type ComponentConfig = { + omit?: boolean; + onSuccess?: (args: OnSuccessArgs) => Promise | void; +}; + +declare namespace components { + export { + Differ, + Divider, + InfoCardPlus, + LinearProgressWithLabel, + NoLatestRelease, + ResponseStepDialog, + ResponseStepList, + ResponseStepListItem, + }; +} +export { components }; + +declare namespace constants { + export { + SEMVER_PARTS, + DISABLE_CACHE, + VERSIONING_STRATEGIES, + TAG_OBJECT_MESSAGE, + }; +} +export { constants }; + +// Warning: (ae-forgotten-export) The symbol "GetBranchResult" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "createMockBranch" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +const createMockBranch: ({ + ...rest +}?: Partial) => GetBranchResult['branch']; + +// Warning: (ae-forgotten-export) The symbol "GetCommitResult" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "createMockCommit" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const createMockCommit: ( + overrides: Partial, +) => GetCommitResult; + +// Warning: (ae-forgotten-export) The symbol "GetRecentCommitsResultSingle" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "createMockRecentCommit" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +const createMockRecentCommit: ({ + ...rest +}: Partial) => GetRecentCommitsResultSingle; + +// Warning: (ae-forgotten-export) The symbol "GetLatestReleaseResult" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "createMockRelease" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public +const createMockRelease: ({ + id, + prerelease, + ...rest +}?: Partial< + NonNullable +>) => NonNullable; + +// Warning: (ae-forgotten-export) The symbol "GetTagResult" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "createMockTag" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const createMockTag: (overrides: Partial) => GetTagResult; + +// Warning: (ae-missing-release-tag) "CreateRcOnSuccessArgs" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface CreateRcOnSuccessArgs { + // (undocumented) + comparisonUrl: string; + // (undocumented) + createdTag: string; + // (undocumented) + gitReleaseName: string | null; + // (undocumented) + gitReleaseUrl: string; + // Warning: (ae-forgotten-export) The symbol "UseCreateReleaseCandidate" needs to be exported by the entry point index.d.ts + // + // (undocumented) + input: Omit; + // (undocumented) + previousTag?: string; +} + +// Warning: (ae-forgotten-export) The symbol "DifferProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "Differ" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const Differ: ({ current, next, icon }: DifferProps) => JSX.Element; + +// Warning: (ae-missing-release-tag) "DISABLE_CACHE" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const DISABLE_CACHE: { + readonly headers: { + readonly 'If-None-Match': ''; + }; +}; + +// Warning: (ae-missing-release-tag) "Divider" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const Divider: () => JSX.Element; + +// Warning: (ae-forgotten-export) The symbol "SemverTagParts" needs to be exported by the entry point index.d.ts +// +// @public +function getBumpedSemverTagParts( + tagParts: SemverTagParts, + semverBumpLevel: keyof typeof SEMVER_PARTS, +): { + bumpedTagParts: { + prefix: string; + major: number; + minor: number; + patch: number; + }; +}; + +// @public +function getBumpedTag(options: { + project: Project; + tag: string; + bumpLevel: keyof typeof SEMVER_PARTS; +}): + | { + bumpedTag: string; + tagParts: CalverTagParts; + error: undefined; + } + | { + bumpedTag: string; + tagParts: { + prefix: string; + major: number; + minor: number; + patch: number; + }; + error: undefined; + } + | { + error: AlertError; + }; + +// Warning: (ae-missing-release-tag) "getCalverTagParts" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +function getCalverTagParts(tag: string): + | { + error: AlertError; + tagParts?: undefined; + } + | { + tagParts: CalverTagParts; + error?: undefined; + }; + +// Warning: (ae-missing-release-tag) "getSemverTagParts" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +function getSemverTagParts(tag: string): + | { + error: AlertError; + tagParts?: undefined; + } + | { + tagParts: SemverTagParts; + error?: undefined; + }; + +// Warning: (ae-missing-release-tag) "getShortCommitHash" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +function getShortCommitHash(hash: string): string; + +// @public +function getTagParts(options: { project: Project; tag: string }): + | { + error: AlertError; + tagParts?: undefined; + } + | { + tagParts: CalverTagParts; + error?: undefined; + } + | { + tagParts: SemverTagParts; + error?: undefined; + }; + // Warning: (ae-forgotten-export) The symbol "GitReleaseApi" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "gitReleaseManagerApiRef" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -35,6 +269,27 @@ export const gitReleaseManagerPlugin: BackstagePlugin< {} >; +declare namespace helpers { + export { + calverRegexp, + getCalverTagParts, + CalverTagParts, + getBumpedSemverTagParts, + getBumpedTag, + getSemverTagParts, + semverRegexp, + getShortCommitHash, + getTagParts, + isCalverTagParts, + isProjectValid, + validateTagName, + }; +} +export { helpers }; + +// @public (undocumented) +const InfoCardPlus: (props: { children?: React_2.ReactNode }) => JSX.Element; + // Warning: (ae-missing-release-tag) "internals" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) @@ -45,10 +300,492 @@ export const internals: { testHelpers: typeof testHelpers; }; -// Warnings were encountered during analysis: +// Warning: (ae-missing-release-tag) "isCalverTagParts" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // -// src/index.d.ts:9:5 - (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts -// src/index.d.ts:10:5 - (ae-forgotten-export) The symbol "constants" needs to be exported by the entry point index.d.ts -// src/index.d.ts:11:5 - (ae-forgotten-export) The symbol "helpers" needs to be exported by the entry point index.d.ts -// src/index.d.ts:12:5 - (ae-forgotten-export) The symbol "testHelpers" needs to be exported by the entry point index.d.ts +// @public (undocumented) +function isCalverTagParts( + project: Project, + _tagParts: unknown, +): _tagParts is CalverTagParts; + +// Warning: (ae-missing-release-tag) "isProjectValid" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +function isProjectValid(project: any): project is Project; + +// Warning: (ae-missing-release-tag) "LinearProgressWithLabel" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +function LinearProgressWithLabel(props: { + progress: number; + responseSteps: ResponseStep[]; +}): JSX.Element; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_BRANCH_NAME_CALVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_BRANCH_NAME_CALVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_BRANCH_NAME_SEMVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_BRANCH_NAME_SEMVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_NAME_CALVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_NAME_CALVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_NAME_SEMVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_NAME_SEMVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_VERSION_TAG_NAME_CALVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_VERSION_TAG_NAME_CALVER: string; + +// Warning: (ae-missing-release-tag) "MOCK_RELEASE_VERSION_TAG_NAME_SEMVER" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const MOCK_RELEASE_VERSION_TAG_NAME_SEMVER: string; + +// Warning: (ae-missing-release-tag) "mockBumpedTag" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockBumpedTag = 'rc-2020.01.01_1337'; + +// Warning: (ae-missing-release-tag) "mockCalverProject" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockCalverProject: Project; + +// Warning: (ae-missing-release-tag) "mockCtaMessage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockCtaMessage = 'Patch Release Candidate'; + +// Warning: (ae-missing-release-tag) "mockDefaultBranch" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockDefaultBranch = 'mock_defaultBranch'; + +// Warning: (ae-missing-release-tag) "mockEmail" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockEmail = 'mock_email'; + +// Warning: (ae-forgotten-export) The symbol "getReleaseCandidateGitInfo" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "mockNextGitInfoCalver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockNextGitInfoCalver: ReturnType; + +// Warning: (ae-missing-release-tag) "mockNextGitInfoSemver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockNextGitInfoSemver: ReturnType; + +// Warning: (ae-missing-release-tag) "mockOwner" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockOwner = 'mock_owner'; + +// Warning: (ae-missing-release-tag) "mockReleaseBranch" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockReleaseBranch: { + name: string; + links: { + html: string; + }; + commit: { + sha: string; + commit: { + tree: { + sha: string; + }; + }; + }; +}; + +// Warning: (ae-missing-release-tag) "mockReleaseCandidateCalver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockReleaseCandidateCalver: { + targetCommitish: string; + tagName: string; + prerelease: boolean; + id: number; + htmlUrl: string; + body?: string | null | undefined; +}; + +// Warning: (ae-missing-release-tag) "mockReleaseCandidateSemver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockReleaseCandidateSemver: { + targetCommitish: string; + tagName: string; + prerelease: boolean; + id: number; + htmlUrl: string; + body?: string | null | undefined; +}; + +// Warning: (ae-forgotten-export) The symbol "ReleaseStats" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "mockReleaseStats" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockReleaseStats: ReleaseStats; + +// Warning: (ae-missing-release-tag) "mockReleaseVersionCalver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockReleaseVersionCalver: { + targetCommitish: string; + tagName: string; + prerelease: boolean; + id: number; + htmlUrl: string; + body?: string | null | undefined; +}; + +// Warning: (ae-missing-release-tag) "mockReleaseVersionSemver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockReleaseVersionSemver: { + targetCommitish: string; + tagName: string; + prerelease: boolean; + id: number; + htmlUrl: string; + body?: string | null | undefined; +}; + +// Warning: (ae-missing-release-tag) "mockRepo" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockRepo = 'mock_repo'; + +// Warning: (ae-missing-release-tag) "mockSearchCalver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockSearchCalver: string; + +// Warning: (ae-missing-release-tag) "mockSearchSemver" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockSearchSemver: string; + +// Warning: (ae-missing-release-tag) "mockSelectedPatchCommit" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockSelectedPatchCommit: { + htmlUrl: string; + sha: string; + author: { + htmlUrl?: string | undefined; + login?: string | undefined; + }; + commit: { + message: string; + }; + firstParentSha?: string | undefined; +}; + +// Warning: (ae-missing-release-tag) "mockSemverProject" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockSemverProject: Project; + +// Warning: (ae-missing-release-tag) "mockTagParts" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockTagParts: CalverTagParts; + +// Warning: (ae-missing-release-tag) "mockUser" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockUser: { + username: string; + email: string; +}; + +// Warning: (ae-missing-release-tag) "mockUsername" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const mockUsername = 'mock_username'; + +// Warning: (ae-missing-release-tag) "NoLatestRelease" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const NoLatestRelease: () => JSX.Element; + +// Warning: (ae-missing-release-tag) "PatchOnSuccessArgs" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface PatchOnSuccessArgs { + // Warning: (ae-forgotten-export) The symbol "UsePatch" needs to be exported by the entry point index.d.ts + // + // (undocumented) + input: Omit; + // (undocumented) + patchCommitMessage: string; + // (undocumented) + patchCommitUrl: string; + // (undocumented) + patchedTag: string; + // (undocumented) + previousTag: string; + // (undocumented) + updatedReleaseName: string | null; + // (undocumented) + updatedReleaseUrl: string; +} + +// Warning: (ae-missing-release-tag) "Project" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface Project { + isProvidedViaProps: boolean; + owner: string; + repo: string; + versioningStrategy: keyof typeof VERSIONING_STRATEGIES; +} + +// Warning: (ae-missing-release-tag) "PromoteRcOnSuccessArgs" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface PromoteRcOnSuccessArgs { + // (undocumented) + gitReleaseName: string | null; + // (undocumented) + gitReleaseUrl: string; + // Warning: (ae-forgotten-export) The symbol "UsePromoteRc" needs to be exported by the entry point index.d.ts + // + // (undocumented) + input: Omit; + // (undocumented) + previousTag: string; + // (undocumented) + previousTagUrl: string; + // (undocumented) + updatedTag: string; + // (undocumented) + updatedTagUrl: string; +} + +// Warning: (ae-missing-release-tag) "ResponseStep" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface ResponseStep { + // (undocumented) + icon?: 'success' | 'failure'; + // (undocumented) + link?: string; + // (undocumented) + message: React.ReactNode; + // (undocumented) + secondaryMessage?: string | React.ReactNode; +} + +// Warning: (ae-forgotten-export) The symbol "DialogProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "ResponseStepDialog" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const ResponseStepDialog: ({ + progress, + responseSteps, + title, +}: DialogProps) => JSX.Element; + +// Warning: (ae-forgotten-export) The symbol "ResponseStepListProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "ResponseStepList" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const ResponseStepList: ({ + responseSteps, + animationDelay, + loading, + denseList, + children, +}: PropsWithChildren) => JSX.Element; + +// Warning: (ae-forgotten-export) The symbol "ResponseStepListItemProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-missing-release-tag) "ResponseStepListItem" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const ResponseStepListItem: ({ + responseStep, + animationDelay, +}: ResponseStepListItemProps) => JSX.Element; + +// Warning: (ae-missing-release-tag) "SEMVER_PARTS" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const SEMVER_PARTS: { + major: 'major'; + minor: 'minor'; + patch: 'patch'; +}; + +// Warning: (ae-missing-release-tag) "semverRegexp" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const semverRegexp: RegExp; + +declare namespace stats { + export { mockReleaseStats }; +} + +// Warning: (ae-missing-release-tag) "TAG_OBJECT_MESSAGE" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const TAG_OBJECT_MESSAGE = + 'Tag generated by your friendly neighborhood Backstage Release Manager'; + +// Warning: (ae-missing-release-tag) "TEST_IDS" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const TEST_IDS: { + info: { + info: string; + infoFeaturePlus: string; + }; + createRc: { + cta: string; + semverSelect: string; + }; + promoteRc: { + mockedPromoteRcBody: string; + notRcWarning: string; + promoteRc: string; + cta: string; + }; + patch: { + error: string; + loading: string; + notPrerelease: string; + body: string; + }; + form: { + owner: { + loading: string; + select: string; + error: string; + empty: string; + }; + repo: { + loading: string; + select: string; + error: string; + empty: string; + }; + versioningStrategy: { + radioGroup: string; + }; + }; + components: { + divider: string; + noLatestRelease: string; + circularProgress: string; + responseStepListDialogContent: string; + responseStepListItem: string; + responseStepListItemIconSuccess: string; + responseStepListItemIconFailure: string; + responseStepListItemIconLink: string; + responseStepListItemIconDefault: string; + differ: { + current: string; + next: string; + icons: { + tag: string; + branch: string; + github: string; + slack: string; + versioning: string; + }; + }; + linearProgressWithLabel: string; + }; +}; + +declare namespace testHelpers { + export { stats, testHelpers_2 as testHelpers, testIds }; +} +export { testHelpers }; + +declare namespace testHelpers_2 { + export { + mockUsername, + mockEmail, + mockOwner, + mockRepo, + A_CALVER_VERSION, + MOCK_RELEASE_NAME_CALVER, + MOCK_RELEASE_BRANCH_NAME_CALVER, + MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, + MOCK_RELEASE_VERSION_TAG_NAME_CALVER, + A_SEMVER_VERSION, + MOCK_RELEASE_NAME_SEMVER, + MOCK_RELEASE_BRANCH_NAME_SEMVER, + MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER, + MOCK_RELEASE_VERSION_TAG_NAME_SEMVER, + createMockTag, + createMockCommit, + mockUser, + mockSemverProject, + mockCalverProject, + mockSearchCalver, + mockSearchSemver, + mockDefaultBranch, + mockNextGitInfoSemver, + mockNextGitInfoCalver, + mockTagParts, + mockCtaMessage, + mockBumpedTag, + createMockRelease, + mockReleaseCandidateCalver, + mockReleaseVersionCalver, + mockReleaseCandidateSemver, + mockReleaseVersionSemver, + createMockBranch, + mockReleaseBranch, + createMockRecentCommit, + mockSelectedPatchCommit, + }; +} + +declare namespace testIds { + export { TEST_IDS }; +} + +// @public (undocumented) +const validateTagName: (options: { project: Project; tagName?: string }) => + | { + tagNameError: null; + } + | { + tagNameError: AlertError | undefined; + }; + +// Warning: (ae-missing-release-tag) "VERSIONING_STRATEGIES" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +const VERSIONING_STRATEGIES: { + semver: 'semver'; + calver: 'calver'; +}; ``` diff --git a/plugins/git-release-manager/src/helpers/index.tsx b/plugins/git-release-manager/src/helpers/index.tsx index 1516e192a1..6589596114 100644 --- a/plugins/git-release-manager/src/helpers/index.tsx +++ b/plugins/git-release-manager/src/helpers/index.tsx @@ -15,6 +15,7 @@ */ export { calverRegexp, getCalverTagParts } from './tagParts/getCalverTagParts'; +export type { CalverTagParts } from './tagParts/getCalverTagParts'; export { getBumpedSemverTagParts, getBumpedTag } from './getBumpedTag'; export { getSemverTagParts, semverRegexp } from './tagParts/getSemverTagParts'; export { getShortCommitHash } from './getShortCommitHash'; diff --git a/plugins/git-release-manager/src/index.ts b/plugins/git-release-manager/src/index.ts index ac6b294cbc..7b0949a3f8 100644 --- a/plugins/git-release-manager/src/index.ts +++ b/plugins/git-release-manager/src/index.ts @@ -34,3 +34,16 @@ export const internals = { helpers, testHelpers, }; + +export { components, constants, helpers, testHelpers }; + +export type { + ComponentConfig, + CreateRcOnSuccessArgs, + PatchOnSuccessArgs, + PromoteRcOnSuccessArgs, + ResponseStep, + AlertError, +} from './types/types'; + +export type { Project } from './contexts/ProjectContext'; From 802434162067de36b18854b2e206b0c9afe00f0a Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Fri, 30 Dec 2022 13:52:54 +0100 Subject: [PATCH 085/141] add changeset Signed-off-by: Juan Pablo Garcia Ripa --- .changeset/eighty-forks-pull.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/eighty-forks-pull.md diff --git a/.changeset/eighty-forks-pull.md b/.changeset/eighty-forks-pull.md new file mode 100644 index 0000000000..f5bf555317 --- /dev/null +++ b/.changeset/eighty-forks-pull.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-git-release-manager': patch +--- + +add exports to clear api-report messages From 21ffbdd5ee383809192b73e49a53674dff1c1d54 Mon Sep 17 00:00:00 2001 From: Phil Kuang Date: Fri, 30 Dec 2022 13:57:29 -0500 Subject: [PATCH 086/141] docs(adrs): note default support for MADR 2.x Signed-off-by: Phil Kuang --- .changeset/long-owls-raise.md | 6 ++++++ plugins/adr-backend/README.md | 2 +- plugins/adr/README.md | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/long-owls-raise.md diff --git a/.changeset/long-owls-raise.md b/.changeset/long-owls-raise.md new file mode 100644 index 0000000000..9021e4031a --- /dev/null +++ b/.changeset/long-owls-raise.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-adr-backend': patch +'@backstage/plugin-adr': patch +--- + +Clarify that default ADR parsers support MADR specification v2.x diff --git a/plugins/adr-backend/README.md b/plugins/adr-backend/README.md index 79b5fe13ed..dc48fba90e 100644 --- a/plugins/adr-backend/README.md +++ b/plugins/adr-backend/README.md @@ -35,7 +35,7 @@ indexBuilder.addCollator({ ### Parsing custom ADR document formats -By default, the `DefaultAdrCollatorFactory` will parse and index documents that follow the [MADR](https://adr.github.io/madr/) standard file name and template format. If you use a different ADR format and file name convention, you can configure `DefaultAdrCollatorFactory` with custom `adrFilePathFilterFn` and `parser` options (see type definitions for details): +By default, the `DefaultAdrCollatorFactory` will parse and index documents that follow the [MADR v2.x standard file name and template format](https://github.com/adr/madr/tree/2.1.2). If you use a different ADR format and file name convention, you can configure `DefaultAdrCollatorFactory` with custom `adrFilePathFilterFn` and `parser` options (see type definitions for details): ```ts DefaultAdrCollatorFactory.fromConfig({ diff --git a/plugins/adr/README.md b/plugins/adr/README.md index 2888ff2f07..d0faef75b6 100644 --- a/plugins/adr/README.md +++ b/plugins/adr/README.md @@ -79,7 +79,7 @@ case 'adr': ## Custom ADR formats -By default, this plugin will parse ADRs according to the format specified by the [Markdown Architecture Decision Record (MADR)](https://adr.github.io/madr/) template. If your ADRs are written using a different format, you can apply the following customizations to correctly identify and parse your documents: +By default, this plugin will parse ADRs according to the format specified by the [Markdown Architecture Decision Record (MADR) v2.x template](https://github.com/adr/madr/tree/2.1.2). If your ADRs are written using a different format, you can apply the following customizations to correctly identify and parse your documents: ### Custom Filename/Path Format From 412411d4802bbfa7e9b42d3f0567da24de68de76 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Jan 2023 10:32:12 +0000 Subject: [PATCH 087/141] fix(deps): update dependency @react-hookz/web to v20.1.0 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6f4f0b06b4..0606f66ee9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12702,8 +12702,8 @@ __metadata: linkType: hard "@react-hookz/web@npm:^20.0.0": - version: 20.0.3 - resolution: "@react-hookz/web@npm:20.0.3" + version: 20.1.0 + resolution: "@react-hookz/web@npm:20.1.0" dependencies: "@react-hookz/deep-equal": ^1.0.4 peerDependencies: @@ -12713,7 +12713,7 @@ __metadata: peerDependenciesMeta: js-cookie: optional: true - checksum: b4942f422fc36c93138b9735ee9ef768214f9f32fca73e4b3d545e490bd043e92f2ee0ce65c0ffc57f7c47a8cec9742e6f80e9e06bf875a805ba606dffa06f3d + checksum: bb393f892c2c81deff37d5f18faf8ec17431a24994d72d88ec390dcc1579b27318a7c8c6260070c87b66e8c635e4daec4436c33abf2622f842d1567235ed457d languageName: node linkType: hard From 7b407b303b83d28e9973c58dad618cfa36357d50 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Thu, 29 Dec 2022 15:59:26 -0800 Subject: [PATCH 088/141] Use both variables in cli's "base url conflict" error message `appBaseUrl` was specified twice - which _is_ fine, because the two values were already proven equal - but it took me until writing this commit message to realize that it isn't a bug. So, I'd advocate for this change as "ease of understanding" improvement :) Signed-off-by: Mitchell Hentges --- .changeset/forty-mangos-fail.md | 5 +++++ packages/cli/src/commands/start/startFrontend.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/forty-mangos-fail.md diff --git a/.changeset/forty-mangos-fail.md b/.changeset/forty-mangos-fail.md new file mode 100644 index 0000000000..d86d9c0e56 --- /dev/null +++ b/.changeset/forty-mangos-fail.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Slightly improve readability of "base URL conflict" error handling code diff --git a/packages/cli/src/commands/start/startFrontend.ts b/packages/cli/src/commands/start/startFrontend.ts index b7b81e6bff..991439c010 100644 --- a/packages/cli/src/commands/start/startFrontend.ts +++ b/packages/cli/src/commands/start/startFrontend.ts @@ -80,7 +80,7 @@ export async function startFrontend(options: StartAppOptions) { `⚠️ Conflict between app baseUrl and backend baseUrl: app.baseUrl: ${appBaseUrl} - backend.baseUrl: ${appBaseUrl} + backend.baseUrl: ${backendBaseUrl} Must have unique hostname and/or ports. From bdc49a2ab831707280ffae299993f99f251f27c0 Mon Sep 17 00:00:00 2001 From: Juan Pablo Garcia Ripa Date: Mon, 2 Jan 2023 17:05:53 +0100 Subject: [PATCH 089/141] add internals export file Signed-off-by: Juan Pablo Garcia Ripa --- plugins/git-release-manager/api-report.md | 17 ++++------------- plugins/git-release-manager/src/index.ts | 11 ++--------- plugins/git-release-manager/src/internals.ts | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 plugins/git-release-manager/src/internals.ts diff --git a/plugins/git-release-manager/api-report.md b/plugins/git-release-manager/api-report.md index 90394afdc7..edc2e56ad9 100644 --- a/plugins/git-release-manager/api-report.md +++ b/plugins/git-release-manager/api-report.md @@ -66,7 +66,6 @@ declare namespace components { ResponseStepListItem, }; } -export { components }; declare namespace constants { export { @@ -76,7 +75,6 @@ declare namespace constants { TAG_OBJECT_MESSAGE, }; } -export { constants }; // Warning: (ae-forgotten-export) The symbol "GetBranchResult" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "createMockBranch" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -285,20 +283,14 @@ declare namespace helpers { validateTagName, }; } -export { helpers }; // @public (undocumented) const InfoCardPlus: (props: { children?: React_2.ReactNode }) => JSX.Element; -// Warning: (ae-missing-release-tag) "internals" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const internals: { - components: typeof components; - constants: typeof constants; - helpers: typeof helpers; - testHelpers: typeof testHelpers; -}; +declare namespace internals { + export { components, constants, helpers, testHelpers }; +} +export { internals }; // Warning: (ae-missing-release-tag) "isCalverTagParts" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -725,7 +717,6 @@ const TEST_IDS: { declare namespace testHelpers { export { stats, testHelpers_2 as testHelpers, testIds }; } -export { testHelpers }; declare namespace testHelpers_2 { export { diff --git a/plugins/git-release-manager/src/index.ts b/plugins/git-release-manager/src/index.ts index 7b0949a3f8..e8fa661c21 100644 --- a/plugins/git-release-manager/src/index.ts +++ b/plugins/git-release-manager/src/index.ts @@ -26,16 +26,9 @@ export { gitReleaseManagerApiRef, } from './plugin'; -import { components, constants, helpers, testHelpers } from './plugin'; +import * as internals from './internals'; -export const internals = { - components, - constants, - helpers, - testHelpers, -}; - -export { components, constants, helpers, testHelpers }; +export { internals }; export type { ComponentConfig, diff --git a/plugins/git-release-manager/src/internals.ts b/plugins/git-release-manager/src/internals.ts new file mode 100644 index 0000000000..2cd7863bac --- /dev/null +++ b/plugins/git-release-manager/src/internals.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export { components, constants, helpers, testHelpers } from './plugin'; From e8d636eb4b64c83958576c9ef33b87bd0f82bd2c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Jan 2023 16:42:28 +0000 Subject: [PATCH 090/141] fix(deps): update dependency immer to v9.0.17 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6f4f0b06b4..83d7adc129 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24890,9 +24890,9 @@ __metadata: linkType: hard "immer@npm:^9.0.1, immer@npm:^9.0.7": - version: 9.0.16 - resolution: "immer@npm:9.0.16" - checksum: e9a5ca65c929b329da7a3b7beccf7984271cda7bdd47b2cab619eac3277dcd56598c211b55cc340786b6eff0c06652ac018808d9fd744443f06882364dece6bc + version: 9.0.17 + resolution: "immer@npm:9.0.17" + checksum: 046d562b74f050632d2861042dbcad49a5e86ffe5bb9b8bff6e699b1c7d8478019d9a3be61e72117cecc29826d2caa4fa927a7e10262381144dd33c735b9531c languageName: node linkType: hard From 147b03f03b9f9fbaf4e05b4e60bc30e84d5a3fac Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 13:12:03 +0000 Subject: [PATCH 091/141] chore(deps): update dependency esbuild to v0.16.13 Signed-off-by: Renovate Bot --- yarn.lock | 182 +++++++++++++++++++++++++++--------------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6c4b3dd051..b9e2f1e40d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9065,9 +9065,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/android-arm64@npm:0.16.12" +"@esbuild/android-arm64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/android-arm64@npm:0.16.13" conditions: os=android & cpu=arm64 languageName: node linkType: hard @@ -9079,65 +9079,65 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/android-arm@npm:0.16.12" +"@esbuild/android-arm@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/android-arm@npm:0.16.13" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/android-x64@npm:0.16.12" +"@esbuild/android-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/android-x64@npm:0.16.13" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/darwin-arm64@npm:0.16.12" +"@esbuild/darwin-arm64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/darwin-arm64@npm:0.16.13" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/darwin-x64@npm:0.16.12" +"@esbuild/darwin-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/darwin-x64@npm:0.16.13" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/freebsd-arm64@npm:0.16.12" +"@esbuild/freebsd-arm64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/freebsd-arm64@npm:0.16.13" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/freebsd-x64@npm:0.16.12" +"@esbuild/freebsd-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/freebsd-x64@npm:0.16.13" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-arm64@npm:0.16.12" +"@esbuild/linux-arm64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-arm64@npm:0.16.13" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-arm@npm:0.16.12" +"@esbuild/linux-arm@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-arm@npm:0.16.13" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-ia32@npm:0.16.12" +"@esbuild/linux-ia32@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-ia32@npm:0.16.13" conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -9149,86 +9149,86 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-loong64@npm:0.16.12" +"@esbuild/linux-loong64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-loong64@npm:0.16.13" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-mips64el@npm:0.16.12" +"@esbuild/linux-mips64el@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-mips64el@npm:0.16.13" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-ppc64@npm:0.16.12" +"@esbuild/linux-ppc64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-ppc64@npm:0.16.13" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-riscv64@npm:0.16.12" +"@esbuild/linux-riscv64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-riscv64@npm:0.16.13" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-s390x@npm:0.16.12" +"@esbuild/linux-s390x@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-s390x@npm:0.16.13" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/linux-x64@npm:0.16.12" +"@esbuild/linux-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/linux-x64@npm:0.16.13" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/netbsd-x64@npm:0.16.12" +"@esbuild/netbsd-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/netbsd-x64@npm:0.16.13" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/openbsd-x64@npm:0.16.12" +"@esbuild/openbsd-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/openbsd-x64@npm:0.16.13" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/sunos-x64@npm:0.16.12" +"@esbuild/sunos-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/sunos-x64@npm:0.16.13" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/win32-arm64@npm:0.16.12" +"@esbuild/win32-arm64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/win32-arm64@npm:0.16.13" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/win32-ia32@npm:0.16.12" +"@esbuild/win32-ia32@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/win32-ia32@npm:0.16.13" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.16.12": - version: 0.16.12 - resolution: "@esbuild/win32-x64@npm:0.16.12" +"@esbuild/win32-x64@npm:0.16.13": + version: 0.16.13 + resolution: "@esbuild/win32-x64@npm:0.16.13" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -21579,31 +21579,31 @@ __metadata: linkType: hard "esbuild@npm:^0.16.0": - version: 0.16.12 - resolution: "esbuild@npm:0.16.12" + version: 0.16.13 + resolution: "esbuild@npm:0.16.13" dependencies: - "@esbuild/android-arm": 0.16.12 - "@esbuild/android-arm64": 0.16.12 - "@esbuild/android-x64": 0.16.12 - "@esbuild/darwin-arm64": 0.16.12 - "@esbuild/darwin-x64": 0.16.12 - "@esbuild/freebsd-arm64": 0.16.12 - "@esbuild/freebsd-x64": 0.16.12 - "@esbuild/linux-arm": 0.16.12 - "@esbuild/linux-arm64": 0.16.12 - "@esbuild/linux-ia32": 0.16.12 - "@esbuild/linux-loong64": 0.16.12 - "@esbuild/linux-mips64el": 0.16.12 - "@esbuild/linux-ppc64": 0.16.12 - "@esbuild/linux-riscv64": 0.16.12 - "@esbuild/linux-s390x": 0.16.12 - "@esbuild/linux-x64": 0.16.12 - "@esbuild/netbsd-x64": 0.16.12 - "@esbuild/openbsd-x64": 0.16.12 - "@esbuild/sunos-x64": 0.16.12 - "@esbuild/win32-arm64": 0.16.12 - "@esbuild/win32-ia32": 0.16.12 - "@esbuild/win32-x64": 0.16.12 + "@esbuild/android-arm": 0.16.13 + "@esbuild/android-arm64": 0.16.13 + "@esbuild/android-x64": 0.16.13 + "@esbuild/darwin-arm64": 0.16.13 + "@esbuild/darwin-x64": 0.16.13 + "@esbuild/freebsd-arm64": 0.16.13 + "@esbuild/freebsd-x64": 0.16.13 + "@esbuild/linux-arm": 0.16.13 + "@esbuild/linux-arm64": 0.16.13 + "@esbuild/linux-ia32": 0.16.13 + "@esbuild/linux-loong64": 0.16.13 + "@esbuild/linux-mips64el": 0.16.13 + "@esbuild/linux-ppc64": 0.16.13 + "@esbuild/linux-riscv64": 0.16.13 + "@esbuild/linux-s390x": 0.16.13 + "@esbuild/linux-x64": 0.16.13 + "@esbuild/netbsd-x64": 0.16.13 + "@esbuild/openbsd-x64": 0.16.13 + "@esbuild/sunos-x64": 0.16.13 + "@esbuild/win32-arm64": 0.16.13 + "@esbuild/win32-ia32": 0.16.13 + "@esbuild/win32-x64": 0.16.13 dependenciesMeta: "@esbuild/android-arm": optional: true @@ -21651,7 +21651,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 608faf85bcc6d970e4a3261c2a15dfe7e72b850a9115e90b22f2ab89b4adb2a9e281ef3dec8450ae4c4a5c4fab192b0e6cda468f08390e59bc230b7a5e5f5b5c + checksum: dd78945c45ab70d59a1933374ea3403d942165d34fabbf4f75c315761c31e86599c8c41f8da253499f0fe3a7d023f7602e1d51eb8e764056e588c1069c7b3104 languageName: node linkType: hard From 30caac0eb35c4903ae58d2391724d408e31e008b Mon Sep 17 00:00:00 2001 From: Robert Bunning Date: Tue, 3 Jan 2023 11:51:10 -0500 Subject: [PATCH 092/141] Remove unneeded read method in mocked UrlReader Signed-off-by: Robert Bunning --- plugins/adr-backend/src/service/router.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/adr-backend/src/service/router.test.ts b/plugins/adr-backend/src/service/router.test.ts index 74955fcc6a..fbbd6e8532 100644 --- a/plugins/adr-backend/src/service/router.test.ts +++ b/plugins/adr-backend/src/service/router.test.ts @@ -59,9 +59,6 @@ const testFileTwoContent = 'testFileTwo content'; const genericFileContent = 'file content'; const mockUrlReader: UrlReader = { - read() { - throw new Error('read not implemented.'); - }, readUrl(url: string) { switch (url) { case 'testFileOne': From 2fadff2a2575483ebcee80804fcfe504c8fb5d10 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 3 Jan 2023 21:37:03 +0000 Subject: [PATCH 093/141] allow task action descriptions to use markdown This allows richer explanations for the behaviour of actions in the actions documentation page. Signed-off-by: Brian Fletcher --- .changeset/fair-falcons-lie.md | 5 +++++ .changeset/few-penguins-admire.md | 6 ++++++ .../src/actions/fetch/rails/index.ts | 2 +- .../src/scaffolder/actions/builtin/fetch/plain.ts | 2 +- .../src/scaffolder/actions/builtin/fetch/template.ts | 2 +- .../scaffolder/src/components/ActionsPage/ActionsPage.tsx | 3 ++- 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .changeset/fair-falcons-lie.md create mode 100644 .changeset/few-penguins-admire.md diff --git a/.changeset/fair-falcons-lie.md b/.changeset/fair-falcons-lie.md new file mode 100644 index 0000000000..ba39d51241 --- /dev/null +++ b/.changeset/fair-falcons-lie.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Render the scaffolder action description using the `MarkdownContent` component. This will allow the page to show richer content to describe scaffolder actions. diff --git a/.changeset/few-penguins-admire.md b/.changeset/few-penguins-admire.md new file mode 100644 index 0000000000..170b4aa606 --- /dev/null +++ b/.changeset/few-penguins-admire.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-scaffolder-backend-module-rails': patch +'@backstage/plugin-scaffolder-backend': patch +--- + +Change scaffolder task actions to include markdown to demonstrate the new `ActionsPage` markdown feature. diff --git a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts index 49b7ac100b..7a77470e9b 100644 --- a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts @@ -54,7 +54,7 @@ export function createFetchRailsAction(options: { }>({ id: 'fetch:rails', description: - 'Downloads a template from the given URL into the workspace, and runs a rails new generator on it.', + 'Downloads a template from the given `url` into the workspace, and runs a rails new generator on it.', schema: { input: { type: 'object', diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts index 9dc82068c0..b3b984f544 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts @@ -33,7 +33,7 @@ export function createFetchPlainAction(options: { return createTemplateAction<{ url: string; targetPath?: string }>({ id: 'fetch:plain', description: - "Downloads content and places it in the workspace, or optionally in a subdirectory specified by the 'targetPath' input option.", + 'Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.', schema: { input: { type: 'object', diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts index d71997d496..10a9d0c055 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts @@ -65,7 +65,7 @@ export function createFetchTemplateAction(options: { }>({ id: 'fetch:template', description: - "Downloads a skeleton, templates variables into file and directory names and content, and places the result in the workspace, or optionally in a subdirectory specified by the 'targetPath' input option.", + 'Downloads a skeleton, templates variables into file and directory names and content, and places the result in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.', schema: { input: { type: 'object', diff --git a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx index 29951d7cb1..1fca434a96 100644 --- a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx +++ b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx @@ -39,6 +39,7 @@ import { Header, Page, ErrorPage, + MarkdownContent, } from '@backstage/core-components'; const useStyles = makeStyles(theme => ({ @@ -166,7 +167,7 @@ export const ActionsPage = () => { {action.id} - {action.description} + {action.description && } {action.schema?.input && ( Input From 5ae544ff649b44bac65077016c1d35ddffa94394 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 00:33:53 +0000 Subject: [PATCH 094/141] chore(deps): update dependency husky to v8.0.3 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index d9c4a82362..6b30f742d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24849,11 +24849,11 @@ __metadata: linkType: hard "husky@npm:^8.0.0": - version: 8.0.2 - resolution: "husky@npm:8.0.2" + version: 8.0.3 + resolution: "husky@npm:8.0.3" bin: husky: lib/bin.js - checksum: e101656fcb56163d610488f186448c78b132626aa427094489d886ce9374955a90274912b0f3a34af3326eaa74977883b032e5f701d7aaf4554daa5a7931be43 + checksum: 837bc7e4413e58c1f2946d38fb050f5d7324c6f16b0fd66411ffce5703b294bd21429e8ba58711cd331951ee86ed529c5be4f76805959ff668a337dbfa82a1b0 languageName: node linkType: hard From 51f21c0318b63e1b563237b50d0d368be02ed6fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 00:38:51 +0000 Subject: [PATCH 095/141] build(deps): bump json5 from 1.0.1 to 1.0.2 in /microsite Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- microsite/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/microsite/yarn.lock b/microsite/yarn.lock index e86a400340..3bc81619e3 100644 --- a/microsite/yarn.lock +++ b/microsite/yarn.lock @@ -5506,13 +5506,13 @@ __metadata: linkType: hard "json5@npm:^1.0.1": - version: 1.0.1 - resolution: "json5@npm:1.0.1" + version: 1.0.2 + resolution: "json5@npm:1.0.2" dependencies: minimist: ^1.2.0 bin: json5: lib/cli.js - checksum: e76ea23dbb8fc1348c143da628134a98adf4c5a4e8ea2adaa74a80c455fc2cdf0e2e13e6398ef819bfe92306b610ebb2002668ed9fc1af386d593691ef346fc3 + checksum: 866458a8c58a95a49bef3adba929c625e82532bcff1fe93f01d29cb02cac7c3fe1f4b79951b7792c2da9de0b32871a8401a6e3c5b36778ad852bf5b8a61165d7 languageName: node linkType: hard From 3e41e8a3f9fe2aab1b09a02681953c92e0333d8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 00:40:08 +0000 Subject: [PATCH 096/141] build(deps): bump json5 from 1.0.1 to 1.0.2 in /storybook Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/json5/json5/releases) - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md) - [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2) --- updated-dependencies: - dependency-name: json5 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- storybook/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storybook/yarn.lock b/storybook/yarn.lock index 2d785e97be..42c2bf1ad0 100644 --- a/storybook/yarn.lock +++ b/storybook/yarn.lock @@ -7598,13 +7598,13 @@ __metadata: linkType: hard "json5@npm:^1.0.1": - version: 1.0.1 - resolution: "json5@npm:1.0.1" + version: 1.0.2 + resolution: "json5@npm:1.0.2" dependencies: minimist: ^1.2.0 bin: json5: lib/cli.js - checksum: e76ea23dbb8fc1348c143da628134a98adf4c5a4e8ea2adaa74a80c455fc2cdf0e2e13e6398ef819bfe92306b610ebb2002668ed9fc1af386d593691ef346fc3 + checksum: 866458a8c58a95a49bef3adba929c625e82532bcff1fe93f01d29cb02cac7c3fe1f4b79951b7792c2da9de0b32871a8401a6e3c5b36778ad852bf5b8a61165d7 languageName: node linkType: hard From 91f956d7916ce86d5253c8b31767f5d02f6e486b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 02:01:25 +0000 Subject: [PATCH 097/141] fix(deps): update dependency ajv to v8.12.0 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6b30f742d1..41202619bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16401,14 +16401,14 @@ __metadata: linkType: hard "ajv@npm:^8.0.0, ajv@npm:^8.10.0, ajv@npm:^8.8.0": - version: 8.11.2 - resolution: "ajv@npm:8.11.2" + version: 8.12.0 + resolution: "ajv@npm:8.12.0" dependencies: fast-deep-equal: ^3.1.1 json-schema-traverse: ^1.0.0 require-from-string: ^2.0.2 uri-js: ^4.2.2 - checksum: 53435bf79ee7d1eabba8085962dba4c08d08593334b304db7772887f0b7beebc1b3d957432f7437ed4b60e53b5d966a57b439869890209c50fed610459999e3e + checksum: 4dc13714e316e67537c8b31bc063f99a1d9d9a497eb4bbd55191ac0dcd5e4985bbb71570352ad6f1e76684fb6d790928f96ba3b2d4fd6e10024be9612fe3f001 languageName: node linkType: hard From 23072102a2859f33f31304c987b0b50be4b6248e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 29 Dec 2022 14:40:01 +0100 Subject: [PATCH 098/141] backend-plugin-api: add RootHttpRouterService definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: blam Co-authored-by: Johan Haals Signed-off-by: Patrik Oldsberg --- packages/backend-plugin-api/api-report.md | 6 ++++ .../definitions/RootHttpRouterService.ts | 28 +++++++++++++++++++ .../src/services/definitions/coreServices.ts | 9 ++++++ .../src/services/definitions/index.ts | 1 + 4 files changed, 44 insertions(+) create mode 100644 packages/backend-plugin-api/src/services/definitions/RootHttpRouterService.ts diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index 9c6ffe6dd5..165f5dc738 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -82,6 +82,7 @@ export namespace coreServices { const logger: ServiceRef; const permissions: ServiceRef; const pluginMetadata: ServiceRef; + const rootHttpRouter: ServiceRef; const rootLifecycle: ServiceRef; const rootLogger: ServiceRef; const scheduler: ServiceRef; @@ -265,6 +266,11 @@ export type ReadUrlResponse = { etag?: string; }; +// @public (undocumented) +export interface RootHttpRouterService { + use(path: string, handler: Handler): void; +} + // @public (undocumented) export interface RootLifecycleService extends LifecycleService {} diff --git a/packages/backend-plugin-api/src/services/definitions/RootHttpRouterService.ts b/packages/backend-plugin-api/src/services/definitions/RootHttpRouterService.ts new file mode 100644 index 0000000000..e583e978fa --- /dev/null +++ b/packages/backend-plugin-api/src/services/definitions/RootHttpRouterService.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Handler } from 'express'; + +/** + * @public + */ +export interface RootHttpRouterService { + /** + * Registers a handler at the root of the backend router. + * The path is required and may not be empty. + */ + use(path: string, handler: Handler): void; +} diff --git a/packages/backend-plugin-api/src/services/definitions/coreServices.ts b/packages/backend-plugin-api/src/services/definitions/coreServices.ts index fc96ec8be9..7de92d6d01 100644 --- a/packages/backend-plugin-api/src/services/definitions/coreServices.ts +++ b/packages/backend-plugin-api/src/services/definitions/coreServices.ts @@ -103,6 +103,15 @@ export namespace coreServices { import('./PluginMetadataService').PluginMetadataService >({ id: 'core.pluginMetadata' }); + /** + * The service reference for the root scoped {@link RootHttpRouterService}. + * + * @public + */ + export const rootHttpRouter = createServiceRef< + import('./RootHttpRouterService').RootHttpRouterService + >({ id: 'core.rootHttpRouter', scope: 'root' }); + /** * The service reference for the root scoped {@link RootLifecycleService}. * diff --git a/packages/backend-plugin-api/src/services/definitions/index.ts b/packages/backend-plugin-api/src/services/definitions/index.ts index dedfd6223e..82b16efda2 100644 --- a/packages/backend-plugin-api/src/services/definitions/index.ts +++ b/packages/backend-plugin-api/src/services/definitions/index.ts @@ -27,6 +27,7 @@ export type { export type { LoggerService, LogMeta } from './LoggerService'; export type { PermissionsService } from './PermissionsService'; export type { PluginMetadataService } from './PluginMetadataService'; +export type { RootHttpRouterService } from './RootHttpRouterService'; export type { RootLifecycleService } from './RootLifecycleService'; export type { RootLoggerService } from './RootLoggerService'; export type { SchedulerService } from './SchedulerService'; From a083d5d38ac27d626ead0bacb0c0b561790a0947 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 29 Dec 2022 15:43:47 +0100 Subject: [PATCH 099/141] backend-app-api: add root http router service + adapt http router service Co-authored-by: blam Signed-off-by: Patrik Oldsberg --- packages/backend-app-api/api-report.md | 15 ++- .../implementations/httpRouterService.ts | 30 ++---- .../src/services/implementations/index.ts | 2 + .../rootHttpRouterService.test.ts | 31 ++++++ .../implementations/rootHttpRouterService.ts | 102 ++++++++++++++++++ 5 files changed, 156 insertions(+), 24 deletions(-) create mode 100644 packages/backend-app-api/src/services/implementations/rootHttpRouterService.test.ts create mode 100644 packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts diff --git a/packages/backend-app-api/api-report.md b/packages/backend-app-api/api-report.md index fa3f3bec2e..d7150fc9e8 100644 --- a/packages/backend-app-api/api-report.md +++ b/packages/backend-app-api/api-report.md @@ -8,11 +8,13 @@ import { CacheService } from '@backstage/backend-plugin-api'; import { ConfigService } from '@backstage/backend-plugin-api'; import { DatabaseService } from '@backstage/backend-plugin-api'; import { ExtensionPoint } from '@backstage/backend-plugin-api'; +import { Handler } from 'express'; import { HttpRouterService } from '@backstage/backend-plugin-api'; import { LifecycleService } from '@backstage/backend-plugin-api'; import { LoggerService } from '@backstage/backend-plugin-api'; import { PermissionsService } from '@backstage/backend-plugin-api'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; +import { RootHttpRouterService } from '@backstage/backend-plugin-api'; import { RootLifecycleService } from '@backstage/backend-plugin-api'; import { RootLoggerService } from '@backstage/backend-plugin-api'; import { SchedulerService } from '@backstage/backend-plugin-api'; @@ -69,7 +71,7 @@ export const httpRouterFactory: ( // @public (undocumented) export type HttpRouterFactoryOptions = { - indexPlugin?: string; + pathPrefix?: string; }; // @public @@ -87,6 +89,17 @@ export const permissionsFactory: ( options?: undefined, ) => ServiceFactory; +// @public (undocumented) +export const rootHttpRouterFactory: ( + options?: RootHttpRouterFactoryOptions | undefined, +) => ServiceFactory; + +// @public (undocumented) +export type RootHttpRouterFactoryOptions = { + indexPath?: string | false; + middleware?: Handler[]; +}; + // @public export const rootLifecycleFactory: ( options?: undefined, diff --git a/packages/backend-app-api/src/services/implementations/httpRouterService.ts b/packages/backend-app-api/src/services/implementations/httpRouterService.ts index 2021589a50..78d04c988a 100644 --- a/packages/backend-app-api/src/services/implementations/httpRouterService.ts +++ b/packages/backend-app-api/src/services/implementations/httpRouterService.ts @@ -18,49 +18,33 @@ import { createServiceFactory, coreServices, } from '@backstage/backend-plugin-api'; -import Router from 'express-promise-router'; import { Handler } from 'express'; -import { createServiceBuilder } from '@backstage/backend-common'; /** * @public */ export type HttpRouterFactoryOptions = { /** - * The plugin ID used for the index route. Defaults to 'app' + * The path prefix used for each plugin, defaults to `/api/`. */ - indexPlugin?: string; + pathPrefix?: string; }; /** @public */ export const httpRouterFactory = createServiceFactory({ service: coreServices.httpRouter, deps: { - config: coreServices.config, plugin: coreServices.pluginMetadata, + rootHttpRouter: coreServices.rootHttpRouter, }, - async factory({ config }, options?: HttpRouterFactoryOptions) { - const defaultPluginId = options?.indexPlugin ?? 'app'; - - const apiRouter = Router(); - const rootRouter = Router(); - - const service = createServiceBuilder(module) - .loadConfig(config) - .addRouter('/api', apiRouter) - .addRouter('', rootRouter); - - await service.start(); + async factory({ rootHttpRouter }, options?: HttpRouterFactoryOptions) { + const pathPrefix = options?.pathPrefix ?? '/api/'; return async ({ plugin }) => { - const pluginId = plugin.getId(); + const path = pathPrefix + plugin.getId(); return { use(handler: Handler) { - if (pluginId === defaultPluginId) { - rootRouter.use(handler); - } else { - apiRouter.use(`/${pluginId}`, handler); - } + rootHttpRouter.use(path, handler); }, }; }; diff --git a/packages/backend-app-api/src/services/implementations/index.ts b/packages/backend-app-api/src/services/implementations/index.ts index c87011d570..2365ff36f4 100644 --- a/packages/backend-app-api/src/services/implementations/index.ts +++ b/packages/backend-app-api/src/services/implementations/index.ts @@ -25,6 +25,8 @@ export { schedulerFactory } from './schedulerService'; export { tokenManagerFactory } from './tokenManagerService'; export { urlReaderFactory } from './urlReaderService'; export { httpRouterFactory } from './httpRouterService'; +export { rootHttpRouterFactory } from './rootHttpRouterService'; export { lifecycleFactory } from './lifecycleService'; export { rootLifecycleFactory } from './rootLifecycleService'; export type { HttpRouterFactoryOptions } from './httpRouterService'; +export type { RootHttpRouterFactoryOptions } from './rootHttpRouterService'; diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.test.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.test.ts new file mode 100644 index 0000000000..fea99b0df9 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.test.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { findConflictingPath } from './rootHttpRouterService'; + +describe('findConflictingPath', () => { + it('finds conflicts when present', () => { + expect(findConflictingPath(['/a'], '/a')).toBe('/a'); + expect(findConflictingPath(['/b'], '/a')).toBe(undefined); + expect(findConflictingPath(['/a'], '/a/b')).toBe('/a'); + expect(findConflictingPath(['/a'], '/aa/b')).toBe(undefined); + expect(findConflictingPath(['/aa'], '/a/b')).toBe(undefined); + expect(findConflictingPath(['/a/b'], '/a')).toBe('/a/b'); + expect(findConflictingPath(['/a/b'], '/aa')).toBe(undefined); + expect(findConflictingPath(['/b/a'], '/a')).toBe(undefined); + expect(findConflictingPath(['/a'], '/aa')).toBe(undefined); + }); +}); diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts new file mode 100644 index 0000000000..19108a00d9 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts @@ -0,0 +1,102 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + createServiceFactory, + coreServices, +} from '@backstage/backend-plugin-api'; +import Router from 'express-promise-router'; +import { Handler } from 'express'; +import { createServiceBuilder } from '@backstage/backend-common'; + +/** + * @public + */ +export type RootHttpRouterFactoryOptions = { + /** + * The path to forward all unmatched requests to. Defaults to '/api/app' + */ + indexPath?: string | false; + + /** + * Middlewares that are added before all other routes. + */ + middleware?: Handler[]; +}; + +/** @public */ +export const rootHttpRouterFactory = createServiceFactory({ + service: coreServices.rootHttpRouter, + deps: { + config: coreServices.config, + }, + async factory({ config }, options?: RootHttpRouterFactoryOptions) { + const indexPath = options?.indexPath ?? '/api/app'; + + const namedRouter = Router(); + const indexRouter = Router(); + + const service = createServiceBuilder(module).loadConfig(config); + + for (const middleware of options?.middleware ?? []) { + service.addRouter('', middleware); + } + + service.addRouter('', namedRouter).addRouter('', indexRouter); + + await service.start(); + + const existingPaths = new Array(); + + return { + use: (path: string, handler: Handler) => { + const conflictingPath = findConflictingPath(existingPaths, path); + if (conflictingPath) { + throw new Error( + `Path ${path} conflicts with the existing path ${conflictingPath}`, + ); + } + existingPaths.push(path); + namedRouter.use(path, handler); + + if (indexPath === path) { + indexRouter.use(handler); + } + }, + }; + }, +}); + +function normalizePath(path: string): string { + return path.replace(/\/*$/, '/'); +} + +export function findConflictingPath( + paths: string[], + newPath: string, +): string | undefined { + const normalizedNewPath = normalizePath(newPath); + for (const path of paths) { + const normalizedPath = normalizePath(path); + if (normalizedPath.startsWith(normalizedNewPath)) { + return path; + } + if (normalizedNewPath.startsWith(normalizedPath)) { + return path; + } + } + return undefined; +} From 3cf507490315ac16ea78775a93663b7845742a7c Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 29 Dec 2022 15:48:07 +0100 Subject: [PATCH 100/141] backend-defaults: add root http router Co-authored-by: blam Signed-off-by: Patrik Oldsberg --- packages/backend-defaults/src/CreateBackend.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/backend-defaults/src/CreateBackend.ts b/packages/backend-defaults/src/CreateBackend.ts index a37a8c32b2..20edfc85a8 100644 --- a/packages/backend-defaults/src/CreateBackend.ts +++ b/packages/backend-defaults/src/CreateBackend.ts @@ -22,6 +22,7 @@ import { databaseFactory, discoveryFactory, httpRouterFactory, + rootHttpRouterFactory, lifecycleFactory, rootLifecycleFactory, loggerFactory, @@ -45,6 +46,7 @@ export const defaultServiceFactories = [ tokenManagerFactory, urlReaderFactory, httpRouterFactory, + rootHttpRouterFactory, lifecycleFactory, rootLifecycleFactory, ]; From 02b119ff9333c2050589c355798afb3f4fcf49ed Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 29 Dec 2022 15:53:23 +0100 Subject: [PATCH 101/141] changesets: added changesets for the new root http router service Co-authored-by: blam Signed-off-by: Patrik Oldsberg --- .changeset/fair-ants-work.md | 7 +++++++ .changeset/gorgeous-days-applaud.md | 5 +++++ .changeset/tiny-cooks-hide.md | 5 +++++ .../src/services/implementations/rootHttpRouterService.ts | 3 +++ 4 files changed, 20 insertions(+) create mode 100644 .changeset/fair-ants-work.md create mode 100644 .changeset/gorgeous-days-applaud.md create mode 100644 .changeset/tiny-cooks-hide.md diff --git a/.changeset/fair-ants-work.md b/.changeset/fair-ants-work.md new file mode 100644 index 0000000000..ac3a105d52 --- /dev/null +++ b/.changeset/fair-ants-work.md @@ -0,0 +1,7 @@ +--- +'@backstage/backend-app-api': minor +--- + +**BREAKING**: The `httpRouterFactory` now accepts a `pathPrefix` option rather than `indexPlugin`. To set up custom index path, configure the new `rootHttpRouterFactory` with a custom `indexPath` instead. + +Added an implementation for the new `rootHttpRouterServiceRef`. diff --git a/.changeset/gorgeous-days-applaud.md b/.changeset/gorgeous-days-applaud.md new file mode 100644 index 0000000000..a34307d720 --- /dev/null +++ b/.changeset/gorgeous-days-applaud.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-plugin-api': patch +--- + +Added a new `rootHttpRouterServiceRef` and `RootHttpRouterService` interface. diff --git a/.changeset/tiny-cooks-hide.md b/.changeset/tiny-cooks-hide.md new file mode 100644 index 0000000000..feab4b65d2 --- /dev/null +++ b/.changeset/tiny-cooks-hide.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-defaults': patch +--- + +The new root HTTP router service is now installed by default. diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts index 19108a00d9..d1c8643244 100644 --- a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts @@ -63,6 +63,9 @@ export const rootHttpRouterFactory = createServiceFactory({ return { use: (path: string, handler: Handler) => { + if (path.match(/^[/\s]*$/)) { + throw new Error(`Root router path may not be empty`); + } const conflictingPath = findConflictingPath(existingPaths, path); if (conflictingPath) { throw new Error( From 6518fbb3c851e7ab1d26bd9ab1af449d06b8533e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 30 Dec 2022 10:53:06 +0100 Subject: [PATCH 102/141] backend-app-api: add missing @types/express dep Signed-off-by: Patrik Oldsberg --- packages/backend-app-api/package.json | 3 ++- yarn.lock | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend-app-api/package.json b/packages/backend-app-api/package.json index 93230341df..abbcdf4201 100644 --- a/packages/backend-app-api/package.json +++ b/packages/backend-app-api/package.json @@ -43,7 +43,8 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "workspace:^" + "@backstage/cli": "workspace:^", + "@types/express": "^4.17.6" }, "files": [ "dist", diff --git a/yarn.lock b/yarn.lock index 41202619bc..ad653b416a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3382,6 +3382,7 @@ __metadata: "@backstage/cli": "workspace:^" "@backstage/errors": "workspace:^" "@backstage/plugin-permission-node": "workspace:^" + "@types/express": ^4.17.6 express: ^4.17.1 express-promise-router: ^4.1.0 winston: ^3.2.1 From a3ec2f32ea439c43532121b5d0b35588fab49985 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 30 Dec 2022 10:54:14 +0100 Subject: [PATCH 103/141] backend-test-utils: include all core services in test backend Signed-off-by: Patrik Oldsberg --- .changeset/little-beans-hammer.md | 5 ++++ .../src/next/wiring/TestBackend.ts | 26 ++++++++++++++++--- .../app-backend/src/service/appPlugin.test.ts | 10 ------- 3 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 .changeset/little-beans-hammer.md diff --git a/.changeset/little-beans-hammer.md b/.changeset/little-beans-hammer.md new file mode 100644 index 0000000000..d998f5f5ba --- /dev/null +++ b/.changeset/little-beans-hammer.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-test-utils': patch +--- + +The `startTestBackend` setup now includes default implementations for all core services. diff --git a/packages/backend-test-utils/src/next/wiring/TestBackend.ts b/packages/backend-test-utils/src/next/wiring/TestBackend.ts index 647ebc9dda..f21cad6049 100644 --- a/packages/backend-test-utils/src/next/wiring/TestBackend.ts +++ b/packages/backend-test-utils/src/next/wiring/TestBackend.ts @@ -17,10 +17,20 @@ import { Backend, createSpecializedBackend, + cacheFactory, + configFactory, + databaseFactory, + discoveryFactory, + httpRouterFactory, lifecycleFactory, - rootLifecycleFactory, loggerFactory, + permissionsFactory, + rootHttpRouterFactory, + rootLifecycleFactory, rootLoggerFactory, + schedulerFactory, + tokenManagerFactory, + urlReaderFactory, } from '@backstage/backend-app-api'; import { ServiceFactory, @@ -55,10 +65,20 @@ export interface TestBackendOptions< } const defaultServiceFactories = [ - rootLoggerFactory(), - loggerFactory(), + cacheFactory(), + configFactory(), + databaseFactory(), + discoveryFactory(), + httpRouterFactory(), lifecycleFactory(), + loggerFactory(), + permissionsFactory(), + rootHttpRouterFactory(), rootLifecycleFactory(), + rootLoggerFactory(), + schedulerFactory(), + tokenManagerFactory(), + urlReaderFactory(), ]; const backendInstancesToCleanUp = new Array(); diff --git a/plugins/app-backend/src/service/appPlugin.test.ts b/plugins/app-backend/src/service/appPlugin.test.ts index 14921622c9..d911919425 100644 --- a/plugins/app-backend/src/service/appPlugin.test.ts +++ b/plugins/app-backend/src/service/appPlugin.test.ts @@ -20,12 +20,6 @@ import fetch from 'node-fetch'; import { coreServices } from '@backstage/backend-plugin-api'; import { startTestBackend } from '@backstage/backend-test-utils'; import { appPlugin } from './appPlugin'; -import { - databaseFactory, - httpRouterFactory, - loggerFactory, - rootLoggerFactory, -} from '@backstage/backend-app-api'; import { ConfigReader } from '@backstage/config'; import getPort from 'get-port'; @@ -59,10 +53,6 @@ describe('appPlugin', () => { }, }), ], - loggerFactory(), - rootLoggerFactory(), - databaseFactory(), - httpRouterFactory(), ], features: [ appPlugin({ From 6cf3090427e1938df6f25dedff63ce0ef53f520c Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 2 Jan 2023 14:50:18 +0100 Subject: [PATCH 104/141] backend-app-api: move @types/express to deps Signed-off-by: Patrik Oldsberg --- packages/backend-app-api/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend-app-api/package.json b/packages/backend-app-api/package.json index abbcdf4201..80598ec93d 100644 --- a/packages/backend-app-api/package.json +++ b/packages/backend-app-api/package.json @@ -38,13 +38,13 @@ "@backstage/backend-tasks": "workspace:^", "@backstage/errors": "workspace:^", "@backstage/plugin-permission-node": "workspace:^", + "@types/express": "^4.17.6", "express": "^4.17.1", "express-promise-router": "^4.1.0", "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "workspace:^", - "@types/express": "^4.17.6" + "@backstage/cli": "workspace:^" }, "files": [ "dist", From bd195c5c772ac1ee8df85f48f81cd7bc856ba0c6 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 2 Jan 2023 15:57:20 +0100 Subject: [PATCH 105/141] backend-app-api: use root lifecycle service to shut down root http service Signed-off-by: Patrik Oldsberg --- .../implementations/rootHttpRouterService.ts | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts index d1c8643244..dae7474793 100644 --- a/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts +++ b/packages/backend-app-api/src/services/implementations/rootHttpRouterService.ts @@ -42,8 +42,9 @@ export const rootHttpRouterFactory = createServiceFactory({ service: coreServices.rootHttpRouter, deps: { config: coreServices.config, + lifecycle: coreServices.rootLifecycle, }, - async factory({ config }, options?: RootHttpRouterFactoryOptions) { + async factory({ config, lifecycle }, options?: RootHttpRouterFactoryOptions) { const indexPath = options?.indexPath ?? '/api/app'; const namedRouter = Router(); @@ -57,7 +58,26 @@ export const rootHttpRouterFactory = createServiceFactory({ service.addRouter('', namedRouter).addRouter('', indexRouter); - await service.start(); + const server = await service.start(); + // Stop method isn't part of the public API, let's fix that once we move the implementation here. + const stoppableServer = server as typeof server & { + stop: (cb: (error?: Error) => void) => void; + }; + + lifecycle.addShutdownHook({ + async fn() { + await new Promise((resolve, reject) => { + stoppableServer.stop((error?: Error) => { + if (error) { + reject(error); + } else { + resolve(); + } + }); + }); + }, + labels: { service: 'rootHttpRouter' }, + }); const existingPaths = new Array(); From d677dcf59d4a224d004bce4b948d00f12bd2a02a Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 2 Jan 2023 16:25:26 +0100 Subject: [PATCH 106/141] backend-test-utils: use empty config instead of trying to load Signed-off-by: Patrik Oldsberg --- .../backend-test-utils/src/next/wiring/TestBackend.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/backend-test-utils/src/next/wiring/TestBackend.ts b/packages/backend-test-utils/src/next/wiring/TestBackend.ts index f21cad6049..ea7b492543 100644 --- a/packages/backend-test-utils/src/next/wiring/TestBackend.ts +++ b/packages/backend-test-utils/src/next/wiring/TestBackend.ts @@ -18,7 +18,6 @@ import { Backend, createSpecializedBackend, cacheFactory, - configFactory, databaseFactory, discoveryFactory, httpRouterFactory, @@ -38,7 +37,9 @@ import { createServiceFactory, BackendFeature, ExtensionPoint, + coreServices, } from '@backstage/backend-plugin-api'; +import { ConfigReader } from '@backstage/config'; /** @alpha */ export interface TestBackendOptions< @@ -65,8 +66,12 @@ export interface TestBackendOptions< } const defaultServiceFactories = [ + createServiceFactory({ + service: coreServices.config, + deps: {}, + factory: async () => new ConfigReader({}, 'test'), + })(), cacheFactory(), - configFactory(), databaseFactory(), discoveryFactory(), httpRouterFactory(), From eaa705f754ee7e75382fa518f7c0242cfd29368a Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 2 Jan 2023 16:47:58 +0100 Subject: [PATCH 107/141] backend-test-utils: roll back default factories change Signed-off-by: Patrik Oldsberg --- .../src/next/wiring/TestBackend.ts | 33 +++---------------- .../app-backend/src/service/appPlugin.test.ts | 12 +++++++ 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/packages/backend-test-utils/src/next/wiring/TestBackend.ts b/packages/backend-test-utils/src/next/wiring/TestBackend.ts index ea7b492543..647ebc9dda 100644 --- a/packages/backend-test-utils/src/next/wiring/TestBackend.ts +++ b/packages/backend-test-utils/src/next/wiring/TestBackend.ts @@ -17,19 +17,10 @@ import { Backend, createSpecializedBackend, - cacheFactory, - databaseFactory, - discoveryFactory, - httpRouterFactory, lifecycleFactory, - loggerFactory, - permissionsFactory, - rootHttpRouterFactory, rootLifecycleFactory, + loggerFactory, rootLoggerFactory, - schedulerFactory, - tokenManagerFactory, - urlReaderFactory, } from '@backstage/backend-app-api'; import { ServiceFactory, @@ -37,9 +28,7 @@ import { createServiceFactory, BackendFeature, ExtensionPoint, - coreServices, } from '@backstage/backend-plugin-api'; -import { ConfigReader } from '@backstage/config'; /** @alpha */ export interface TestBackendOptions< @@ -66,24 +55,10 @@ export interface TestBackendOptions< } const defaultServiceFactories = [ - createServiceFactory({ - service: coreServices.config, - deps: {}, - factory: async () => new ConfigReader({}, 'test'), - })(), - cacheFactory(), - databaseFactory(), - discoveryFactory(), - httpRouterFactory(), - lifecycleFactory(), - loggerFactory(), - permissionsFactory(), - rootHttpRouterFactory(), - rootLifecycleFactory(), rootLoggerFactory(), - schedulerFactory(), - tokenManagerFactory(), - urlReaderFactory(), + loggerFactory(), + lifecycleFactory(), + rootLifecycleFactory(), ]; const backendInstancesToCleanUp = new Array(); diff --git a/plugins/app-backend/src/service/appPlugin.test.ts b/plugins/app-backend/src/service/appPlugin.test.ts index d911919425..80408694d6 100644 --- a/plugins/app-backend/src/service/appPlugin.test.ts +++ b/plugins/app-backend/src/service/appPlugin.test.ts @@ -20,6 +20,13 @@ import fetch from 'node-fetch'; import { coreServices } from '@backstage/backend-plugin-api'; import { startTestBackend } from '@backstage/backend-test-utils'; import { appPlugin } from './appPlugin'; +import { + databaseFactory, + httpRouterFactory, + rootHttpRouterFactory, + loggerFactory, + rootLoggerFactory, +} from '@backstage/backend-app-api'; import { ConfigReader } from '@backstage/config'; import getPort from 'get-port'; @@ -53,6 +60,11 @@ describe('appPlugin', () => { }, }), ], + loggerFactory(), + rootLoggerFactory(), + databaseFactory(), + httpRouterFactory(), + rootHttpRouterFactory(), ], features: [ appPlugin({ From 0d5c70d1f69a875fb6aedd6c5e489eaf82fc1eaf Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 3 Jan 2023 10:16:56 +0100 Subject: [PATCH 108/141] backend-app-api: switch out http router pathPrefix option for getPath + tests Signed-off-by: Patrik Oldsberg --- .changeset/fair-ants-work.md | 2 +- packages/backend-app-api/api-report.md | 2 +- .../implementations/httpRouterService.test.ts | 70 +++++++++++++++++++ .../implementations/httpRouterService.ts | 8 +-- 4 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 packages/backend-app-api/src/services/implementations/httpRouterService.test.ts diff --git a/.changeset/fair-ants-work.md b/.changeset/fair-ants-work.md index ac3a105d52..4cf3c80488 100644 --- a/.changeset/fair-ants-work.md +++ b/.changeset/fair-ants-work.md @@ -2,6 +2,6 @@ '@backstage/backend-app-api': minor --- -**BREAKING**: The `httpRouterFactory` now accepts a `pathPrefix` option rather than `indexPlugin`. To set up custom index path, configure the new `rootHttpRouterFactory` with a custom `indexPath` instead. +**BREAKING**: The `httpRouterFactory` now accepts a `getPath` option rather than `indexPlugin`. To set up custom index path, configure the new `rootHttpRouterFactory` with a custom `indexPath` instead. Added an implementation for the new `rootHttpRouterServiceRef`. diff --git a/packages/backend-app-api/api-report.md b/packages/backend-app-api/api-report.md index d7150fc9e8..dcf3ced5e8 100644 --- a/packages/backend-app-api/api-report.md +++ b/packages/backend-app-api/api-report.md @@ -71,7 +71,7 @@ export const httpRouterFactory: ( // @public (undocumented) export type HttpRouterFactoryOptions = { - pathPrefix?: string; + getPath(pluginId: string): string; }; // @public diff --git a/packages/backend-app-api/src/services/implementations/httpRouterService.test.ts b/packages/backend-app-api/src/services/implementations/httpRouterService.test.ts new file mode 100644 index 0000000000..89f6db2ac8 --- /dev/null +++ b/packages/backend-app-api/src/services/implementations/httpRouterService.test.ts @@ -0,0 +1,70 @@ +/* + * Copyright 2022 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + HttpRouterService, + ServiceFactory, +} from '@backstage/backend-plugin-api'; +import { httpRouterFactory } from './httpRouterService'; + +describe('httpRouterFactory', () => { + it('should register plugin paths', async () => { + const rootHttpRouter = { use: jest.fn() }; + const factory = httpRouterFactory() as Exclude< + ServiceFactory, + { scope: 'root' } + >; + const innerFactory = await factory.factory({ rootHttpRouter }); + + const handler1 = () => {}; + const router1 = await innerFactory({ plugin: { getId: () => 'test1' } }); + router1.use(handler1); + expect(rootHttpRouter.use).toHaveBeenCalledTimes(1); + expect(rootHttpRouter.use).toHaveBeenCalledWith('/api/test1', handler1); + + const handler2 = () => {}; + const router2 = await innerFactory({ plugin: { getId: () => 'test2' } }); + router2.use(handler2); + expect(rootHttpRouter.use).toHaveBeenCalledTimes(2); + expect(rootHttpRouter.use).toHaveBeenCalledWith('/api/test2', handler2); + }); + + it('should use custom path generator', async () => { + const rootHttpRouter = { use: jest.fn() }; + const factory = httpRouterFactory({ + getPath: id => `/some/${id}/path`, + }) as Exclude, { scope: 'root' }>; + const innerFactory = await factory.factory({ rootHttpRouter }); + + const handler1 = () => {}; + const router1 = await innerFactory({ plugin: { getId: () => 'test1' } }); + router1.use(handler1); + expect(rootHttpRouter.use).toHaveBeenCalledTimes(1); + expect(rootHttpRouter.use).toHaveBeenCalledWith( + '/some/test1/path', + handler1, + ); + + const handler2 = () => {}; + const router2 = await innerFactory({ plugin: { getId: () => 'test2' } }); + router2.use(handler2); + expect(rootHttpRouter.use).toHaveBeenCalledTimes(2); + expect(rootHttpRouter.use).toHaveBeenCalledWith( + '/some/test2/path', + handler2, + ); + }); +}); diff --git a/packages/backend-app-api/src/services/implementations/httpRouterService.ts b/packages/backend-app-api/src/services/implementations/httpRouterService.ts index 78d04c988a..f1fc089ea3 100644 --- a/packages/backend-app-api/src/services/implementations/httpRouterService.ts +++ b/packages/backend-app-api/src/services/implementations/httpRouterService.ts @@ -25,9 +25,9 @@ import { Handler } from 'express'; */ export type HttpRouterFactoryOptions = { /** - * The path prefix used for each plugin, defaults to `/api/`. + * A callback used to generate the path for each plugin, defaults to `/api/{pluginId}`. */ - pathPrefix?: string; + getPath(pluginId: string): string; }; /** @public */ @@ -38,10 +38,10 @@ export const httpRouterFactory = createServiceFactory({ rootHttpRouter: coreServices.rootHttpRouter, }, async factory({ rootHttpRouter }, options?: HttpRouterFactoryOptions) { - const pathPrefix = options?.pathPrefix ?? '/api/'; + const getPath = options?.getPath ?? (id => `/api/${id}`); return async ({ plugin }) => { - const path = pathPrefix + plugin.getId(); + const path = getPath(plugin.getId()); return { use(handler: Handler) { rootHttpRouter.use(path, handler); From 8e06f3cf00a22759b9802fc56db8677fb3b25931 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 3 Jan 2023 15:43:07 +0100 Subject: [PATCH 109/141] backend-plugin-api: moved loggerToWinstonLogger to backend-common Signed-off-by: Patrik Oldsberg --- .changeset/few-mice-study.md | 5 +++++ .changeset/poor-crews-battle.md | 5 +++++ .changeset/ten-peas-grab.md | 19 +++++++++++++++++++ .../services/implementations/configService.ts | 6 ++++-- .../implementations/rootLifecycleService.ts | 2 +- .../implementations/tokenManagerService.ts | 6 ++++-- .../implementations/urlReaderService.ts | 3 +-- packages/backend-common/api-report.md | 8 ++++++++ packages/backend-common/package.json | 1 + packages/backend-common/src/logging/index.ts | 1 + .../src/logging}/loggerToWinstonLogger.ts | 2 +- packages/backend-plugin-api/api-report.md | 8 -------- packages/backend-plugin-api/package.json | 4 +--- .../src/services/helpers/index.ts | 17 ----------------- .../backend-plugin-api/src/services/index.ts | 1 - plugins/app-backend/src/service/appPlugin.ts | 2 +- .../AwsS3EntityProviderCatalogModule.ts | 2 +- .../AzureDevOpsEntityProviderCatalogModule.ts | 2 +- ...tbucketCloudEntityProviderCatalogModule.ts | 2 +- ...bucketServerEntityProviderCatalogModule.ts | 2 +- .../GerritEntityProviderCatalogModule.ts | 2 +- .../GithubEntityProviderCatalogModule.ts | 2 +- ...labDiscoveryEntityProviderCatalogModule.ts | 2 +- .../src/module/WrapperProviders.ts | 2 +- .../package.json | 1 + ...softGraphOrgEntityProviderCatalogModule.ts | 2 +- .../src/service/CatalogPlugin.ts | 2 +- .../package.json | 1 + ...sSqsConsumingEventPublisherEventsModule.ts | 2 +- .../src/service/EventsPlugin.ts | 2 +- .../src/ScaffolderPlugin.ts | 2 +- yarn.lock | 3 +-- 32 files changed, 68 insertions(+), 53 deletions(-) create mode 100644 .changeset/few-mice-study.md create mode 100644 .changeset/poor-crews-battle.md create mode 100644 .changeset/ten-peas-grab.md rename packages/{backend-plugin-api/src/services/helpers => backend-common/src/logging}/loggerToWinstonLogger.ts (96%) delete mode 100644 packages/backend-plugin-api/src/services/helpers/index.ts diff --git a/.changeset/few-mice-study.md b/.changeset/few-mice-study.md new file mode 100644 index 0000000000..57a89cc547 --- /dev/null +++ b/.changeset/few-mice-study.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-common': patch +--- + +Added `loggerToWinstonLogger`, which was moved from `@backstage/backend-plugin-api`. diff --git a/.changeset/poor-crews-battle.md b/.changeset/poor-crews-battle.md new file mode 100644 index 0000000000..e05391ef5e --- /dev/null +++ b/.changeset/poor-crews-battle.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-plugin-api': minor +--- + +Moved `loggerToWinstonLogger` to `@backstage/backend-common`. diff --git a/.changeset/ten-peas-grab.md b/.changeset/ten-peas-grab.md new file mode 100644 index 0000000000..c3022bb627 --- /dev/null +++ b/.changeset/ten-peas-grab.md @@ -0,0 +1,19 @@ +--- +'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch +'@backstage/plugin-catalog-backend-module-bitbucket-server': patch +'@backstage/plugin-catalog-backend-module-bitbucket-cloud': patch +'@backstage/plugin-catalog-backend-module-msgraph': patch +'@backstage/plugin-catalog-backend-module-gerrit': patch +'@backstage/plugin-catalog-backend-module-github': patch +'@backstage/plugin-catalog-backend-module-gitlab': patch +'@backstage/plugin-events-backend-module-aws-sqs': patch +'@backstage/plugin-catalog-backend-module-azure': patch +'@backstage/plugin-catalog-backend-module-aws': patch +'@backstage/plugin-scaffolder-backend': patch +'@backstage/backend-app-api': patch +'@backstage/plugin-catalog-backend': patch +'@backstage/plugin-events-backend': patch +'@backstage/plugin-app-backend': patch +--- + +Switched imports of `loggerToWinstonLogger` to `@backstage/backend-common`. diff --git a/packages/backend-app-api/src/services/implementations/configService.ts b/packages/backend-app-api/src/services/implementations/configService.ts index f58a756c64..6bb84aa5a1 100644 --- a/packages/backend-app-api/src/services/implementations/configService.ts +++ b/packages/backend-app-api/src/services/implementations/configService.ts @@ -14,11 +14,13 @@ * limitations under the License. */ -import { loadBackendConfig } from '@backstage/backend-common'; +import { + loadBackendConfig, + loggerToWinstonLogger, +} from '@backstage/backend-common'; import { coreServices, createServiceFactory, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; /** @public */ diff --git a/packages/backend-app-api/src/services/implementations/rootLifecycleService.ts b/packages/backend-app-api/src/services/implementations/rootLifecycleService.ts index c4ad4678ba..3797e6ffc5 100644 --- a/packages/backend-app-api/src/services/implementations/rootLifecycleService.ts +++ b/packages/backend-app-api/src/services/implementations/rootLifecycleService.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { createServiceFactory, coreServices, - loggerToWinstonLogger, LifecycleServiceShutdownHook, RootLifecycleService, } from '@backstage/backend-plugin-api'; diff --git a/packages/backend-app-api/src/services/implementations/tokenManagerService.ts b/packages/backend-app-api/src/services/implementations/tokenManagerService.ts index 6a2d47ae14..025830afc7 100644 --- a/packages/backend-app-api/src/services/implementations/tokenManagerService.ts +++ b/packages/backend-app-api/src/services/implementations/tokenManagerService.ts @@ -17,9 +17,11 @@ import { coreServices, createServiceFactory, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; -import { ServerTokenManager } from '@backstage/backend-common'; +import { + loggerToWinstonLogger, + ServerTokenManager, +} from '@backstage/backend-common'; /** @public */ export const tokenManagerFactory = createServiceFactory({ diff --git a/packages/backend-app-api/src/services/implementations/urlReaderService.ts b/packages/backend-app-api/src/services/implementations/urlReaderService.ts index b68be74d8c..758b555d66 100644 --- a/packages/backend-app-api/src/services/implementations/urlReaderService.ts +++ b/packages/backend-app-api/src/services/implementations/urlReaderService.ts @@ -14,11 +14,10 @@ * limitations under the License. */ -import { UrlReaders } from '@backstage/backend-common'; +import { loggerToWinstonLogger, UrlReaders } from '@backstage/backend-common'; import { coreServices, createServiceFactory, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; /** @public */ diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index e8b41e21bb..7e81d40394 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -29,6 +29,7 @@ import { Knex } from 'knex'; import { KubeConfig } from '@kubernetes/client-node'; import { LoadConfigOptionsRemote } from '@backstage/config-loader'; import { Logger } from 'winston'; +import { LoggerService } from '@backstage/backend-plugin-api'; import { MergeResult } from 'isomorphic-git'; import { DiscoveryService as PluginEndpointDiscovery } from '@backstage/backend-plugin-api'; import { PushResult } from 'isomorphic-git'; @@ -46,6 +47,7 @@ import { SearchOptions } from '@backstage/backend-plugin-api'; import { SearchResponse } from '@backstage/backend-plugin-api'; import { SearchResponseFile } from '@backstage/backend-plugin-api'; import { Server } from 'http'; +import { TransportStreamOptions } from 'winston-transport'; import { UrlReaderService as UrlReader } from '@backstage/backend-plugin-api'; import { V1PodTemplateSpec } from '@kubernetes/client-node'; import * as winston from 'winston'; @@ -515,6 +517,12 @@ export function loadBackendConfig(options: { argv: string[]; }): Promise; +// @public (undocumented) +export function loggerToWinstonLogger( + logger: LoggerService, + opts?: TransportStreamOptions, +): Logger; + // @public export function notFoundHandler(): RequestHandler; diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index fc131723a7..cb3f4776ae 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -83,6 +83,7 @@ "tar": "^6.1.12", "uuid": "^8.3.2", "winston": "^3.2.1", + "winston-transport": "^4.5.0", "yauzl": "^2.10.0", "yn": "^4.0.0" }, diff --git a/packages/backend-common/src/logging/index.ts b/packages/backend-common/src/logging/index.ts index 4657dd4101..ff2315c51b 100644 --- a/packages/backend-common/src/logging/index.ts +++ b/packages/backend-common/src/logging/index.ts @@ -22,3 +22,4 @@ export { redactWinstonLogLine, } from './rootLogger'; export * from './voidLogger'; +export { loggerToWinstonLogger } from './loggerToWinstonLogger'; diff --git a/packages/backend-plugin-api/src/services/helpers/loggerToWinstonLogger.ts b/packages/backend-common/src/logging/loggerToWinstonLogger.ts similarity index 96% rename from packages/backend-plugin-api/src/services/helpers/loggerToWinstonLogger.ts rename to packages/backend-common/src/logging/loggerToWinstonLogger.ts index 6f435a250a..f15bd5be81 100644 --- a/packages/backend-plugin-api/src/services/helpers/loggerToWinstonLogger.ts +++ b/packages/backend-common/src/logging/loggerToWinstonLogger.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { LoggerService } from '../definitions'; +import { LoggerService } from '@backstage/backend-plugin-api'; import { Logger as WinstonLogger, createLogger } from 'winston'; import Transport, { TransportStreamOptions } from 'winston-transport'; diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index 9c6ffe6dd5..16f00ad89f 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -7,14 +7,12 @@ import { Config } from '@backstage/config'; import { Handler } from 'express'; -import { Logger } from 'winston'; import { PermissionEvaluator } from '@backstage/plugin-permission-common'; import { PluginCacheManager } from '@backstage/backend-common'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginTaskScheduler } from '@backstage/backend-tasks'; import { Readable } from 'stream'; import { TokenManager } from '@backstage/backend-common'; -import { TransportStreamOptions } from 'winston-transport'; // @public (undocumented) export interface BackendFeature { @@ -201,12 +199,6 @@ export interface LoggerService { warn(message: string, meta?: Error | LogMeta): void; } -// @public (undocumented) -export function loggerToWinstonLogger( - logger: LoggerService, - opts?: TransportStreamOptions, -): Logger; - // @public (undocumented) export type LogMeta = { [name: string]: unknown; diff --git a/packages/backend-plugin-api/package.json b/packages/backend-plugin-api/package.json index 732cfa3858..0719ea8f45 100644 --- a/packages/backend-plugin-api/package.json +++ b/packages/backend-plugin-api/package.json @@ -38,9 +38,7 @@ "@backstage/config": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", "@types/express": "^4.17.6", - "express": "^4.17.1", - "winston": "^3.2.1", - "winston-transport": "^4.5.0" + "express": "^4.17.1" }, "devDependencies": { "@backstage/cli": "workspace:^" diff --git a/packages/backend-plugin-api/src/services/helpers/index.ts b/packages/backend-plugin-api/src/services/helpers/index.ts deleted file mode 100644 index 24336c1af2..0000000000 --- a/packages/backend-plugin-api/src/services/helpers/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2022 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 { loggerToWinstonLogger } from './loggerToWinstonLogger'; diff --git a/packages/backend-plugin-api/src/services/index.ts b/packages/backend-plugin-api/src/services/index.ts index 96bd3d320a..dd24127b88 100644 --- a/packages/backend-plugin-api/src/services/index.ts +++ b/packages/backend-plugin-api/src/services/index.ts @@ -15,5 +15,4 @@ */ export * from './definitions'; -export * from './helpers'; export * from './system'; diff --git a/plugins/app-backend/src/service/appPlugin.ts b/plugins/app-backend/src/service/appPlugin.ts index bfccf3cc02..2c0c73c71b 100644 --- a/plugins/app-backend/src/service/appPlugin.ts +++ b/plugins/app-backend/src/service/appPlugin.ts @@ -18,9 +18,9 @@ import express from 'express'; import { coreServices, createBackendPlugin, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; import { createRouter } from './router'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; /** @alpha */ export type AppPluginOptions = { diff --git a/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts b/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts index fa49d1e4c7..cbc137ab40 100644 --- a/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-aws/src/service/AwsS3EntityProviderCatalogModule.ts @@ -14,10 +14,10 @@ * limitations under the License. */ +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { coreServices, createBackendModule, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; import { AwsS3EntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts index 0d0ebdb591..bd59cec29b 100644 --- a/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-azure/src/service/AzureDevOpsEntityProviderCatalogModule.ts @@ -14,9 +14,9 @@ * limitations under the License. */ +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { createBackendModule, - loggerToWinstonLogger, coreServices, } from '@backstage/backend-plugin-api'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; diff --git a/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts index 19b83b92b6..d17656a473 100644 --- a/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-bitbucket-cloud/src/service/BitbucketCloudEntityProviderCatalogModule.ts @@ -14,10 +14,10 @@ * limitations under the License. */ +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { coreServices, createBackendModule, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; import { catalogProcessingExtensionPoint, diff --git a/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts index e0f5a21ff9..46712d29dd 100644 --- a/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-bitbucket-server/src/service/BitbucketServerEntityProviderCatalogModule.ts @@ -14,10 +14,10 @@ * limitations under the License. */ +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { coreServices, createBackendModule, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; import { BitbucketServerEntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts index 674845862f..8c61038c8f 100644 --- a/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-gerrit/src/service/GerritEntityProviderCatalogModule.ts @@ -14,10 +14,10 @@ * limitations under the License. */ +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { coreServices, createBackendModule, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; import { GerritEntityProvider } from '../providers/GerritEntityProvider'; diff --git a/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts index e61543ea13..d9dc0a12aa 100644 --- a/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-github/src/service/GithubEntityProviderCatalogModule.ts @@ -16,9 +16,9 @@ import { createBackendModule, - loggerToWinstonLogger, coreServices, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; import { GithubEntityProvider } from '../providers/GithubEntityProvider'; diff --git a/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts index 75a8de263f..bb4fb656a8 100644 --- a/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-gitlab/src/service/GitlabDiscoveryEntityProviderCatalogModule.ts @@ -16,9 +16,9 @@ import { createBackendModule, - loggerToWinstonLogger, coreServices, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; import { GitlabDiscoveryEntityProvider } from '../providers'; diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.ts b/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.ts index a6cfe14df2..abe4cdb951 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.ts @@ -18,8 +18,8 @@ import { ConfigService, LoggerService, SchedulerService, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { stringifyError } from '@backstage/errors'; import { EntityProvider, diff --git a/plugins/catalog-backend-module-msgraph/package.json b/plugins/catalog-backend-module-msgraph/package.json index 5bfe4e35ea..4ff9952bc5 100644 --- a/plugins/catalog-backend-module-msgraph/package.json +++ b/plugins/catalog-backend-module-msgraph/package.json @@ -34,6 +34,7 @@ }, "dependencies": { "@azure/identity": "^2.1.0", + "@backstage/backend-common": "workspace:^", "@backstage/backend-plugin-api": "workspace:^", "@backstage/backend-tasks": "workspace:^", "@backstage/catalog-model": "workspace:^", diff --git a/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts b/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts index 2643e6e937..fc63867a23 100644 --- a/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts +++ b/plugins/catalog-backend-module-msgraph/src/service/MicrosoftGraphOrgEntityProviderCatalogModule.ts @@ -17,8 +17,8 @@ import { coreServices, createBackendModule, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node'; import { GroupTransformer, diff --git a/plugins/catalog-backend/src/service/CatalogPlugin.ts b/plugins/catalog-backend/src/service/CatalogPlugin.ts index 6db54ed4fa..effed7f8f1 100644 --- a/plugins/catalog-backend/src/service/CatalogPlugin.ts +++ b/plugins/catalog-backend/src/service/CatalogPlugin.ts @@ -16,7 +16,6 @@ import { createBackendPlugin, coreServices, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; import { CatalogBuilder } from './CatalogBuilder'; import { @@ -25,6 +24,7 @@ import { catalogProcessingExtensionPoint, EntityProvider, } from '@backstage/plugin-catalog-node'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; class CatalogExtensionPointImpl implements CatalogProcessingExtensionPoint { #processors = new Array(); diff --git a/plugins/events-backend-module-aws-sqs/package.json b/plugins/events-backend-module-aws-sqs/package.json index 62e897a42e..c01c706f67 100644 --- a/plugins/events-backend-module-aws-sqs/package.json +++ b/plugins/events-backend-module-aws-sqs/package.json @@ -24,6 +24,7 @@ }, "dependencies": { "@aws-sdk/client-sqs": "^3.208.0", + "@backstage/backend-common": "workspace:^", "@backstage/backend-plugin-api": "workspace:^", "@backstage/backend-tasks": "workspace:^", "@backstage/config": "workspace:^", diff --git a/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts b/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts index a6c43d4046..50812f321b 100644 --- a/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts +++ b/plugins/events-backend-module-aws-sqs/src/service/AwsSqsConsumingEventPublisherEventsModule.ts @@ -17,8 +17,8 @@ import { coreServices, createBackendModule, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { eventsExtensionPoint } from '@backstage/plugin-events-node'; import { AwsSqsConsumingEventPublisher } from '../publisher/AwsSqsConsumingEventPublisher'; diff --git a/plugins/events-backend/src/service/EventsPlugin.ts b/plugins/events-backend/src/service/EventsPlugin.ts index 63d0d0b02a..29456d71f7 100644 --- a/plugins/events-backend/src/service/EventsPlugin.ts +++ b/plugins/events-backend/src/service/EventsPlugin.ts @@ -17,8 +17,8 @@ import { createBackendPlugin, coreServices, - loggerToWinstonLogger, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { EventBroker, EventPublisher, diff --git a/plugins/scaffolder-backend/src/ScaffolderPlugin.ts b/plugins/scaffolder-backend/src/ScaffolderPlugin.ts index 8a9da38bf2..5d4c16e2dc 100644 --- a/plugins/scaffolder-backend/src/ScaffolderPlugin.ts +++ b/plugins/scaffolder-backend/src/ScaffolderPlugin.ts @@ -16,9 +16,9 @@ import { createBackendPlugin, coreServices, - loggerToWinstonLogger, createExtensionPoint, } from '@backstage/backend-plugin-api'; +import { loggerToWinstonLogger } from '@backstage/backend-common'; import { ScmIntegrations } from '@backstage/integration'; import { catalogServiceRef } from '@backstage/plugin-catalog-node'; import { TemplateFilter, TemplateGlobal } from './lib'; diff --git a/yarn.lock b/yarn.lock index 41202619bc..7cb8c4dcd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3466,6 +3466,7 @@ __metadata: tar: ^6.1.12 uuid: ^8.3.2 winston: ^3.2.1 + winston-transport: ^4.5.0 yauzl: ^2.10.0 yn: ^4.0.0 peerDependencies: @@ -3497,8 +3498,6 @@ __metadata: "@backstage/plugin-permission-common": "workspace:^" "@types/express": ^4.17.6 express: ^4.17.1 - winston: ^3.2.1 - winston-transport: ^4.5.0 languageName: unknown linkType: soft From 541513e19f6ee2a3ae2da28fd4a8b8e31cad1a5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 10:24:11 +0000 Subject: [PATCH 110/141] fix(deps): update dependency @roadiehq/backstage-plugin-buildkite to v2.1.2 Signed-off-by: Renovate Bot --- yarn.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/yarn.lock b/yarn.lock index 3608fb101a..2d324689e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12907,13 +12907,13 @@ __metadata: linkType: hard "@roadiehq/backstage-plugin-buildkite@npm:^2.0.8": - version: 2.1.1 - resolution: "@roadiehq/backstage-plugin-buildkite@npm:2.1.1" + version: 2.1.2 + resolution: "@roadiehq/backstage-plugin-buildkite@npm:2.1.2" dependencies: - "@backstage/catalog-model": ^1.1.3 - "@backstage/core-components": ^0.12.0 - "@backstage/core-plugin-api": ^1.1.0 - "@backstage/plugin-catalog-react": ^1.2.1 + "@backstage/catalog-model": ^1.1.4 + "@backstage/core-components": ^0.12.2 + "@backstage/core-plugin-api": ^1.2.0 + "@backstage/plugin-catalog-react": ^1.2.3 "@backstage/theme": ^0.2.16 "@material-ui/core": ^4.12.1 "@material-ui/icons": ^4.11.2 @@ -12926,7 +12926,7 @@ __metadata: react-dom: ^16.13.1 || ^17.0.0 react-router: 6.0.0-beta.0 || ^6.3.0 react-router-dom: 6.0.0-beta.0 || ^6.3.0 - checksum: 04121a556d6745cef4db0f2bc60218e0774056f26c09c195e4cf7ba29d8c7a601c24d13c8e077c904df312a1f6464942467c29be796b49156774af4029b7ec7b + checksum: fc607c7eac3a680db9ecc4c33bc65e84cdff432dc1079343f6e1ce66459324eba31a16a647b669c163e87c8b1794a01e66b4ba4f9fd77611d3081a0317cf68ac languageName: node linkType: hard From 55256fdf1ed267c680cd5b3d9fb02da7b33e5fa3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 10:36:34 +0000 Subject: [PATCH 111/141] fix(deps): update dependency @roadiehq/backstage-plugin-github-insights to v2.3.2 Signed-off-by: Renovate Bot --- yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index d1f3e1a3da..ba7652c594 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4156,7 +4156,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/integration-react@npm:^1.1.6": +"@backstage/integration-react@npm:^1.1.8": version: 1.1.8 resolution: "@backstage/integration-react@npm:1.1.8" dependencies: @@ -12931,14 +12931,14 @@ __metadata: linkType: hard "@roadiehq/backstage-plugin-github-insights@npm:^2.0.5": - version: 2.3.0 - resolution: "@roadiehq/backstage-plugin-github-insights@npm:2.3.0" + version: 2.3.2 + resolution: "@roadiehq/backstage-plugin-github-insights@npm:2.3.2" dependencies: - "@backstage/catalog-model": ^1.1.3 - "@backstage/core-components": ^0.12.0 - "@backstage/core-plugin-api": ^1.1.0 - "@backstage/integration-react": ^1.1.6 - "@backstage/plugin-catalog-react": ^1.2.1 + "@backstage/catalog-model": ^1.1.4 + "@backstage/core-components": ^0.12.2 + "@backstage/core-plugin-api": ^1.2.0 + "@backstage/integration-react": ^1.1.8 + "@backstage/plugin-catalog-react": ^1.2.3 "@backstage/theme": ^0.2.16 "@date-io/core": 2.10.7 "@material-ui/core": ^4.11.0 @@ -12954,7 +12954,7 @@ __metadata: react: ^16.13.1 || ^17.0.0 react-dom: ^16.13.1 || ^17.0.0 react-router: 6.0.0-beta.0 || ^6.3.0 - checksum: 874fc76baf02ac6568f150aaf14ef4a35ddbffca410a44350c2cd4f47c900e28aa6d7d82ddfc0dd3065fc6764abd16af2a802d303f9af47ff296006cd14afe2a + checksum: 9c38cb944a9f37c3a0836dd4d5b41bc8329f124a026ce5f0c5ea467477ae87e6f699669c1c0873a9d29d791f6f870279bc7e83bc426111f540f8f6f54aad6f8a languageName: node linkType: hard From 4813e41c0a942e3c59e0d0db80118d4b2fc3f6a8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:15:14 +0000 Subject: [PATCH 112/141] fix(deps): update dependency @roadiehq/backstage-plugin-github-pull-requests to v2.4.2 Signed-off-by: Renovate Bot --- yarn.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index fdb72b8d0f..74b9067e8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6497,7 +6497,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-home@npm:^0.4.27, @backstage/plugin-home@npm:^0.4.29": +"@backstage/plugin-home@npm:^0.4.29": version: 0.4.29 resolution: "@backstage/plugin-home@npm:0.4.29" dependencies: @@ -12950,14 +12950,14 @@ __metadata: linkType: hard "@roadiehq/backstage-plugin-github-pull-requests@npm:^2.2.7": - version: 2.4.1 - resolution: "@roadiehq/backstage-plugin-github-pull-requests@npm:2.4.1" + version: 2.4.2 + resolution: "@roadiehq/backstage-plugin-github-pull-requests@npm:2.4.2" dependencies: - "@backstage/catalog-model": ^1.1.3 - "@backstage/core-components": ^0.12.0 - "@backstage/core-plugin-api": ^1.1.0 - "@backstage/plugin-catalog-react": ^1.2.1 - "@backstage/plugin-home": ^0.4.27 + "@backstage/catalog-model": ^1.1.4 + "@backstage/core-components": ^0.12.2 + "@backstage/core-plugin-api": ^1.2.0 + "@backstage/plugin-catalog-react": ^1.2.3 + "@backstage/plugin-home": ^0.4.29 "@material-ui/core": ^4.11.0 "@material-ui/icons": ^4.9.1 "@material-ui/lab": ^4.0.0-alpha.60 @@ -12974,7 +12974,7 @@ __metadata: react: ^16.13.1 || ^17.0.0 react-dom: ^16.13.1 || ^17.0.0 react-router: 6.0.0-beta.0 || ^6.3.0 - checksum: 41fa25e70fbe01bd26ea97cfd98fcff6c32771f437a28a3ed37078906290daf5d52ec0f0613caa559a09b6f8cacb923c0b6522d78de488909911f46433e189ee + checksum: d2b80b4c25a0bdca2e6dcd8ddf2fc26aa75374d5278fc235551fb213f3c0269e81cb141afd98c3a2a3073c39cfe35db69b1c265a615dd880777ab2e6c6a69d22 languageName: node linkType: hard From d4e9a32432409b36633f8500a0eedbe51d1beadd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:26:44 +0000 Subject: [PATCH 113/141] fix(deps): update dependency @roadiehq/backstage-plugin-travis-ci to v2.1.2 Signed-off-by: Renovate Bot --- yarn.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/yarn.lock b/yarn.lock index 328f9957c8..a48020a644 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12979,13 +12979,13 @@ __metadata: linkType: hard "@roadiehq/backstage-plugin-travis-ci@npm:^2.0.5": - version: 2.1.1 - resolution: "@roadiehq/backstage-plugin-travis-ci@npm:2.1.1" + version: 2.1.2 + resolution: "@roadiehq/backstage-plugin-travis-ci@npm:2.1.2" dependencies: - "@backstage/catalog-model": ^1.1.3 - "@backstage/core-components": ^0.12.0 - "@backstage/core-plugin-api": ^1.1.0 - "@backstage/plugin-catalog-react": ^1.2.1 + "@backstage/catalog-model": ^1.1.4 + "@backstage/core-components": ^0.12.2 + "@backstage/core-plugin-api": ^1.2.0 + "@backstage/plugin-catalog-react": ^1.2.3 "@backstage/theme": ^0.2.16 "@material-ui/core": ^4.11.3 "@material-ui/icons": ^4.11.2 @@ -13000,7 +13000,7 @@ __metadata: react-dom: ^16.13.1 || ^17.0.0 react-router: 6.0.0-beta.0 || ^6.3.0 react-router-dom: 6.0.0-beta.0 || ^6.3.0 - checksum: 23cb8760c6d140052fcdc22007b59349332afd565ee2b65e8bba4a1b5c5d409ef6505f292d1e5c62d3c281898b65eb83397aa790480e9e1becda3452ef6d086c + checksum: 64e2878fd517e63eb765a65c60f1276cc6a12e4abb128001ed92a1e634546c0ec9236cbb67c6b534ece126fe64b5fb251e985fe3e5f42ce4500b6108b9f7f889 languageName: node linkType: hard From 922938ea392b6e594ee0af8fb31bc6751144f342 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 12:12:22 +0000 Subject: [PATCH 114/141] fix(deps): update dependency @tanstack/react-query to v4.20.9 Signed-off-by: Renovate Bot --- yarn.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index ec11226f77..f67fdc2297 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3566,7 +3566,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/catalog-model@npm:^1.1.2, @backstage/catalog-model@npm:^1.1.3, @backstage/catalog-model@npm:^1.1.4": +"@backstage/catalog-model@npm:^1.1.2, @backstage/catalog-model@npm:^1.1.4": version: 1.1.4 resolution: "@backstage/catalog-model@npm:1.1.4" dependencies: @@ -3901,7 +3901,7 @@ __metadata: languageName: node linkType: hard -"@backstage/core-components@npm:^0.12.0, @backstage/core-components@npm:^0.12.2": +"@backstage/core-components@npm:^0.12.2": version: 0.12.2 resolution: "@backstage/core-components@npm:0.12.2" dependencies: @@ -4022,7 +4022,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/core-plugin-api@npm:^1.0.7, @backstage/core-plugin-api@npm:^1.1.0, @backstage/core-plugin-api@npm:^1.2.0": +"@backstage/core-plugin-api@npm:^1.0.7, @backstage/core-plugin-api@npm:^1.2.0": version: 1.2.0 resolution: "@backstage/core-plugin-api@npm:1.2.0" dependencies: @@ -5409,7 +5409,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-catalog-react@npm:^1.2.0, @backstage/plugin-catalog-react@npm:^1.2.1, @backstage/plugin-catalog-react@npm:^1.2.3": +"@backstage/plugin-catalog-react@npm:^1.2.0, @backstage/plugin-catalog-react@npm:^1.2.3": version: 1.2.3 resolution: "@backstage/plugin-catalog-react@npm:1.2.3" dependencies: @@ -13641,18 +13641,18 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:4.20.4": - version: 4.20.4 - resolution: "@tanstack/query-core@npm:4.20.4" - checksum: bdb652296e4093d8cb042a67b9c035bc0a756e09a3b12aeb070068b07adc1c71174c2e6108f2a8c3322a26cb73ba57f431326aa0b813c81621674b9cc208cd93 +"@tanstack/query-core@npm:4.20.9": + version: 4.20.9 + resolution: "@tanstack/query-core@npm:4.20.9" + checksum: 679551353e6d5adcae771bc78b64959a6ecf4f85c1f74952b38b18a7425374cf84dc2e461cf6048be206d8bbac265468d36231f7f9d0b6689504a0e069dd5ac6 languageName: node linkType: hard "@tanstack/react-query@npm:^4.1.3": - version: 4.20.4 - resolution: "@tanstack/react-query@npm:4.20.4" + version: 4.20.9 + resolution: "@tanstack/react-query@npm:4.20.9" dependencies: - "@tanstack/query-core": 4.20.4 + "@tanstack/query-core": 4.20.9 use-sync-external-store: ^1.2.0 peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 @@ -13663,7 +13663,7 @@ __metadata: optional: true react-native: optional: true - checksum: ba9e2f175c58bde592c0ad14285f289585474763f8d68072d651fa75263a3a7f75eead5b62aa3140db133b95468498bc58817d07513f6f857be2bd8031b491da + checksum: 4fc953d774c5c0f7f332f014dfb2fb9865387ae6e849fdf551e2ad70f07d55fbdbc4c6afb27a1f90bce3a2348bd1adf67ab78a4bc2cdf8d3e5ff90128730b467 languageName: node linkType: hard From 5437fe488f363c654bfcd1626cfcf0175c541be3 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 4 Jan 2023 10:44:04 +0100 Subject: [PATCH 115/141] Migrate Cache and Database types into backend-plugin-api Signed-off-by: Johan Haals --- .changeset/nasty-pumas-kneel.md | 6 ++ packages/backend-app-api/api-report.md | 8 +- packages/backend-common/api-report.md | 40 +++------- .../backend-common/src/cache/CacheClient.ts | 52 +++---------- packages/backend-common/src/cache/types.ts | 36 +-------- packages/backend-common/src/database/types.ts | 27 +------ packages/backend-plugin-api/package.json | 4 +- .../src/services/definitions/CacheService.ts | 78 ++++++++++++++++++- .../services/definitions/DatabaseService.ts | 30 ++++++- .../src/services/definitions/index.ts | 7 +- plugins/auth-backend/api-report.md | 2 +- 11 files changed, 146 insertions(+), 144 deletions(-) create mode 100644 .changeset/nasty-pumas-kneel.md diff --git a/.changeset/nasty-pumas-kneel.md b/.changeset/nasty-pumas-kneel.md new file mode 100644 index 0000000000..3fcd46641e --- /dev/null +++ b/.changeset/nasty-pumas-kneel.md @@ -0,0 +1,6 @@ +--- +'@backstage/backend-plugin-api': patch +'@backstage/backend-common': patch +--- + +Migrated types related to `CacheService` and `DatabaseService` into backend-plugin-api. diff --git a/packages/backend-app-api/api-report.md b/packages/backend-app-api/api-report.md index fa3f3bec2e..313c391bb3 100644 --- a/packages/backend-app-api/api-report.md +++ b/packages/backend-app-api/api-report.md @@ -4,14 +4,14 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -import { CacheService } from '@backstage/backend-plugin-api'; import { ConfigService } from '@backstage/backend-plugin-api'; -import { DatabaseService } from '@backstage/backend-plugin-api'; import { ExtensionPoint } from '@backstage/backend-plugin-api'; import { HttpRouterService } from '@backstage/backend-plugin-api'; import { LifecycleService } from '@backstage/backend-plugin-api'; import { LoggerService } from '@backstage/backend-plugin-api'; import { PermissionsService } from '@backstage/backend-plugin-api'; +import { PluginCacheManager } from '@backstage/backend-common'; +import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { RootLifecycleService } from '@backstage/backend-plugin-api'; import { RootLoggerService } from '@backstage/backend-plugin-api'; @@ -34,7 +34,7 @@ export interface Backend { // @public (undocumented) export const cacheFactory: ( options?: undefined, -) => ServiceFactory; +) => ServiceFactory; // @public (undocumented) export const configFactory: ( @@ -55,7 +55,7 @@ export interface CreateSpecializedBackendOptions { // @public (undocumented) export const databaseFactory: ( options?: undefined, -) => ServiceFactory; +) => ServiceFactory; // @public (undocumented) export const discoveryFactory: ( diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index 7e81d40394..c8ddb807d8 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -12,6 +12,9 @@ import { AzureIntegration } from '@backstage/integration'; import { BitbucketCloudIntegration } from '@backstage/integration'; import { BitbucketIntegration } from '@backstage/integration'; import { BitbucketServerIntegration } from '@backstage/integration'; +import { CacheClient } from '@backstage/backend-plugin-api'; +import { CacheClientOptions } from '@backstage/backend-plugin-api'; +import { CacheClientSetOptions } from '@backstage/backend-plugin-api'; import { Config } from '@backstage/config'; import cors from 'cors'; import Docker from 'dockerode'; @@ -24,13 +27,14 @@ import { GithubCredentialsProvider } from '@backstage/integration'; import { GithubIntegration } from '@backstage/integration'; import { GitLabIntegration } from '@backstage/integration'; import { isChildPath } from '@backstage/cli-common'; -import { JsonValue } from '@backstage/types'; import { Knex } from 'knex'; import { KubeConfig } from '@kubernetes/client-node'; import { LoadConfigOptionsRemote } from '@backstage/config-loader'; import { Logger } from 'winston'; import { LoggerService } from '@backstage/backend-plugin-api'; import { MergeResult } from 'isomorphic-git'; +import { CacheService as PluginCacheManager } from '@backstage/backend-plugin-api'; +import { DatabaseService as PluginDatabaseManager } from '@backstage/backend-plugin-api'; import { DiscoveryService as PluginEndpointDiscovery } from '@backstage/backend-plugin-api'; import { PushResult } from 'isomorphic-git'; import { Readable } from 'stream'; @@ -165,26 +169,11 @@ export class BitbucketUrlReader implements UrlReader { toString(): string; } -// @public -export interface CacheClient { - delete(key: string): Promise; - get(key: string): Promise; - set( - key: string, - value: JsonValue, - options?: CacheClientSetOptions, - ): Promise; -} +export { CacheClient }; -// @public -export type CacheClientOptions = { - defaultTtl?: number; -}; +export { CacheClientOptions }; -// @public -export type CacheClientSetOptions = { - ttl?: number; -}; +export { CacheClientSetOptions }; // @public export class CacheManager { @@ -526,18 +515,9 @@ export function loggerToWinstonLogger( // @public export function notFoundHandler(): RequestHandler; -// @public -export type PluginCacheManager = { - getClient: (options?: CacheClientOptions) => CacheClient; -}; +export { PluginCacheManager }; -// @public -export interface PluginDatabaseManager { - getClient(): Promise; - migrations?: { - skip?: boolean; - }; -} +export { PluginDatabaseManager }; export { PluginEndpointDiscovery }; diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 96982edeaa..47cb786f14 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -14,57 +14,23 @@ * limitations under the License. */ +import { + CacheClient, + CacheClientSetOptions, +} from '@backstage/backend-plugin-api'; import { JsonValue } from '@backstage/types'; import { createHash } from 'crypto'; import Keyv from 'keyv'; +export type { + CacheClient, + CacheClientSetOptions, +} from '@backstage/backend-plugin-api'; + type CacheClientArgs = { client: Keyv; }; -/** - * Options passed to {@link CacheClient.set}. - * - * @public - */ -export type CacheClientSetOptions = { - /** - * Optional TTL in milliseconds. Defaults to the TTL provided when the client - * was set up (or no TTL if none are provided). - */ - ttl?: number; -}; - -/** - * A pre-configured, storage agnostic cache client suitable for use by - * Backstage plugins. - * - * @public - */ -export interface CacheClient { - /** - * Reads data from a cache store for the given key. If no data was found, - * returns undefined. - */ - get(key: string): Promise; - - /** - * Writes the given data to a cache store, associated with the given key. An - * optional TTL may also be provided, otherwise it defaults to the TTL that - * was provided when the client was instantiated. - */ - set( - key: string, - value: JsonValue, - options?: CacheClientSetOptions, - ): Promise; - - /** - * Removes the given key from the cache store. - */ - delete(key: string): Promise; -} - /** * A basic, concrete implementation of the CacheClient, suitable for almost * all uses in Backstage. diff --git a/packages/backend-common/src/cache/types.ts b/packages/backend-common/src/cache/types.ts index 5cf8323c52..40e30b1059 100644 --- a/packages/backend-common/src/cache/types.ts +++ b/packages/backend-common/src/cache/types.ts @@ -15,21 +15,11 @@ */ import { Logger } from 'winston'; -import { CacheClient } from './CacheClient'; -/** - * Options given when constructing a {@link CacheClient}. - * - * @public - */ -export type CacheClientOptions = { - /** - * An optional default TTL (in milliseconds) to be set when getting a client - * instance. If not provided, data will persist indefinitely by default (or - * can be configured per entry at set-time). - */ - defaultTtl?: number; -}; +export type { + CacheService as PluginCacheManager, + CacheClientOptions, +} from '@backstage/backend-plugin-api'; /** * Options given when constructing a {@link CacheManager}. @@ -48,21 +38,3 @@ export type CacheManagerOptions = { */ onError?: (err: Error) => void; }; - -/** - * Manages access to cache stores that plugins get. - * - * @public - */ -export type PluginCacheManager = { - /** - * Provides backend plugins cache connections for themselves. - * - * @remarks - * - * The purpose of this method is to allow plugins to get isolated data stores - * so that plugins are discouraged from cache-level integration and/or cache - * key collisions. - */ - getClient: (options?: CacheClientOptions) => CacheClient; -}; diff --git a/packages/backend-common/src/database/types.ts b/packages/backend-common/src/database/types.ts index 2fa8b749a8..2d59cf636e 100644 --- a/packages/backend-common/src/database/types.ts +++ b/packages/backend-common/src/database/types.ts @@ -17,32 +17,7 @@ import { Config } from '@backstage/config'; import { Knex } from 'knex'; -/** - * The PluginDatabaseManager manages access to databases that Plugins get. - * - * @public - */ -export interface PluginDatabaseManager { - /** - * getClient provides backend plugins database connections for itself. - * - * The purpose of this method is to allow plugins to get isolated data - * stores so that plugins are discouraged from database integration. - */ - getClient(): Promise; - - /** - * This property is used to control the behavior of database migrations. - */ - migrations?: { - /** - * skip database migrations. Useful if connecting to a read-only database. - * - * @defaultValue false - */ - skip?: boolean; - }; -} +export type { DatabaseService as PluginDatabaseManager } from '@backstage/backend-plugin-api'; /** * DatabaseConnector manages an underlying Knex database driver. diff --git a/packages/backend-plugin-api/package.json b/packages/backend-plugin-api/package.json index 0719ea8f45..9d92e5774a 100644 --- a/packages/backend-plugin-api/package.json +++ b/packages/backend-plugin-api/package.json @@ -36,9 +36,11 @@ "@backstage/backend-common": "workspace:^", "@backstage/backend-tasks": "workspace:^", "@backstage/config": "workspace:^", + "@backstage/types": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", "@types/express": "^4.17.6", - "express": "^4.17.1" + "express": "^4.17.1", + "knex": "^2.0.0" }, "devDependencies": { "@backstage/cli": "workspace:^" diff --git a/packages/backend-plugin-api/src/services/definitions/CacheService.ts b/packages/backend-plugin-api/src/services/definitions/CacheService.ts index 79c930f435..2702fdac6d 100644 --- a/packages/backend-plugin-api/src/services/definitions/CacheService.ts +++ b/packages/backend-plugin-api/src/services/definitions/CacheService.ts @@ -14,7 +14,79 @@ * limitations under the License. */ -import { PluginCacheManager } from '@backstage/backend-common'; +import { JsonValue } from '@backstage/types'; -/** @public */ -export interface CacheService extends PluginCacheManager {} +/** + * Manages access to cache stores that plugins get. + * + * @public + */ +export interface CacheService { + /** + * Provides backend plugins cache connections for themselves. + * + * @remarks + * + * The purpose of this method is to allow plugins to get isolated data stores + * so that plugins are discouraged from cache-level integration and/or cache + * key collisions. + */ + getClient: (options?: CacheClientOptions) => CacheClient; +} + +/** + * Options passed to {@link CacheClient.set}. + * + * @public + */ +export type CacheClientSetOptions = { + /** + * Optional TTL in milliseconds. Defaults to the TTL provided when the client + * was set up (or no TTL if none are provided). + */ + ttl?: number; +}; + +/** + * A pre-configured, storage agnostic cache client suitable for use by + * Backstage plugins. + * + * @public + */ +export interface CacheClient { + /** + * Reads data from a cache store for the given key. If no data was found, + * returns undefined. + */ + get(key: string): Promise; + + /** + * Writes the given data to a cache store, associated with the given key. An + * optional TTL may also be provided, otherwise it defaults to the TTL that + * was provided when the client was instantiated. + */ + set( + key: string, + value: JsonValue, + options?: CacheClientSetOptions, + ): Promise; + + /** + * Removes the given key from the cache store. + */ + delete(key: string): Promise; +} + +/** + * Options given when constructing a {@link CacheClient}. + * + * @public + */ +export type CacheClientOptions = { + /** + * An optional default TTL (in milliseconds) to be set when getting a client + * instance. If not provided, data will persist indefinitely by default (or + * can be configured per entry at set-time). + */ + defaultTtl?: number; +}; diff --git a/packages/backend-plugin-api/src/services/definitions/DatabaseService.ts b/packages/backend-plugin-api/src/services/definitions/DatabaseService.ts index 30f1f574f2..583dfe8b8f 100644 --- a/packages/backend-plugin-api/src/services/definitions/DatabaseService.ts +++ b/packages/backend-plugin-api/src/services/definitions/DatabaseService.ts @@ -14,7 +14,31 @@ * limitations under the License. */ -import { PluginDatabaseManager } from '@backstage/backend-common'; +import { Knex } from 'knex'; -/** @public */ -export interface DatabaseService extends PluginDatabaseManager {} +/** + * The DatabaseService manages access to databases that Plugins get. + *gs + * @public + */ +export interface DatabaseService { + /** + * getClient provides backend plugins database connections for itself. + * + * The purpose of this method is to allow plugins to get isolated data + * stores so that plugins are discouraged from database integration. + */ + getClient(): Promise; + + /** + * This property is used to control the behavior of database migrations. + */ + migrations?: { + /** + * skip database migrations. Useful if connecting to a read-only database. + * + * @defaultValue false + */ + skip?: boolean; + }; +} diff --git a/packages/backend-plugin-api/src/services/definitions/index.ts b/packages/backend-plugin-api/src/services/definitions/index.ts index dedfd6223e..cb4b5de3e7 100644 --- a/packages/backend-plugin-api/src/services/definitions/index.ts +++ b/packages/backend-plugin-api/src/services/definitions/index.ts @@ -15,7 +15,12 @@ */ export { coreServices } from './coreServices'; -export type { CacheService } from './CacheService'; +export type { + CacheService, + CacheClient, + CacheClientOptions, + CacheClientSetOptions, +} from './CacheService'; export type { ConfigService } from './ConfigService'; export type { DatabaseService } from './DatabaseService'; export type { DiscoveryService } from './DiscoveryService'; diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index cec3422d9c..88cb33863e 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -7,7 +7,7 @@ import { BackstageIdentityResponse } from '@backstage/plugin-auth-node'; import { BackstageSignInResult } from '@backstage/plugin-auth-node'; -import { CacheClient } from '@backstage/backend-common'; +import { CacheClient } from '@backstage/backend-plugin-api'; import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { Entity } from '@backstage/catalog-model'; From d2a1fcdf0936088e71c9c35c05de21e7e7812dbd Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 4 Jan 2023 10:59:13 +0100 Subject: [PATCH 116/141] update yarn.lock Signed-off-by: Johan Haals --- packages/backend-plugin-api/package.json | 2 +- yarn.lock | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/backend-plugin-api/package.json b/packages/backend-plugin-api/package.json index 9d92e5774a..ff6feb7055 100644 --- a/packages/backend-plugin-api/package.json +++ b/packages/backend-plugin-api/package.json @@ -36,8 +36,8 @@ "@backstage/backend-common": "workspace:^", "@backstage/backend-tasks": "workspace:^", "@backstage/config": "workspace:^", - "@backstage/types": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", + "@backstage/types": "workspace:^", "@types/express": "^4.17.6", "express": "^4.17.1", "knex": "^2.0.0" diff --git a/yarn.lock b/yarn.lock index ec11226f77..c6834f33d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3496,8 +3496,10 @@ __metadata: "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" "@backstage/plugin-permission-common": "workspace:^" + "@backstage/types": "workspace:^" "@types/express": ^4.17.6 express: ^4.17.1 + knex: ^2.0.0 languageName: unknown linkType: soft @@ -3566,7 +3568,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/catalog-model@npm:^1.1.2, @backstage/catalog-model@npm:^1.1.3, @backstage/catalog-model@npm:^1.1.4": +"@backstage/catalog-model@npm:^1.1.2, @backstage/catalog-model@npm:^1.1.4": version: 1.1.4 resolution: "@backstage/catalog-model@npm:1.1.4" dependencies: @@ -3901,7 +3903,7 @@ __metadata: languageName: node linkType: hard -"@backstage/core-components@npm:^0.12.0, @backstage/core-components@npm:^0.12.2": +"@backstage/core-components@npm:^0.12.2": version: 0.12.2 resolution: "@backstage/core-components@npm:0.12.2" dependencies: @@ -4022,7 +4024,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/core-plugin-api@npm:^1.0.7, @backstage/core-plugin-api@npm:^1.1.0, @backstage/core-plugin-api@npm:^1.2.0": +"@backstage/core-plugin-api@npm:^1.0.7, @backstage/core-plugin-api@npm:^1.2.0": version: 1.2.0 resolution: "@backstage/core-plugin-api@npm:1.2.0" dependencies: @@ -5409,7 +5411,7 @@ __metadata: languageName: unknown linkType: soft -"@backstage/plugin-catalog-react@npm:^1.2.0, @backstage/plugin-catalog-react@npm:^1.2.1, @backstage/plugin-catalog-react@npm:^1.2.3": +"@backstage/plugin-catalog-react@npm:^1.2.0, @backstage/plugin-catalog-react@npm:^1.2.3": version: 1.2.3 resolution: "@backstage/plugin-catalog-react@npm:1.2.3" dependencies: From 38dda2beab7fe68df464d0bb9d5f545309774c38 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 4 Jan 2023 11:47:35 +0100 Subject: [PATCH 117/141] Migrate TokenManager types Signed-off-by: Johan Haals --- .changeset/nasty-pumas-kneel.md | 2 +- packages/backend-common/api-report.md | 12 ++++----- packages/backend-common/src/tokens/types.ts | 24 +----------------- packages/backend-plugin-api/api-report.md | 13 ++++++++-- .../definitions/TokenManagerService.ts | 25 ++++++++++++++++--- 5 files changed, 40 insertions(+), 36 deletions(-) diff --git a/.changeset/nasty-pumas-kneel.md b/.changeset/nasty-pumas-kneel.md index 3fcd46641e..cdfda89868 100644 --- a/.changeset/nasty-pumas-kneel.md +++ b/.changeset/nasty-pumas-kneel.md @@ -3,4 +3,4 @@ '@backstage/backend-common': patch --- -Migrated types related to `CacheService` and `DatabaseService` into backend-plugin-api. +Migrated types related to `TokenManagerService`, `CacheService` and `DatabaseService` into backend-plugin-api. diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index c8ddb807d8..297bc77fcb 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -51,7 +51,11 @@ import { SearchOptions } from '@backstage/backend-plugin-api'; import { SearchResponse } from '@backstage/backend-plugin-api'; import { SearchResponseFile } from '@backstage/backend-plugin-api'; import { Server } from 'http'; +<<<<<<< HEAD import { TransportStreamOptions } from 'winston-transport'; +======= +import { TokenManagerService as TokenManager } from '@backstage/backend-plugin-api'; +>>>>>>> 24636656b5 (Migrate TokenManager types) import { UrlReaderService as UrlReader } from '@backstage/backend-plugin-api'; import { V1PodTemplateSpec } from '@kubernetes/client-node'; import * as winston from 'winston'; @@ -698,13 +702,7 @@ export interface StatusCheckHandlerOptions { statusCheck?: StatusCheck; } -// @public -export interface TokenManager { - authenticate(token: string): Promise; - getToken(): Promise<{ - token: string; - }>; -} +export { TokenManager }; export { UrlReader }; diff --git a/packages/backend-common/src/tokens/types.ts b/packages/backend-common/src/tokens/types.ts index 2fa771b7e2..4e0fd698df 100644 --- a/packages/backend-common/src/tokens/types.ts +++ b/packages/backend-common/src/tokens/types.ts @@ -14,26 +14,4 @@ * limitations under the License. */ -/** - * Interface for creating and validating tokens. - * - * @public - */ -export interface TokenManager { - /** - * Fetches a valid token. - * - * @remarks - * - * Tokens are valid for roughly one hour; the actual deadline is set in the - * payload `exp` claim. Never hold on to tokens for reuse; always ask for a - * new one for each outgoing request. This ensures that you always get a - * valid, fresh one. - */ - getToken(): Promise<{ token: string }>; - - /** - * Validates a given token. - */ - authenticate(token: string): Promise; -} +export type { TokenManagerService as TokenManager } from '@backstage/backend-plugin-api'; diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index 16f00ad89f..39bd85841b 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -12,7 +12,11 @@ import { PluginCacheManager } from '@backstage/backend-common'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginTaskScheduler } from '@backstage/backend-tasks'; import { Readable } from 'stream'; +<<<<<<< HEAD import { TokenManager } from '@backstage/backend-common'; +======= +import { TransportStreamOptions } from 'winston-transport'; +>>>>>>> 24636656b5 (Migrate TokenManager types) // @public (undocumented) export interface BackendFeature { @@ -323,8 +327,13 @@ export type ServiceRef< $$ref: 'service'; }; -// @public (undocumented) -export interface TokenManagerService extends TokenManager {} +// @public +export interface TokenManagerService { + authenticate(token: string): Promise; + getToken(): Promise<{ + token: string; + }>; +} // @public (undocumented) export type TypesToServiceRef = { diff --git a/packages/backend-plugin-api/src/services/definitions/TokenManagerService.ts b/packages/backend-plugin-api/src/services/definitions/TokenManagerService.ts index 7fccb60c7a..c9d7edcaef 100644 --- a/packages/backend-plugin-api/src/services/definitions/TokenManagerService.ts +++ b/packages/backend-plugin-api/src/services/definitions/TokenManagerService.ts @@ -14,7 +14,26 @@ * limitations under the License. */ -import { TokenManager } from '@backstage/backend-common'; +/** + * Interface for creating and validating tokens. + * + * @public + */ +export interface TokenManagerService { + /** + * Fetches a valid token. + * + * @remarks + * + * Tokens are valid for roughly one hour; the actual deadline is set in the + * payload `exp` claim. Never hold on to tokens for reuse; always ask for a + * new one for each outgoing request. This ensures that you always get a + * valid, fresh one. + */ + getToken(): Promise<{ token: string }>; -/** @public */ -export interface TokenManagerService extends TokenManager {} + /** + * Validates a given token. + */ + authenticate(token: string): Promise; +} From e267c22333a8b477d33f420c2a751b209aa2a217 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 4 Jan 2023 11:47:45 +0100 Subject: [PATCH 118/141] Remove dependency on backend-common Signed-off-by: Johan Haals --- packages/backend-plugin-api/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/backend-plugin-api/package.json b/packages/backend-plugin-api/package.json index ff6feb7055..dc484a33b0 100644 --- a/packages/backend-plugin-api/package.json +++ b/packages/backend-plugin-api/package.json @@ -33,7 +33,6 @@ "start": "backstage-cli package start" }, "dependencies": { - "@backstage/backend-common": "workspace:^", "@backstage/backend-tasks": "workspace:^", "@backstage/config": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", From 993ca803af667bbcfd776646746592f08a01657c Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 4 Jan 2023 11:48:47 +0100 Subject: [PATCH 119/141] update yarn.lock Signed-off-by: Johan Haals --- yarn.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index c6834f33d9..f38500f883 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3491,7 +3491,6 @@ __metadata: version: 0.0.0-use.local resolution: "@backstage/backend-plugin-api@workspace:packages/backend-plugin-api" dependencies: - "@backstage/backend-common": "workspace:^" "@backstage/backend-tasks": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" From 5e9bddada062e5852415b842a5e2ab6d22c85747 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 4 Jan 2023 13:18:23 +0100 Subject: [PATCH 120/141] fix api reports Signed-off-by: Johan Haals --- packages/backend-common/api-report.md | 5 +-- packages/backend-plugin-api/api-report.md | 45 +++++++++++++++++------ 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index 297bc77fcb..43260c2a64 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -51,11 +51,8 @@ import { SearchOptions } from '@backstage/backend-plugin-api'; import { SearchResponse } from '@backstage/backend-plugin-api'; import { SearchResponseFile } from '@backstage/backend-plugin-api'; import { Server } from 'http'; -<<<<<<< HEAD -import { TransportStreamOptions } from 'winston-transport'; -======= import { TokenManagerService as TokenManager } from '@backstage/backend-plugin-api'; ->>>>>>> 24636656b5 (Migrate TokenManager types) +import { TransportStreamOptions } from 'winston-transport'; import { UrlReaderService as UrlReader } from '@backstage/backend-plugin-api'; import { V1PodTemplateSpec } from '@kubernetes/client-node'; import * as winston from 'winston'; diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index 39bd85841b..c27d99f7d0 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -7,16 +7,11 @@ import { Config } from '@backstage/config'; import { Handler } from 'express'; +import { JsonValue } from '@backstage/types'; +import { Knex } from 'knex'; import { PermissionEvaluator } from '@backstage/plugin-permission-common'; -import { PluginCacheManager } from '@backstage/backend-common'; -import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginTaskScheduler } from '@backstage/backend-tasks'; import { Readable } from 'stream'; -<<<<<<< HEAD -import { TokenManager } from '@backstage/backend-common'; -======= -import { TransportStreamOptions } from 'winston-transport'; ->>>>>>> 24636656b5 (Migrate TokenManager types) // @public (undocumented) export interface BackendFeature { @@ -67,8 +62,31 @@ export interface BackendRegistrationPoints { }): void; } -// @public (undocumented) -export interface CacheService extends PluginCacheManager {} +// @public +export interface CacheClient { + delete(key: string): Promise; + get(key: string): Promise; + set( + key: string, + value: JsonValue, + options?: CacheClientSetOptions, + ): Promise; +} + +// @public +export type CacheClientOptions = { + defaultTtl?: number; +}; + +// @public +export type CacheClientSetOptions = { + ttl?: number; +}; + +// @public +export interface CacheService { + getClient: (options?: CacheClientOptions) => CacheClient; +} // @public (undocumented) export interface ConfigService extends Config {} @@ -155,8 +173,13 @@ export function createServiceRef(options: { ) => Promise | (() => ServiceFactory)>; }): ServiceRef; -// @public (undocumented) -export interface DatabaseService extends PluginDatabaseManager {} +// @public +export interface DatabaseService { + getClient(): Promise; + migrations?: { + skip?: boolean; + }; +} // @public export interface DiscoveryService { From 8f77536057c28a7767ed9634c3fb47914653de03 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:08:18 +0000 Subject: [PATCH 121/141] fix(deps): update dependency @codemirror/view to v6.7.2 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f67fdc2297..1d13b949f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8970,13 +8970,13 @@ __metadata: linkType: hard "@codemirror/view@npm:^6.0.0": - version: 6.7.1 - resolution: "@codemirror/view@npm:6.7.1" + version: 6.7.2 + resolution: "@codemirror/view@npm:6.7.2" dependencies: "@codemirror/state": ^6.1.4 style-mod: ^4.0.0 w3c-keyname: ^2.2.4 - checksum: 75a5846d61e63027e9bf1dfd0b507932934cb7650b7959c1191e68b161eb1756e9773f964c4331970b51864aef8f7954bc5cc8fdb51b0f6533de6c20568833ed + checksum: ad08a4a0a50e2b34c0141311e7db9f045a2186b81ae28271318374b5b9964435267ec0af210b5d061cb84bc8fdca6dabc1919eb7fe05837d931038b9095c3f8c languageName: node linkType: hard From f23eef3aa225a9cf10dae6569d4b7851f97e83f4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:09:38 +0000 Subject: [PATCH 122/141] chore(deps): update dependency better-sqlite3 to v8 Signed-off-by: Renovate Bot --- .changeset/renovate-a3feeae.md | 7 +++++++ packages/backend-common/package.json | 2 +- packages/backend-test-utils/package.json | 2 +- packages/backend/package.json | 2 +- plugins/catalog-backend/package.json | 2 +- yarn.lock | 16 ++++++++-------- 6 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .changeset/renovate-a3feeae.md diff --git a/.changeset/renovate-a3feeae.md b/.changeset/renovate-a3feeae.md new file mode 100644 index 0000000000..c5aa58d5f2 --- /dev/null +++ b/.changeset/renovate-a3feeae.md @@ -0,0 +1,7 @@ +--- +'@backstage/backend-common': patch +'@backstage/backend-test-utils': patch +'@backstage/plugin-catalog-backend': patch +--- + +Updated dependency `better-sqlite3` to `^8.0.0`. diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index cb3f4776ae..aff5e56abb 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -115,7 +115,7 @@ "@types/webpack-env": "^1.15.2", "@types/yauzl": "^2.10.0", "aws-sdk-mock": "^5.2.1", - "better-sqlite3": "^7.5.0", + "better-sqlite3": "^8.0.0", "http-errors": "^2.0.0", "mock-fs": "^5.1.0", "msw": "^0.49.0", diff --git a/packages/backend-test-utils/package.json b/packages/backend-test-utils/package.json index 337c8e1adf..b1b4ee2d0c 100644 --- a/packages/backend-test-utils/package.json +++ b/packages/backend-test-utils/package.json @@ -39,7 +39,7 @@ "@backstage/backend-plugin-api": "workspace:^", "@backstage/cli": "workspace:^", "@backstage/config": "workspace:^", - "better-sqlite3": "^7.5.0", + "better-sqlite3": "^8.0.0", "knex": "^2.0.0", "msw": "^0.49.0", "mysql2": "^2.2.5", diff --git a/packages/backend/package.json b/packages/backend/package.json index f3508bfb18..085eec665b 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -70,7 +70,7 @@ "@gitbeaker/node": "^35.1.0", "@octokit/rest": "^19.0.3", "azure-devops-node-api": "^11.0.1", - "better-sqlite3": "^7.5.0", + "better-sqlite3": "^8.0.0", "dockerode": "^3.3.1", "example-app": "link:../app", "express": "^4.17.1", diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index b45918dc43..93a5846bbf 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -80,7 +80,7 @@ "@types/lodash": "^4.14.151", "@types/supertest": "^2.0.8", "@types/uuid": "^8.0.0", - "better-sqlite3": "^7.5.0", + "better-sqlite3": "^8.0.0", "luxon": "^3.0.0", "msw": "^0.49.0", "supertest": "^6.1.3", diff --git a/yarn.lock b/yarn.lock index f67fdc2297..c80a5c665e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3431,7 +3431,7 @@ __metadata: aws-sdk: ^2.840.0 aws-sdk-mock: ^5.2.1 base64-stream: ^1.0.0 - better-sqlite3: ^7.5.0 + better-sqlite3: ^8.0.0 compression: ^1.7.4 concat-stream: ^2.0.0 cors: ^2.8.5 @@ -3533,7 +3533,7 @@ __metadata: "@backstage/backend-plugin-api": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" - better-sqlite3: ^7.5.0 + better-sqlite3: ^8.0.0 knex: ^2.0.0 msw: ^0.49.0 mysql2: ^2.2.5 @@ -5243,7 +5243,7 @@ __metadata: "@types/lodash": ^4.14.151 "@types/supertest": ^2.0.8 "@types/uuid": ^8.0.0 - better-sqlite3: ^7.5.0 + better-sqlite3: ^8.0.0 codeowners-utils: ^1.0.2 core-js: ^3.6.5 express: ^4.17.1 @@ -17601,14 +17601,14 @@ __metadata: languageName: node linkType: hard -"better-sqlite3@npm:^7.5.0": - version: 7.6.2 - resolution: "better-sqlite3@npm:7.6.2" +"better-sqlite3@npm:^8.0.0": + version: 8.0.1 + resolution: "better-sqlite3@npm:8.0.1" dependencies: bindings: ^1.5.0 node-gyp: latest prebuild-install: ^7.1.0 - checksum: 45159e535d2c4f81456f85adcfef82e8a49025ca3e70a79bb8c0a47c13e4d822633a51b457cc37b986c42f8912344152091c91cab485048a187900aab7e7d619 + checksum: 533b2cc32bd54e2a943a4f63e079f8cc8945879b7a0ebd2085b948824ea067792f6f903ab75ba75d7cafc5f8f973354cdf9a042fa6216e077925d07a8df1bead languageName: node linkType: hard @@ -22482,7 +22482,7 @@ __metadata: "@types/express-serve-static-core": ^4.17.5 "@types/luxon": ^3.0.0 azure-devops-node-api: ^11.0.1 - better-sqlite3: ^7.5.0 + better-sqlite3: ^8.0.0 dockerode: ^3.3.1 example-app: "link:../app" express: ^4.17.1 From 945935c6551ab252010320caa6081fa47091b960 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:10:41 +0000 Subject: [PATCH 123/141] chore(deps): update dependency puppeteer to v19 Signed-off-by: Renovate Bot --- packages/e2e-test/package.json | 2 +- yarn.lock | 63 +++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/packages/e2e-test/package.json b/packages/e2e-test/package.json index 374eaa6d18..6bef34d633 100644 --- a/packages/e2e-test/package.json +++ b/packages/e2e-test/package.json @@ -40,7 +40,7 @@ "handlebars": "^4.7.3", "nodemon": "^2.0.2", "pgtools": "^0.3.0", - "puppeteer": "^17.0.0", + "puppeteer": "^19.0.0", "tree-kill": "^1.2.2", "ts-node": "^10.0.0" }, diff --git a/yarn.lock b/yarn.lock index 7ed5b1c798..e5d1863896 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19495,6 +19495,18 @@ __metadata: languageName: node linkType: hard +"cosmiconfig@npm:8.0.0": + version: 8.0.0 + resolution: "cosmiconfig@npm:8.0.0" + dependencies: + import-fresh: ^3.2.1 + js-yaml: ^4.1.0 + parse-json: ^5.0.0 + path-type: ^4.0.0 + checksum: ff4cdf89ac1ae52e7520816622c21a9e04380d04b82d653f5139ec581aa4f7f29e096d46770bc76c4a63c225367e88a1dfa233ea791669a35101f5f9b972c7d1 + languageName: node + linkType: hard + "cosmiconfig@npm:^6.0.0": version: 6.0.0 resolution: "cosmiconfig@npm:6.0.0" @@ -20677,10 +20689,10 @@ __metadata: languageName: node linkType: hard -"devtools-protocol@npm:0.0.1036444": - version: 0.0.1036444 - resolution: "devtools-protocol@npm:0.0.1036444" - checksum: 6975c8def95a5e1a4207d6deb05322e335d6a37bdaa3e589cbd5bde40fbbe3ab0df2cfedb1b3ad2785401f208c150fd489a6a065a4624b56e4c0c4c1bfd89172 +"devtools-protocol@npm:0.0.1068969": + version: 0.0.1068969 + resolution: "devtools-protocol@npm:0.0.1068969" + checksum: 53b9c8d661e4148eaf8e990f03902fb3a2cceb06044f661013b6c92dd48ece397ef49fd18401775823c9a33069b4b535502f2559d4f99c74a6bdcb71582b6c8a languageName: node linkType: hard @@ -21060,7 +21072,7 @@ __metadata: handlebars: ^4.7.3 nodemon: ^2.0.2 pgtools: ^0.3.0 - puppeteer: ^17.0.0 + puppeteer: ^19.0.0 tree-kill: ^1.2.2 ts-node: ^10.0.0 bin: @@ -32792,22 +32804,34 @@ __metadata: languageName: node linkType: hard -"puppeteer@npm:^17.0.0": - version: 17.1.3 - resolution: "puppeteer@npm:17.1.3" +"puppeteer-core@npm:19.4.1": + version: 19.4.1 + resolution: "puppeteer-core@npm:19.4.1" dependencies: cross-fetch: 3.1.5 debug: 4.3.4 - devtools-protocol: 0.0.1036444 + devtools-protocol: 0.0.1068969 extract-zip: 2.0.1 https-proxy-agent: 5.0.1 - progress: 2.0.3 proxy-from-env: 1.1.0 rimraf: 3.0.2 tar-fs: 2.1.1 unbzip2-stream: 1.4.3 - ws: 8.8.1 - checksum: b4518956c661df4c37690d46b9c6744d42d59d01fe3764938b4b3af8de4c94ef11a9dfa6bc261798f5e5490c6dce4d4f555f05d42c735249683da3017faf4585 + ws: 8.11.0 + checksum: f4db1aa1d1e642356744bed2dc49ff7960a8b530d147ace1fe067937433ae40234ea973260b9b264d53a2f2297f53df796d008d4756f735b3f0a64a69724eaba + languageName: node + linkType: hard + +"puppeteer@npm:^19.0.0": + version: 19.4.1 + resolution: "puppeteer@npm:19.4.1" + dependencies: + cosmiconfig: 8.0.0 + https-proxy-agent: 5.0.1 + progress: 2.0.3 + proxy-from-env: 1.1.0 + puppeteer-core: 19.4.1 + checksum: 14b6bd8d5f73f389e5bf424df6a89c346b7a8a8d0326b6aa3670e447a98b638b9091f46b6980515d56152b916a4e7be49c21f25fe7bb5c66828e02466a891f57 languageName: node linkType: hard @@ -38781,21 +38805,6 @@ __metadata: languageName: node linkType: hard -"ws@npm:8.8.1": - version: 8.8.1 - resolution: "ws@npm:8.8.1" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 2152cf862cae0693f3775bc688a6afb2e989d19d626d215e70f5fcd8eb55b1c3b0d3a6a4052905ec320e2d7734e20aeedbf9744496d62f15a26ad79cf4cf7dae - languageName: node - linkType: hard - "ws@npm:^5.2.0 || ^6.0.0 || ^7.0.0, ws@npm:^7.3.1, ws@npm:^7.4.6": version: 7.5.9 resolution: "ws@npm:7.5.9" From 7c117a8f59ff289d4bbf84dcbee9675e67642ceb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 17:54:11 +0000 Subject: [PATCH 124/141] chore(deps): update graphqlcodegenerator monorepo Signed-off-by: Renovate Bot --- yarn.lock | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/yarn.lock b/yarn.lock index f4f2e9a774..3871a01338 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9508,8 +9508,8 @@ __metadata: linkType: hard "@graphql-codegen/cli@npm:^2.3.1": - version: 2.16.2 - resolution: "@graphql-codegen/cli@npm:2.16.2" + version: 2.16.3 + resolution: "@graphql-codegen/cli@npm:2.16.3" dependencies: "@babel/generator": ^7.18.13 "@babel/template": ^7.18.10 @@ -9547,12 +9547,13 @@ __metadata: yargs: ^17.0.0 peerDependencies: graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 + ts-node: ">=10" bin: gql-gen: cjs/bin.js graphql-code-generator: cjs/bin.js graphql-codegen: cjs/bin.js graphql-codegen-esm: esm/bin.js - checksum: b44a89ba8c536adccc4fe23446df593b3e5a33d7cefb1602c61a714288e0a8d69cd69fcf8543a59edd6023d8cb0e9ab87fe64e418c2ffb5c45d0e57e17ded06a + checksum: 2ad79b30bace5bfe6f7cdc907fee26e1544000e621f2217417358be2e37322bacc684e98cb629d0a61d63df8e7f8aa365d1ef01c9e3173dce516c028b1bb9ee5 languageName: node linkType: hard @@ -9571,18 +9572,18 @@ __metadata: linkType: hard "@graphql-codegen/graphql-modules-preset@npm:^2.3.2": - version: 2.5.10 - resolution: "@graphql-codegen/graphql-modules-preset@npm:2.5.10" + version: 2.5.11 + resolution: "@graphql-codegen/graphql-modules-preset@npm:2.5.11" dependencies: "@graphql-codegen/plugin-helpers": ^3.1.2 - "@graphql-codegen/visitor-plugin-common": 2.13.6 + "@graphql-codegen/visitor-plugin-common": 2.13.7 "@graphql-tools/utils": ^9.0.0 change-case-all: 1.0.15 parse-filepath: ^1.0.2 tslib: ~2.4.0 peerDependencies: graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: 559b8cc0c837394d0c972d72656e8ea48c04c542885d55fc66471f6fa968cc314f6f6f57576685c0ea0d8072f3f5752ab98ef758b3406bee1915c06e74093c4b + checksum: c77f05964ff1253ee522ee43ef19e939933b3162150da0d6c0c9fb243020f058af1146160aba307427f0ecf6dfafaa16935fc8fe57cb74f94fb784671bb31f6b languageName: node linkType: hard @@ -9616,39 +9617,39 @@ __metadata: linkType: hard "@graphql-codegen/typescript-resolvers@npm:^2.4.3": - version: 2.7.11 - resolution: "@graphql-codegen/typescript-resolvers@npm:2.7.11" + version: 2.7.12 + resolution: "@graphql-codegen/typescript-resolvers@npm:2.7.12" dependencies: "@graphql-codegen/plugin-helpers": ^3.1.2 - "@graphql-codegen/typescript": ^2.8.6 - "@graphql-codegen/visitor-plugin-common": 2.13.6 + "@graphql-codegen/typescript": ^2.8.7 + "@graphql-codegen/visitor-plugin-common": 2.13.7 "@graphql-tools/utils": ^9.0.0 auto-bind: ~4.0.0 tslib: ~2.4.0 peerDependencies: graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: 0954d98f88814dd545cb50cf93d6a6d8616ff6bb999570bd965c177e665a4ff4ed33cf68576c932fd8d630ee0bbcd6888e41801f751f5386286046608167d8ce + checksum: f8f60d972720f42f7407d91febfa4ae91f4e6cc2bd990babe85f8d1c77a3fa8dcc4ac85d8267ce24942703fc28ff6f38f4d8215e098f34fe1b35063aa08ef5a0 languageName: node linkType: hard -"@graphql-codegen/typescript@npm:^2.4.2, @graphql-codegen/typescript@npm:^2.8.6": - version: 2.8.6 - resolution: "@graphql-codegen/typescript@npm:2.8.6" +"@graphql-codegen/typescript@npm:^2.4.2, @graphql-codegen/typescript@npm:^2.8.7": + version: 2.8.7 + resolution: "@graphql-codegen/typescript@npm:2.8.7" dependencies: "@graphql-codegen/plugin-helpers": ^3.1.2 "@graphql-codegen/schema-ast": ^2.6.1 - "@graphql-codegen/visitor-plugin-common": 2.13.6 + "@graphql-codegen/visitor-plugin-common": 2.13.7 auto-bind: ~4.0.0 tslib: ~2.4.0 peerDependencies: graphql: ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: 15f75f1cfea8d632d05a0836cfe657f580d7a49bfafe9b8a143b32f71985b09773dbc45e1e09010654789ea4dba15952767bc3dc412bda16b90eb57a3657f328 + checksum: 67cbafc0dc8695222fd3b2db26c3fcd91148a1dba7bb5dcf71eaf6425dadbaa378c5703f2844e34718954aa283aa95919d8d4650bd1d0b85b22b404ffc3436fa languageName: node linkType: hard -"@graphql-codegen/visitor-plugin-common@npm:2.13.6": - version: 2.13.6 - resolution: "@graphql-codegen/visitor-plugin-common@npm:2.13.6" +"@graphql-codegen/visitor-plugin-common@npm:2.13.7": + version: 2.13.7 + resolution: "@graphql-codegen/visitor-plugin-common@npm:2.13.7" dependencies: "@graphql-codegen/plugin-helpers": ^3.1.2 "@graphql-tools/optimize": ^1.3.0 @@ -9662,7 +9663,7 @@ __metadata: tslib: ~2.4.0 peerDependencies: graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: 3e3bcbe6c7f3fa665b53f35016bce4385fd045ef54b1a986add0b86a14abec6c5b30201496b210ab493afe6bb89bed80f81d164efd643155621fd7bf7fbafec7 + checksum: 4218af8b1542789d9c8c614ccb4362a2b4944d5c3a4a59909844fe9f1f8672825adb28deeb1b9a4d45410e1ae94cde9bd1f5c5d888ae53469260d6668814732e languageName: node linkType: hard From 89589d04a60dab39d2b5080f36d4a41288514f8e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 17:55:24 +0000 Subject: [PATCH 125/141] fix(deps): update dependency @google-cloud/storage to v6.9.0 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f4f2e9a774..39b22dff89 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9450,8 +9450,8 @@ __metadata: linkType: hard "@google-cloud/storage@npm:^6.0.0": - version: 6.8.0 - resolution: "@google-cloud/storage@npm:6.8.0" + version: 6.9.0 + resolution: "@google-cloud/storage@npm:6.9.0" dependencies: "@google-cloud/paginator": ^3.0.7 "@google-cloud/projectify": ^3.0.0 @@ -9470,7 +9470,7 @@ __metadata: retry-request: ^5.0.0 teeny-request: ^8.0.0 uuid: ^8.0.0 - checksum: c0b9eae1eae4aadd22b4ea7699345790adcc063874c5f08477425840001f6822091bdb8db7b67f2a9bb77acbbc4257ed40c14ba5cb2ab91addf2902d56714ddf + checksum: 886b9aad6bd44901b22a6e77c6430bae0effc2137e6c18196d151db8b9690d80726ecc4b60ac1ba315372305010282de6b9845ef23eaa7351449d0193aac62cc languageName: node linkType: hard From 6d9a93def86748c82d7b8fca393e50c635513948 Mon Sep 17 00:00:00 2001 From: Rutuja Marathe Date: Wed, 4 Jan 2023 13:50:10 -0500 Subject: [PATCH 126/141] feat(search-react): customize no result state Signed-off-by: Rutuja Marathe --- .changeset/mean-moles-relate.md | 31 +++++++++++++++++++ plugins/search-react/api-report.md | 1 + .../SearchResult/SearchResult.stories.tsx | 29 +++++++++++++++++ .../SearchResult/SearchResult.test.tsx | 16 ++++++++++ .../components/SearchResult/SearchResult.tsx | 13 +++++--- 5 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 .changeset/mean-moles-relate.md diff --git a/.changeset/mean-moles-relate.md b/.changeset/mean-moles-relate.md new file mode 100644 index 0000000000..1b3d01dd96 --- /dev/null +++ b/.changeset/mean-moles-relate.md @@ -0,0 +1,31 @@ +--- +'@backstage/plugin-search-react': minor +--- + +Allow customizing empty state component through `noResultsComponent` property. + +Example: + +```jsx +No results were found}> + {({ results }) => ( + + {results.map(({ type, document }) => { + switch (type) { + case 'custom-result-item': + return ( + + ); + default: + return ( + + ); + } + })} + + )} + +``` diff --git a/plugins/search-react/api-report.md b/plugins/search-react/api-report.md index ef3e8b19bd..3d1e4091ea 100644 --- a/plugins/search-react/api-report.md +++ b/plugins/search-react/api-report.md @@ -402,6 +402,7 @@ export const SearchResultPager: () => JSX.Element; // @public export type SearchResultProps = Pick & { children: (resultSet: SearchResultSet) => JSX.Element; + noResultsComponent?: JSX.Element; }; // @public diff --git a/plugins/search-react/src/components/SearchResult/SearchResult.stories.tsx b/plugins/search-react/src/components/SearchResult/SearchResult.stories.tsx index 6f536510e8..ef9b0d6b5c 100644 --- a/plugins/search-react/src/components/SearchResult/SearchResult.stories.tsx +++ b/plugins/search-react/src/components/SearchResult/SearchResult.stories.tsx @@ -218,3 +218,32 @@ export const GroupLayout = () => { ); }; + +export const WithCustomNoResultsComponent = () => { + return ( + No results were found}> + {({ results }) => ( + + {results.map(({ type, document }) => { + switch (type) { + case 'custom-result-item': + return ( + + ); + default: + return ( + + ); + } + })} + + )} + + ); +}; diff --git a/plugins/search-react/src/components/SearchResult/SearchResult.test.tsx b/plugins/search-react/src/components/SearchResult/SearchResult.test.tsx index 988d59d7cf..5972eaa891 100644 --- a/plugins/search-react/src/components/SearchResult/SearchResult.test.tsx +++ b/plugins/search-react/src/components/SearchResult/SearchResult.test.tsx @@ -93,6 +93,22 @@ describe('SearchResult', () => { }); }); + it('On empty result value state with custom component', async () => { + (useSearch as jest.Mock).mockReturnValueOnce({ + result: { loading: false, error: '', value: { results: [] } }, + }); + + const { getByText } = await renderInTestApp( + No results found}> + {() => <>} + , + ); + + await waitFor(() => { + expect(getByText('No results found')).toBeInTheDocument(); + }); + }); + it('Calls children with results set to result.value', async () => { (useSearch as jest.Mock).mockReturnValueOnce({ result: { diff --git a/plugins/search-react/src/components/SearchResult/SearchResult.tsx b/plugins/search-react/src/components/SearchResult/SearchResult.tsx index dd11f42903..333156aab9 100644 --- a/plugins/search-react/src/components/SearchResult/SearchResult.tsx +++ b/plugins/search-react/src/components/SearchResult/SearchResult.tsx @@ -167,6 +167,7 @@ export const SearchResultState = (props: SearchResultStateProps) => { */ export type SearchResultProps = Pick & { children: (resultSet: SearchResultSet) => JSX.Element; + noResultsComponent?: JSX.Element; }; /** @@ -176,7 +177,13 @@ export type SearchResultProps = Pick & { * @public */ export const SearchResultComponent = (props: SearchResultProps) => { - const { query, children } = props; + const { + query, + children, + noResultsComponent = ( + + ), + } = props; return ( @@ -195,9 +202,7 @@ export const SearchResultComponent = (props: SearchResultProps) => { } if (!value?.results.length) { - return ( - - ); + return noResultsComponent; } return children(value); From b8269de9f1eb19117804a8aebb1421a32ce9c7bd Mon Sep 17 00:00:00 2001 From: Mark David Avery Date: Wed, 28 Dec 2022 11:13:50 -0800 Subject: [PATCH 127/141] style(react 18): explicitly declaring children as optional props This is to facilitate the react 18 upgrade which introduced the requirement to explicily declare children as props Helps to address #12252 Signed-off-by: Mark David Avery --- .changeset/sharp-icons-obey.md | 6 ++++++ plugins/scaffolder/api-report.md | 4 +++- plugins/scaffolder/src/extensions/index.tsx | 5 +++-- plugins/techdocs-react/api-report.md | 4 +++- plugins/techdocs-react/src/addons.tsx | 8 ++++++-- 5 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 .changeset/sharp-icons-obey.md diff --git a/.changeset/sharp-icons-obey.md b/.changeset/sharp-icons-obey.md new file mode 100644 index 0000000000..2620dd9a07 --- /dev/null +++ b/.changeset/sharp-icons-obey.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-techdocs-react': patch +'@backstage/plugin-scaffolder': patch +--- + +Explicitly declaring children as optional props to facilitate react 18 changes diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 1c4d163123..bb45ad3b44 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -552,7 +552,9 @@ export interface ScaffolderDryRunResponse { } // @public -export const ScaffolderFieldExtensions: React_2.ComponentType; +export const ScaffolderFieldExtensions: React_2.ComponentType< + React_2.PropsWithChildren<{}> +>; // @public export interface ScaffolderGetIntegrationsListOptions { diff --git a/plugins/scaffolder/src/extensions/index.tsx b/plugins/scaffolder/src/extensions/index.tsx index a3a4fdf57b..2b3126ac58 100644 --- a/plugins/scaffolder/src/extensions/index.tsx +++ b/plugins/scaffolder/src/extensions/index.tsx @@ -94,8 +94,9 @@ export function createNextScaffolderFieldExtension< * * @public */ -export const ScaffolderFieldExtensions: React.ComponentType = - (): JSX.Element | null => null; +export const ScaffolderFieldExtensions: React.ComponentType< + React.PropsWithChildren<{}> +> = (): JSX.Element | null => null; attachComponentData( ScaffolderFieldExtensions, diff --git a/plugins/techdocs-react/api-report.md b/plugins/techdocs-react/api-report.md index f1d6d3f177..cf64762fda 100644 --- a/plugins/techdocs-react/api-report.md +++ b/plugins/techdocs-react/api-report.md @@ -56,7 +56,9 @@ export type TechDocsAddonOptions = { }; // @public -export const TechDocsAddons: React_2.ComponentType; +export const TechDocsAddons: React_2.ComponentType< + React_2.PropsWithChildren<{}> +>; // @public export interface TechDocsApi { diff --git a/plugins/techdocs-react/src/addons.tsx b/plugins/techdocs-react/src/addons.tsx index d77f53a426..54aea0352d 100644 --- a/plugins/techdocs-react/src/addons.tsx +++ b/plugins/techdocs-react/src/addons.tsx @@ -43,7 +43,9 @@ export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1'; * TechDocs Addon registry. * @public */ -export const TechDocsAddons: React.ComponentType = () => null; +export const TechDocsAddons: React.ComponentType< + React.PropsWithChildren<{}> +> = () => null; attachComponentData(TechDocsAddons, TECHDOCS_ADDONS_WRAPPER_KEY, true); @@ -71,7 +73,9 @@ export function createTechDocsAddonExtension( * Create a TechDocs addon implementation. * @public */ -export function createTechDocsAddonExtension( +export function createTechDocsAddonExtension< + TComponentProps extends React.PropsWithChildren<{}>, +>( options: TechDocsAddonOptions, ): Extension<(props: TComponentProps) => JSX.Element | null> { const { name, component: TechDocsAddon } = options; From 923296999bf411643dabddb03915fa93e0459e88 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Wed, 4 Jan 2023 14:29:03 -0500 Subject: [PATCH 128/141] fix(docs): Errant dash in a sentence Signed-off-by: Adam Harvey --- docs/getting-started/keeping-backstage-updated.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/keeping-backstage-updated.md b/docs/getting-started/keeping-backstage-updated.md index 8e130e7094..e7324f4603 100644 --- a/docs/getting-started/keeping-backstage-updated.md +++ b/docs/getting-started/keeping-backstage-updated.md @@ -47,7 +47,7 @@ For this reason, any changes made to the template are documented along with upgrade instructions in the [changelog](https://github.com/backstage/backstage/blob/master/packages/create-app/CHANGELOG.md) of the `@backstage/create-app` package. We recommend peeking at this changelog --for any applicable updates when upgrading packages. As an alternative, the +for any applicable updates when upgrading packages. As an alternative, the [Backstage Upgrade Helper](https://backstage.github.io/upgrade-helper/) provides a consolidated view of all the changes between two versions of Backstage. You can find the current version of your Backstage installation in `backstage.json`. From 6e251d71cd048983215973e6e123b92b3a1ba797 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 22:42:48 +0000 Subject: [PATCH 129/141] chore(deps): update dependency esbuild to v0.16.14 Signed-off-by: Renovate Bot --- yarn.lock | 182 +++++++++++++++++++++++++++--------------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7b70d5b4c2..f0abd8ff36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9153,9 +9153,9 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/android-arm64@npm:0.16.13" +"@esbuild/android-arm64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/android-arm64@npm:0.16.14" conditions: os=android & cpu=arm64 languageName: node linkType: hard @@ -9167,65 +9167,65 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/android-arm@npm:0.16.13" +"@esbuild/android-arm@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/android-arm@npm:0.16.14" conditions: os=android & cpu=arm languageName: node linkType: hard -"@esbuild/android-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/android-x64@npm:0.16.13" +"@esbuild/android-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/android-x64@npm:0.16.14" conditions: os=android & cpu=x64 languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/darwin-arm64@npm:0.16.13" +"@esbuild/darwin-arm64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/darwin-arm64@npm:0.16.14" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/darwin-x64@npm:0.16.13" +"@esbuild/darwin-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/darwin-x64@npm:0.16.14" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/freebsd-arm64@npm:0.16.13" +"@esbuild/freebsd-arm64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/freebsd-arm64@npm:0.16.14" conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/freebsd-x64@npm:0.16.13" +"@esbuild/freebsd-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/freebsd-x64@npm:0.16.14" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-arm64@npm:0.16.13" +"@esbuild/linux-arm64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-arm64@npm:0.16.14" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-arm@npm:0.16.13" +"@esbuild/linux-arm@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-arm@npm:0.16.14" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-ia32@npm:0.16.13" +"@esbuild/linux-ia32@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-ia32@npm:0.16.14" conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -9237,86 +9237,86 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-loong64@npm:0.16.13" +"@esbuild/linux-loong64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-loong64@npm:0.16.14" conditions: os=linux & cpu=loong64 languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-mips64el@npm:0.16.13" +"@esbuild/linux-mips64el@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-mips64el@npm:0.16.14" conditions: os=linux & cpu=mips64el languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-ppc64@npm:0.16.13" +"@esbuild/linux-ppc64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-ppc64@npm:0.16.14" conditions: os=linux & cpu=ppc64 languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-riscv64@npm:0.16.13" +"@esbuild/linux-riscv64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-riscv64@npm:0.16.14" conditions: os=linux & cpu=riscv64 languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-s390x@npm:0.16.13" +"@esbuild/linux-s390x@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-s390x@npm:0.16.14" conditions: os=linux & cpu=s390x languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/linux-x64@npm:0.16.13" +"@esbuild/linux-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/linux-x64@npm:0.16.14" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/netbsd-x64@npm:0.16.13" +"@esbuild/netbsd-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/netbsd-x64@npm:0.16.14" conditions: os=netbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/openbsd-x64@npm:0.16.13" +"@esbuild/openbsd-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/openbsd-x64@npm:0.16.14" conditions: os=openbsd & cpu=x64 languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/sunos-x64@npm:0.16.13" +"@esbuild/sunos-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/sunos-x64@npm:0.16.14" conditions: os=sunos & cpu=x64 languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/win32-arm64@npm:0.16.13" +"@esbuild/win32-arm64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/win32-arm64@npm:0.16.14" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/win32-ia32@npm:0.16.13" +"@esbuild/win32-ia32@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/win32-ia32@npm:0.16.14" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.16.13": - version: 0.16.13 - resolution: "@esbuild/win32-x64@npm:0.16.13" +"@esbuild/win32-x64@npm:0.16.14": + version: 0.16.14 + resolution: "@esbuild/win32-x64@npm:0.16.14" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -21672,31 +21672,31 @@ __metadata: linkType: hard "esbuild@npm:^0.16.0": - version: 0.16.13 - resolution: "esbuild@npm:0.16.13" + version: 0.16.14 + resolution: "esbuild@npm:0.16.14" dependencies: - "@esbuild/android-arm": 0.16.13 - "@esbuild/android-arm64": 0.16.13 - "@esbuild/android-x64": 0.16.13 - "@esbuild/darwin-arm64": 0.16.13 - "@esbuild/darwin-x64": 0.16.13 - "@esbuild/freebsd-arm64": 0.16.13 - "@esbuild/freebsd-x64": 0.16.13 - "@esbuild/linux-arm": 0.16.13 - "@esbuild/linux-arm64": 0.16.13 - "@esbuild/linux-ia32": 0.16.13 - "@esbuild/linux-loong64": 0.16.13 - "@esbuild/linux-mips64el": 0.16.13 - "@esbuild/linux-ppc64": 0.16.13 - "@esbuild/linux-riscv64": 0.16.13 - "@esbuild/linux-s390x": 0.16.13 - "@esbuild/linux-x64": 0.16.13 - "@esbuild/netbsd-x64": 0.16.13 - "@esbuild/openbsd-x64": 0.16.13 - "@esbuild/sunos-x64": 0.16.13 - "@esbuild/win32-arm64": 0.16.13 - "@esbuild/win32-ia32": 0.16.13 - "@esbuild/win32-x64": 0.16.13 + "@esbuild/android-arm": 0.16.14 + "@esbuild/android-arm64": 0.16.14 + "@esbuild/android-x64": 0.16.14 + "@esbuild/darwin-arm64": 0.16.14 + "@esbuild/darwin-x64": 0.16.14 + "@esbuild/freebsd-arm64": 0.16.14 + "@esbuild/freebsd-x64": 0.16.14 + "@esbuild/linux-arm": 0.16.14 + "@esbuild/linux-arm64": 0.16.14 + "@esbuild/linux-ia32": 0.16.14 + "@esbuild/linux-loong64": 0.16.14 + "@esbuild/linux-mips64el": 0.16.14 + "@esbuild/linux-ppc64": 0.16.14 + "@esbuild/linux-riscv64": 0.16.14 + "@esbuild/linux-s390x": 0.16.14 + "@esbuild/linux-x64": 0.16.14 + "@esbuild/netbsd-x64": 0.16.14 + "@esbuild/openbsd-x64": 0.16.14 + "@esbuild/sunos-x64": 0.16.14 + "@esbuild/win32-arm64": 0.16.14 + "@esbuild/win32-ia32": 0.16.14 + "@esbuild/win32-x64": 0.16.14 dependenciesMeta: "@esbuild/android-arm": optional: true @@ -21744,7 +21744,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: dd78945c45ab70d59a1933374ea3403d942165d34fabbf4f75c315761c31e86599c8c41f8da253499f0fe3a7d023f7602e1d51eb8e764056e588c1069c7b3104 + checksum: befe262cce76f30518834a385922984a363c9223e8c4c03afc9b54fa43376cc47cadf526a335e97794c824bff395f303f1d51334dbea5e1923a361ee39267cf3 languageName: node linkType: hard From 6ad3eab3d9bcd5fb1ed5d996aff3d4870b2425d8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 23:29:11 +0000 Subject: [PATCH 130/141] fix(deps): update dependency luxon to v3.2.1 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f0abd8ff36..f922d4440c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28415,9 +28415,9 @@ __metadata: linkType: hard "luxon@npm:^3.0.0": - version: 3.2.0 - resolution: "luxon@npm:3.2.0" - checksum: 9a54fc68f1735259095299616c7d01967fb52a9c3500c6b31f97c477574122c62dc0f119d13abc04daaf545e1b8f37a63642b45cd04a240ff59987ceb6ec02c0 + version: 3.2.1 + resolution: "luxon@npm:3.2.1" + checksum: 3fa3def2c5f5d3032b4c46220c4da8aeb467ac979888fc9d2557adcd22195f93516b4ad5909a75862bec8dc6ddc0953b0f38e6d2f4a8ab8450ddc531a83cf20d languageName: node linkType: hard From 09b19f91e2c18a509f2dd09475a132d755b4ba2b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 00:11:10 +0000 Subject: [PATCH 131/141] fix(deps): update dependency @octokit/webhooks to v10.5.0 Signed-off-by: Renovate Bot --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f922d4440c..bd98e2eca8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12518,14 +12518,14 @@ __metadata: linkType: hard "@octokit/webhooks@npm:^10.0.0": - version: 10.4.0 - resolution: "@octokit/webhooks@npm:10.4.0" + version: 10.5.0 + resolution: "@octokit/webhooks@npm:10.5.0" dependencies: "@octokit/request-error": ^3.0.0 "@octokit/webhooks-methods": ^3.0.0 "@octokit/webhooks-types": 6.7.0 aggregate-error: ^3.1.0 - checksum: 418de82c4840024d608bb523ffc6c98f07179a40096a9970d9ac2e09bc98e99a25c035d57038c992b3c764ae085a62befbc0165ebacda8963aa513aa72330f74 + checksum: eb1ff2cc8f14537e619d2502d0d281920e11cc68f96d587a3a38fecf7d4453cc3dac567f532a2252f067dec7044a1b53e7c043d8be4732f3c0a8b1b0b8ddee8b languageName: node linkType: hard From 1a53a735b77e429cd33fe0eaa4db8d2496c9c0e4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 00:57:10 +0000 Subject: [PATCH 132/141] chore(deps): update dependency swr to v2 Signed-off-by: Renovate Bot --- .changeset/renovate-e7f8e3a.md | 6 ++++++ plugins/permission-react/package.json | 2 +- plugins/playlist/package.json | 2 +- yarn.lock | 15 +++++++++++++-- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 .changeset/renovate-e7f8e3a.md diff --git a/.changeset/renovate-e7f8e3a.md b/.changeset/renovate-e7f8e3a.md new file mode 100644 index 0000000000..6947a05d2d --- /dev/null +++ b/.changeset/renovate-e7f8e3a.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-permission-react': patch +'@backstage/plugin-playlist': patch +--- + +Updated dependency `swr` to `^2.0.0`. diff --git a/plugins/permission-react/package.json b/plugins/permission-react/package.json index 7801bcbbba..ca23474ba3 100644 --- a/plugins/permission-react/package.json +++ b/plugins/permission-react/package.json @@ -36,7 +36,7 @@ "@backstage/plugin-permission-common": "workspace:^", "cross-fetch": "^3.1.5", "react-use": "^17.2.4", - "swr": "^1.1.2" + "swr": "^2.0.0" }, "peerDependencies": { "@types/react": "^16.13.1 || ^17.0.0", diff --git a/plugins/playlist/package.json b/plugins/playlist/package.json index 359883a05e..b494e416f6 100644 --- a/plugins/playlist/package.json +++ b/plugins/playlist/package.json @@ -62,7 +62,7 @@ "@types/node": "*", "cross-fetch": "^3.1.5", "msw": "^0.49.0", - "swr": "^1.1.2" + "swr": "^2.0.0" }, "files": [ "dist" diff --git a/yarn.lock b/yarn.lock index bd98e2eca8..0840187b7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7140,7 +7140,7 @@ __metadata: "@testing-library/react": ^12.1.3 cross-fetch: ^3.1.5 react-use: ^17.2.4 - swr: ^1.1.2 + swr: ^2.0.0 peerDependencies: "@types/react": ^16.13.1 || ^17.0.0 react: ^16.13.1 || ^17.0.0 @@ -7220,7 +7220,7 @@ __metadata: qs: ^6.9.4 react-hook-form: ^7.13.0 react-use: ^17.2.4 - swr: ^1.1.2 + swr: ^2.0.0 peerDependencies: react: ^16.13.1 || ^17.0.0 react-router-dom: 6.0.0-beta.0 || ^6.3.0 @@ -36495,6 +36495,17 @@ __metadata: languageName: node linkType: hard +"swr@npm:^2.0.0": + version: 2.0.0 + resolution: "swr@npm:2.0.0" + dependencies: + use-sync-external-store: ^1.2.0 + peerDependencies: + react: ^16.11.0 || ^17.0.0 || ^18.0.0 + checksum: 4852d8318ed022a681b40a384e675f65e211104d62075c1250b02f47cc8b739cb9138a954e2191c700e2de22b010b9bd05a113c71b193abe0c351d3c4f4646d8 + languageName: node + linkType: hard + "symbol-observable@npm:1.2.0, symbol-observable@npm:^1.0.4": version: 1.2.0 resolution: "symbol-observable@npm:1.2.0" From 0358d399ad5df3e191d5be1a909522f858163d3a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 07:37:27 +0000 Subject: [PATCH 133/141] chore(deps): update dependency ts-morph to v17 Signed-off-by: Renovate Bot --- .changeset/renovate-492e599.md | 5 +++ plugins/bitbucket-cloud-common/package.json | 2 +- yarn.lock | 42 ++++++++++----------- 3 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 .changeset/renovate-492e599.md diff --git a/.changeset/renovate-492e599.md b/.changeset/renovate-492e599.md new file mode 100644 index 0000000000..7c98b20f8d --- /dev/null +++ b/.changeset/renovate-492e599.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-bitbucket-cloud-common': patch +--- + +Updated dependency `ts-morph` to `^17.0.0`. diff --git a/plugins/bitbucket-cloud-common/package.json b/plugins/bitbucket-cloud-common/package.json index 1ea48b000e..985949c836 100644 --- a/plugins/bitbucket-cloud-common/package.json +++ b/plugins/bitbucket-cloud-common/package.json @@ -34,7 +34,7 @@ "@backstage/cli": "workspace:^", "@openapitools/openapi-generator-cli": "^2.4.26", "msw": "^0.49.0", - "ts-morph": "^15.0.0" + "ts-morph": "^17.0.0" }, "files": [ "dist" diff --git a/yarn.lock b/yarn.lock index 62ba86f926..130e72eeaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4874,7 +4874,7 @@ __metadata: "@openapitools/openapi-generator-cli": ^2.4.26 cross-fetch: ^3.1.5 msw: ^0.49.0 - ts-morph: ^15.0.0 + ts-morph: ^17.0.0 languageName: unknown linkType: soft @@ -13835,15 +13835,15 @@ __metadata: languageName: node linkType: hard -"@ts-morph/common@npm:~0.16.0": - version: 0.16.0 - resolution: "@ts-morph/common@npm:0.16.0" +"@ts-morph/common@npm:~0.18.0": + version: 0.18.1 + resolution: "@ts-morph/common@npm:0.18.1" dependencies: - fast-glob: ^3.2.11 + fast-glob: ^3.2.12 minimatch: ^5.1.0 mkdirp: ^1.0.4 path-browserify: ^1.0.1 - checksum: 0ef97330a164a42b81b0499b042e91db8e39d705bb983ef83cbc80cc32ab36123e26baefb78203953d1a0c6e3b92cad9bc7a5e0ea409623a5e7db90cb3742112 + checksum: 848fff5f7a6428d7c2f055de20cf8df864a967aac0cc03adc558d853442085a8fd9dec70429da24d67d263794b315edb0791c46d23ad9ae513251a7702df8031 languageName: node linkType: hard @@ -18793,12 +18793,10 @@ __metadata: languageName: node linkType: hard -"code-block-writer@npm:^11.0.0": - version: 11.0.0 - resolution: "code-block-writer@npm:11.0.0" - dependencies: - tslib: 2.3.1 - checksum: d3d92a06f762d5926ecdb2033e4f30eb4c51aca365ea69ef424afbce7cc2b1518a50deff2645cc17b6fa53f234d664631f2268a4caf91af6a1fd696aa0b2fefb +"code-block-writer@npm:^11.0.3": + version: 11.0.3 + resolution: "code-block-writer@npm:11.0.3" + checksum: f0a2605f19963d7087267c9b0fd0b05a6638a50e7b29b70f97aa01a514f59475b0626f8aa092188df853ee6d96745426dfa132d6a677795df462c6ce32c21639 languageName: node linkType: hard @@ -22814,16 +22812,16 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9": - version: 3.2.11 - resolution: "fast-glob@npm:3.2.11" +"fast-glob@npm:^3.2.12, fast-glob@npm:^3.2.9": + version: 3.2.12 + resolution: "fast-glob@npm:3.2.12" dependencies: "@nodelib/fs.stat": ^2.0.2 "@nodelib/fs.walk": ^1.2.3 glob-parent: ^5.1.2 merge2: ^1.3.0 micromatch: ^4.0.4 - checksum: f473105324a7780a20c06de842e15ddbb41d3cb7e71d1e4fe6e8373204f22245d54f5ab9e2061e6a1c613047345954d29b022e0e76f5c28b1df9858179a0e6d7 + checksum: 0b1990f6ce831c7e28c4d505edcdaad8e27e88ab9fa65eedadb730438cfc7cde4910d6c975d6b7b8dc8a73da4773702ebcfcd6e3518e73938bb1383badfe01c2 languageName: node linkType: hard @@ -37136,13 +37134,13 @@ __metadata: languageName: node linkType: hard -"ts-morph@npm:^15.0.0": - version: 15.1.0 - resolution: "ts-morph@npm:15.1.0" +"ts-morph@npm:^17.0.0": + version: 17.0.1 + resolution: "ts-morph@npm:17.0.1" dependencies: - "@ts-morph/common": ~0.16.0 - code-block-writer: ^11.0.0 - checksum: 95e026214282850f08d1d4de673e969cdc166cb6d9366e455e1ea0251a204f80cffcb958c8ed7b1f351e56b972c4244e0dc7be0b13df3c4a6f22abdd4d4608e4 + "@ts-morph/common": ~0.18.0 + code-block-writer: ^11.0.3 + checksum: 4748ab45d0fb0be235f69399ea217cf1c5984ad2ef3ff9eba5a417571f73098c6f1f765fc011eaadc48179471b977f1e44f72eb993932e5c74c5031ab6c60f3a languageName: node linkType: hard From 413767a5f1174a41bdb0573dc875e138cfaa8928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 20 Dec 2022 12:02:04 +0100 Subject: [PATCH 134/141] added docs for /entities/by-refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- docs/features/software-catalog/api.md | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/features/software-catalog/api.md b/docs/features/software-catalog/api.md index afd9a0af93..1020d636d7 100644 --- a/docs/features/software-catalog/api.md +++ b/docs/features/software-catalog/api.md @@ -246,6 +246,37 @@ value. These are special in that they form the entity's unique The return type is JSON, as a single [`Entity`](descriptor-format.md), or a 404 error if there was no entity with that reference triplet. +### `POST /entities/by-refs` + +Gets a batch of entities by their entity refs. This is useful in contexts where +you want to fetch a large number of specific entities efficiently, for example +in GraphQL resolvers. + +The request body is JSON, on the form + +```json +{ + "entityRefs": ["component:default/foo", "api:default/bar"] +} +``` + +where each entry is an entity ref that you want to fetch. + +The return type is JSON, on the form + +```json +{ + "items": [ + { "apiVersion": "backstage.io/v1alpha1", "kind": "Component", ... }, + null + ] +} +``` + +where the `items` array has _the same length_ and _the same order_ as the input +`entityRefs` array. Each element contains the corresponding entity data, or +`null` if no entity existed in the catalog with that ref. + ## Locations TODO From 7307d4db39a041c933e11b4519a930af1af83c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 21 Dec 2022 14:18:00 +0100 Subject: [PATCH 135/141] mention fields too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- docs/features/software-catalog/api.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/features/software-catalog/api.md b/docs/features/software-catalog/api.md index 1020d636d7..943b1a8fd5 100644 --- a/docs/features/software-catalog/api.md +++ b/docs/features/software-catalog/api.md @@ -277,6 +277,11 @@ where the `items` array has _the same length_ and _the same order_ as the input `entityRefs` array. Each element contains the corresponding entity data, or `null` if no entity existed in the catalog with that ref. +You can also add `fields` query parameters in the exact same way as `GET +/entities` above, to fetch only certain slices of each entity. At this point you +can only specify these as query parameters on the URL, not in the request body. +Providing them in the body may be added in the future. + ## Locations TODO From e23f13a573838612e7f91da2bbfdeee256b7a361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 21 Dec 2022 15:10:31 +0100 Subject: [PATCH 136/141] add post body fields too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/popular-cameras-worry.md | 6 +++ docs/features/software-catalog/api.md | 17 +++--- .../catalog-client/src/CatalogClient.test.ts | 2 +- packages/catalog-client/src/CatalogClient.ts | 9 ++-- .../src/service/createRouter.test.ts | 8 ++- .../src/service/createRouter.ts | 2 +- .../service/request/entitiesBatchRequest.ts | 3 +- .../parseEntityTransformParams.test.ts | 52 +++++++++++++------ .../request/parseEntityTransformParams.ts | 27 ++++++---- 9 files changed, 79 insertions(+), 47 deletions(-) create mode 100644 .changeset/popular-cameras-worry.md diff --git a/.changeset/popular-cameras-worry.md b/.changeset/popular-cameras-worry.md new file mode 100644 index 0000000000..a5cbd6562b --- /dev/null +++ b/.changeset/popular-cameras-worry.md @@ -0,0 +1,6 @@ +--- +'@backstage/catalog-client': patch +'@backstage/plugin-catalog-backend': patch +--- + +Enable the `by-refs` endpoint to receive `fields` through the POST body as well as through query parameters. diff --git a/docs/features/software-catalog/api.md b/docs/features/software-catalog/api.md index 943b1a8fd5..3ca7e5ef49 100644 --- a/docs/features/software-catalog/api.md +++ b/docs/features/software-catalog/api.md @@ -256,20 +256,20 @@ The request body is JSON, on the form ```json { - "entityRefs": ["component:default/foo", "api:default/bar"] + "entityRefs": ["component:default/foo", "api:default/bar"], + "fields": ["kind", "metadata.name"] } ``` -where each entry is an entity ref that you want to fetch. +where each `entityRefs` entry is an entity ref that you want to fetch. The +`fields` array is optional and works the same way as the `GET /entities` fields +above, e.g. it's used to fetch only certain slices of each entity. The return type is JSON, on the form ```json { - "items": [ - { "apiVersion": "backstage.io/v1alpha1", "kind": "Component", ... }, - null - ] + "items": [{ "kind": "Component", "metadata": { "name": "foo" } }, null] } ``` @@ -277,11 +277,6 @@ where the `items` array has _the same length_ and _the same order_ as the input `entityRefs` array. Each element contains the corresponding entity data, or `null` if no entity existed in the catalog with that ref. -You can also add `fields` query parameters in the exact same way as `GET -/entities` above, to fetch only certain slices of each entity. At this point you -can only specify these as query parameters on the URL, not in the request body. -Providing them in the body may be added in the future. - ## Locations TODO diff --git a/packages/catalog-client/src/CatalogClient.test.ts b/packages/catalog-client/src/CatalogClient.test.ts index 8587a5a2e1..2e9d2a0679 100644 --- a/packages/catalog-client/src/CatalogClient.test.ts +++ b/packages/catalog-client/src/CatalogClient.test.ts @@ -232,9 +232,9 @@ describe('CatalogClient', () => { }; server.use( rest.post(`${mockBaseUrl}/entities/by-refs`, async (req, res, ctx) => { - expect(req.url.searchParams.get('fields')).toBe('a,b'); await expect(req.json()).resolves.toEqual({ entityRefs: ['k:n/a', 'k:n/b'], + fields: ['a', 'b'], }); return res(ctx.json({ items: [entity, null] })); }), diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index 81f7343555..af4262b842 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -197,14 +197,13 @@ export class CatalogClient implements CatalogApi { request: GetEntitiesByRefsRequest, options?: CatalogRequestOptions, ): Promise { - const params: string[] = []; + const body: any = { entityRefs: request.entityRefs }; if (request.fields?.length) { - params.push(`fields=${request.fields.map(encodeURIComponent).join(',')}`); + body.fields = request.fields; } const baseUrl = await this.discoveryApi.getBaseUrl('catalog'); - const query = params.length ? `?${params.join('&')}` : ''; - const url = `${baseUrl}/entities/by-refs${query}`; + const url = `${baseUrl}/entities/by-refs`; const response = await this.fetchApi.fetch(url, { headers: { @@ -212,7 +211,7 @@ export class CatalogClient implements CatalogApi { ...(options?.token && { Authorization: `Bearer ${options?.token}` }), }, method: 'POST', - body: JSON.stringify({ entityRefs: request.entityRefs }), + body: JSON.stringify(body), }); if (!response.ok) { diff --git a/plugins/catalog-backend/src/service/createRouter.test.ts b/plugins/catalog-backend/src/service/createRouter.test.ts index 541359feb6..6379d65043 100644 --- a/plugins/catalog-backend/src/service/createRouter.test.ts +++ b/plugins/catalog-backend/src/service/createRouter.test.ts @@ -268,6 +268,8 @@ describe('createRouter readonly disabled', () => { '{"unknown":7}', '{"entityRefs":7}', '{"entityRefs":[7]}', + '{"entityRefs":[7],"fields":7}', + '{"entityRefs":[7],"fields":[7]}', ])('properly rejects malformed request body, %p', async p => { await expect( request(app) @@ -283,8 +285,12 @@ describe('createRouter readonly disabled', () => { const response = await request(app) .post('/entities/by-refs') .set('Content-Type', 'application/json') - .send('{"entityRefs":["a"]}'); + .send('{"entityRefs":["a"],"fields":["b"]}'); expect(entitiesCatalog.entitiesBatch).toHaveBeenCalledTimes(1); + expect(entitiesCatalog.entitiesBatch).toHaveBeenCalledWith({ + entityRefs: ['a'], + fields: expect.any(Function), + }); expect(response.status).toEqual(200); expect(response.body).toEqual({ items: [entity] }); }); diff --git a/plugins/catalog-backend/src/service/createRouter.ts b/plugins/catalog-backend/src/service/createRouter.ts index 6a31fcd0b6..62a0f970c9 100644 --- a/plugins/catalog-backend/src/service/createRouter.ts +++ b/plugins/catalog-backend/src/service/createRouter.ts @@ -181,7 +181,7 @@ export async function createRouter( const token = getBearerToken(req.header('authorization')); const response = await entitiesCatalog.entitiesBatch({ entityRefs: request.entityRefs, - fields: parseEntityTransformParams(req.query), + fields: parseEntityTransformParams(req.query, request.fields), authorizationToken: token, }); res.status(200).json(response); diff --git a/plugins/catalog-backend/src/service/request/entitiesBatchRequest.ts b/plugins/catalog-backend/src/service/request/entitiesBatchRequest.ts index b3a91f9491..d5469315be 100644 --- a/plugins/catalog-backend/src/service/request/entitiesBatchRequest.ts +++ b/plugins/catalog-backend/src/service/request/entitiesBatchRequest.ts @@ -20,9 +20,10 @@ import { z } from 'zod'; const schema = z.object({ entityRefs: z.array(z.string()), + fields: z.array(z.string()).optional(), }); -export function entitiesBatchRequest(req: Request) { +export function entitiesBatchRequest(req: Request): z.infer { try { return schema.parse(req.body); } catch (error) { diff --git a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts index 3dce579ae5..16141e401c 100644 --- a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts +++ b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts @@ -18,22 +18,26 @@ import { Entity } from '@backstage/catalog-model'; import { parseEntityTransformParams } from './parseEntityTransformParams'; describe('parseEntityTransformParams', () => { - const entity: Entity = { - apiVersion: 'av', - kind: 'k', - metadata: { - name: 'n', - tags: ['t1', 't2'], - annotations: { - 'example.test/url-like-key': 'ul1', - 'example.com/other-url-like-key': 'ul2', - 'other-example.test/next-url-like-key': 'ul3', + let entity: Entity; + + beforeEach(() => { + entity = { + apiVersion: 'av', + kind: 'k', + metadata: { + name: 'n', + tags: ['t1', 't2'], + annotations: { + 'example.test/url-like-key': 'ul1', + 'example.com/other-url-like-key': 'ul2', + 'other-example.test/next-url-like-key': 'ul3', + }, }, - }, - spec: { - type: 't', - }, - }; + spec: { + type: 't', + }, + }; + }); it('returns undefined when no fields given', () => { expect(parseEntityTransformParams({})).toBeUndefined(); @@ -46,7 +50,9 @@ describe('parseEntityTransformParams', () => { it('rejects attempts at array filtering', () => { expect(() => parseEntityTransformParams({ fields: 'metadata.tags[0]' })!(entity), - ).toThrow(/invalid fields, array type fields are not supported/i); + ).toThrow( + 'Invalid field "metadata.tags[0]", array type fields are not supported', + ); }); it('accepts both strings and arrays of strings as input', () => { @@ -177,4 +183,18 @@ describe('parseEntityTransformParams', () => { ), ).toEqual({ kind: 'k' }); }); + + it('handles both query params and extras, dealing with overlaps', () => { + expect( + parseEntityTransformParams({ fields: 'kind' }, [ + 'kind', + 'metadata.name', + ])!(entity), + ).toEqual({ + kind: 'k', + metadata: { + name: 'n', + }, + }); + }); }); diff --git a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts index cef6e5ef64..3ddbe78872 100644 --- a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts +++ b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts @@ -38,24 +38,29 @@ function getPathArrayAndValue(input: Entity, field: string) { export function parseEntityTransformParams( params: Record, + extra?: string[], ): ((entity: Entity) => Entity) | undefined { - const fieldsStrings = parseStringsParam(params.fields, 'fields'); - if (!fieldsStrings) { - return undefined; - } + const queryFields = parseStringsParam(params.fields, 'fields'); - const fields = fieldsStrings - .map(s => s.split(',')) - .flat() - .map(s => s.trim()) - .filter(Boolean); + const fields = Array.from( + new Set( + [...(extra ?? []), ...(queryFields ?? [])] + .map(s => s.split(',')) + .flat() + .map(s => s.trim()) + .filter(Boolean), + ), + ); if (!fields.length) { return undefined; } - if (fields.some(f => f.includes('['))) { - throw new InputError('invalid fields, array type fields are not supported'); + const arrayTypeField = fields.find(f => f.includes('[')); + if (arrayTypeField) { + throw new InputError( + `Invalid field "${arrayTypeField}", array type fields are not supported`, + ); } return input => { From c35dd549d476a325fae7577ab36424e787ff8530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 5 Jan 2023 09:46:32 +0100 Subject: [PATCH 137/141] only comma-split query params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../src/service/request/parseEntityTransformParams.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts index 3ddbe78872..e203450103 100644 --- a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts +++ b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.ts @@ -44,8 +44,7 @@ export function parseEntityTransformParams( const fields = Array.from( new Set( - [...(extra ?? []), ...(queryFields ?? [])] - .map(s => s.split(',')) + [...(extra ?? []), ...(queryFields?.map(s => s.split(',')) ?? [])] .flat() .map(s => s.trim()) .filter(Boolean), From ef62cfbceae38ddcd429f499dc5f238ab18a9c7a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 11:54:45 +0000 Subject: [PATCH 138/141] chore(deps): update docker/metadata-action action to v4 Signed-off-by: Renovate Bot --- .github/workflows/uffizzi-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 1a86f8de71..00b7d6d38d 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -52,7 +52,7 @@ jobs: - name: Docker metadata id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v4 with: images: registry.uffizzi.com/${{ env.UUID_TAG_APP }} tags: type=raw,value=60d From 56ae05e730b852158a82bc71ddc84ec76e189c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 5 Jan 2023 13:05:01 +0100 Subject: [PATCH 139/141] fix import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- packages/e2e-test/src/lib/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-test/src/lib/helpers.ts b/packages/e2e-test/src/lib/helpers.ts index b3fd665fd2..2e9b355f4c 100644 --- a/packages/e2e-test/src/lib/helpers.ts +++ b/packages/e2e-test/src/lib/helpers.ts @@ -22,7 +22,7 @@ import { ChildProcess, } from 'child_process'; import { promisify } from 'util'; -import puppeteer from 'puppeteer'; +import * as puppeteer from 'puppeteer'; const execFile = promisify(execFileCb); From d06a7890c61b3045bc1d08e51d45f8f1362ebe6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 5 Jan 2023 13:10:44 +0100 Subject: [PATCH 140/141] removed unusued package type-fest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/popular-boxes-think.md | 5 +++++ packages/cli/package.json | 3 +-- yarn.lock | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changeset/popular-boxes-think.md diff --git a/.changeset/popular-boxes-think.md b/.changeset/popular-boxes-think.md new file mode 100644 index 0000000000..91ac649643 --- /dev/null +++ b/.changeset/popular-boxes-think.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Removed unused package `type-fest` diff --git a/packages/cli/package.json b/packages/cli/package.json index 76d9717759..119f08d338 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -156,8 +156,7 @@ "mock-fs": "^5.1.0", "msw": "^0.49.0", "nodemon": "^2.0.2", - "ts-node": "^10.0.0", - "type-fest": "^2.0.0" + "ts-node": "^10.0.0" }, "peerDependencies": { "@microsoft/api-extractor": "^7.21.2" diff --git a/yarn.lock b/yarn.lock index 130e72eeaf..4771990427 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3730,7 +3730,6 @@ __metadata: tar: ^6.1.12 terser-webpack-plugin: ^5.1.3 ts-node: ^10.0.0 - type-fest: ^2.0.0 util: ^0.12.3 webpack: ^5.70.0 webpack-dev-server: ^4.7.3 @@ -37347,7 +37346,7 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^2.0.0, type-fest@npm:^2.19.0": +"type-fest@npm:^2.19.0": version: 2.19.0 resolution: "type-fest@npm:2.19.0" checksum: a4ef07ece297c9fba78fc1bd6d85dff4472fe043ede98bd4710d2615d15776902b595abf62bd78339ed6278f021235fb28a96361f8be86ed754f778973a0d278 From 11cd510220063effa9c79231282a0c5b1efe3042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 5 Jan 2023 13:20:55 +0100 Subject: [PATCH 141/141] remove FC usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- plugins/permission-react/src/hooks/usePermission.test.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/permission-react/src/hooks/usePermission.test.tsx b/plugins/permission-react/src/hooks/usePermission.test.tsx index cbf3b22ae7..1987382f47 100644 --- a/plugins/permission-react/src/hooks/usePermission.test.tsx +++ b/plugins/permission-react/src/hooks/usePermission.test.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import React, { FC } from 'react'; +import React from 'react'; import { render } from '@testing-library/react'; import { usePermission } from './usePermission'; import { @@ -30,7 +30,7 @@ const permission = createPermission({ attributes: { action: 'read' }, }); -const TestComponent: FC = () => { +const TestComponent = () => { const { loading, allowed, error } = usePermission({ permission }); return (
@@ -47,7 +47,6 @@ function renderComponent(mockApi: PermissionApi) { - , , ); }