): (
WrappedComponent: React_2.ComponentType
,
) => {
(props: React_2.PropsWithChildren>): JSX.Element;
diff --git a/packages/core-plugin-api/src/apis/system/helpers.ts b/packages/core-plugin-api/src/apis/system/helpers.ts
index 8e84dd6c09..547d583482 100644
--- a/packages/core-plugin-api/src/apis/system/helpers.ts
+++ b/packages/core-plugin-api/src/apis/system/helpers.ts
@@ -24,7 +24,7 @@ import { ApiRef, ApiFactory, TypesToApiRefs } from './types';
export function createApiFactory<
Api,
Impl extends Api,
- Deps extends { [name in string]: unknown }
+ Deps extends { [name in string]: unknown },
>(factory: ApiFactory): ApiFactory;
export function createApiFactory(
api: ApiRef,
@@ -33,7 +33,7 @@ export function createApiFactory(
export function createApiFactory<
Api,
Impl extends Api,
- Deps extends { [name in string]: unknown }
+ Deps extends { [name in string]: unknown },
>(
factory: ApiFactory | ApiRef,
instance?: Impl,
diff --git a/packages/core-plugin-api/src/apis/system/types.ts b/packages/core-plugin-api/src/apis/system/types.ts
index e805b6f255..a97d29fdaa 100644
--- a/packages/core-plugin-api/src/apis/system/types.ts
+++ b/packages/core-plugin-api/src/apis/system/types.ts
@@ -36,7 +36,7 @@ export type ApiHolder = {
export type ApiFactory<
Api,
Impl extends Api,
- Deps extends { [name in string]: unknown }
+ Deps extends { [name in string]: unknown },
> = {
api: ApiRef;
deps: TypesToApiRefs;
diff --git a/packages/core-plugin-api/src/app/useApp.tsx b/packages/core-plugin-api/src/app/useApp.tsx
index 1d17fb2d0f..aa323db4e2 100644
--- a/packages/core-plugin-api/src/app/useApp.tsx
+++ b/packages/core-plugin-api/src/app/useApp.tsx
@@ -18,9 +18,8 @@ import { useVersionedContext } from '../lib/versionedValues';
import { AppContext as AppContextV1 } from './types';
export const useApp = (): AppContextV1 => {
- const versionedContext = useVersionedContext<{ 1: AppContextV1 }>(
- 'app-context',
- );
+ const versionedContext =
+ useVersionedContext<{ 1: AppContextV1 }>('app-context');
const appContext = versionedContext.atVersion(1);
if (!appContext) {
throw new Error('AppContext v1 not available');
diff --git a/packages/core-plugin-api/src/extensions/extensions.tsx b/packages/core-plugin-api/src/extensions/extensions.tsx
index 5142dccc55..73b927afc8 100644
--- a/packages/core-plugin-api/src/extensions/extensions.tsx
+++ b/packages/core-plugin-api/src/extensions/extensions.tsx
@@ -33,7 +33,7 @@ type ComponentLoader =
// ComponentType inserts children as an optional prop whether the inner component accepts it or not,
// making it impossible to make the usage of children type safe.
export function createRoutableExtension<
- T extends (props: any) => JSX.Element | null
+ T extends (props: any) => JSX.Element | null,
>(options: {
component: () => Promise;
mountPoint: RouteRef;
@@ -91,7 +91,7 @@ export function createRoutableExtension<
// ComponentType inserts children as an optional prop whether the inner component accepts it or not,
// making it impossible to make the usage of children type safe.
export function createComponentExtension<
- T extends (props: any) => JSX.Element | null
+ T extends (props: any) => JSX.Element | null,
>(options: { component: ComponentLoader }): Extension {
const { component } = options;
return createReactExtension({ component });
@@ -101,7 +101,7 @@ export function createComponentExtension<
// ComponentType inserts children as an optional prop whether the inner component accepts it or not,
// making it impossible to make the usage of children type safe.
export function createReactExtension<
- T extends (props: any) => JSX.Element | null
+ T extends (props: any) => JSX.Element | null,
>(options: {
component: ComponentLoader;
data?: Record;
@@ -111,9 +111,9 @@ export function createReactExtension<
let Component: T;
if ('lazy' in options.component) {
const lazyLoader = options.component.lazy;
- Component = (lazy(() =>
+ Component = lazy(() =>
lazyLoader().then(component => ({ default: component })),
- ) as unknown) as T;
+ ) as unknown as T;
} else {
Component = options.component.sync;
}
diff --git a/packages/core-plugin-api/src/lib/versionedValues.ts b/packages/core-plugin-api/src/lib/versionedValues.ts
index a7b7d8e3b7..7686842ecd 100644
--- a/packages/core-plugin-api/src/lib/versionedValues.ts
+++ b/packages/core-plugin-api/src/lib/versionedValues.ts
@@ -32,7 +32,7 @@ export type VersionedValue = {
* Creates a container for a map of versioned values that implements VersionedValue.
*/
export function createVersionedValueMap<
- Versions extends { [version: number]: any }
+ Versions extends { [version: number]: any },
>(versions: Versions): VersionedValue {
Object.freeze(versions);
return {
@@ -43,7 +43,7 @@ export function createVersionedValueMap<
}
export function useVersionedContext<
- Versions extends { [version in number]: any }
+ Versions extends { [version in number]: any },
>(key: string): VersionedValue {
const versionedValue = useContext(
getGlobalSingleton>>(key),
diff --git a/packages/core-plugin-api/src/plugin/Plugin.tsx b/packages/core-plugin-api/src/plugin/Plugin.tsx
index abf4bfa35c..53a53b76d0 100644
--- a/packages/core-plugin-api/src/plugin/Plugin.tsx
+++ b/packages/core-plugin-api/src/plugin/Plugin.tsx
@@ -26,8 +26,9 @@ import { AnyApiFactory } from '../apis';
export class PluginImpl<
Routes extends AnyRoutes,
- ExternalRoutes extends AnyExternalRoutes
-> implements BackstagePlugin {
+ ExternalRoutes extends AnyExternalRoutes,
+> implements BackstagePlugin
+{
private storedOutput?: PluginOutput[];
constructor(private readonly config: PluginConfig) {}
@@ -81,7 +82,7 @@ export class PluginImpl<
export function createPlugin<
Routes extends AnyRoutes = {},
- ExternalRoutes extends AnyExternalRoutes = {}
+ ExternalRoutes extends AnyExternalRoutes = {},
>(
config: PluginConfig,
): BackstagePlugin {
diff --git a/packages/core-plugin-api/src/plugin/types.ts b/packages/core-plugin-api/src/plugin/types.ts
index 23ff4594a5..b3e1043efd 100644
--- a/packages/core-plugin-api/src/plugin/types.ts
+++ b/packages/core-plugin-api/src/plugin/types.ts
@@ -42,7 +42,7 @@ export type AnyExternalRoutes = { [name: string]: ExternalRouteRef };
export type BackstagePlugin<
Routes extends AnyRoutes = {},
- ExternalRoutes extends AnyExternalRoutes = {}
+ ExternalRoutes extends AnyExternalRoutes = {},
> = {
getId(): string;
output(): PluginOutput[];
@@ -54,7 +54,7 @@ export type BackstagePlugin<
export type PluginConfig<
Routes extends AnyRoutes,
- ExternalRoutes extends AnyExternalRoutes
+ ExternalRoutes extends AnyExternalRoutes,
> = {
id: string;
apis?: Iterable;
diff --git a/packages/core-plugin-api/src/routing/ExternalRouteRef.ts b/packages/core-plugin-api/src/routing/ExternalRouteRef.ts
index 348c78220f..401e34773c 100644
--- a/packages/core-plugin-api/src/routing/ExternalRouteRef.ts
+++ b/packages/core-plugin-api/src/routing/ExternalRouteRef.ts
@@ -24,8 +24,9 @@ import {
export class ExternalRouteRefImpl<
Params extends AnyParams,
- Optional extends boolean
-> implements ExternalRouteRef {
+ Optional extends boolean,
+> implements ExternalRouteRef
+{
readonly [routeRefType] = 'external';
constructor(
@@ -42,7 +43,7 @@ export class ExternalRouteRefImpl<
export function createExternalRouteRef<
Params extends { [param in ParamKey]: string },
Optional extends boolean = false,
- ParamKey extends string = never
+ ParamKey extends string = never,
>(options: {
/**
* An identifier for this route, used to identify it in error messages
diff --git a/packages/core-plugin-api/src/routing/RouteRef.ts b/packages/core-plugin-api/src/routing/RouteRef.ts
index 0239b57c25..31dd9ef518 100644
--- a/packages/core-plugin-api/src/routing/RouteRef.ts
+++ b/packages/core-plugin-api/src/routing/RouteRef.ts
@@ -32,7 +32,8 @@ export type RouteRefConfig = {
};
export class RouteRefImpl
- implements RouteRef {
+ implements RouteRef
+{
readonly [routeRefType] = 'absolute';
constructor(
@@ -70,7 +71,7 @@ export function createRouteRef<
// ParamKey is here to make sure the Params type properly has its keys narrowed down
// to only the elements of params. Defaulting to never makes sure we end up with
// Param = {} if the params array is empty.
- ParamKey extends string = never
+ ParamKey extends string = never,
>(config: {
/** The id of the route ref, used to identify it when printed */
id?: string;
diff --git a/packages/core-plugin-api/src/routing/SubRouteRef.ts b/packages/core-plugin-api/src/routing/SubRouteRef.ts
index f7e5cf0bc5..6b329dfd42 100644
--- a/packages/core-plugin-api/src/routing/SubRouteRef.ts
+++ b/packages/core-plugin-api/src/routing/SubRouteRef.ts
@@ -27,7 +27,8 @@ import {
const PARAM_PATTERN = /^\w+$/;
export class SubRouteRefImpl
- implements SubRouteRef {
+ implements SubRouteRef
+{
readonly [routeRefType] = 'sub';
constructor(
@@ -55,7 +56,7 @@ type PathParams = { [name in ParamNames]: string };
*/
type MergeParams<
P1 extends { [param in string]: string },
- P2 extends AnyParams
+ P2 extends AnyParams,
> = (P1[keyof P1] extends never ? {} : P1) & (P2 extends undefined ? {} : P2);
/**
@@ -64,14 +65,14 @@ type MergeParams<
*/
type MakeSubRouteRef<
Params extends { [param in string]: string },
- ParentParams extends AnyParams
+ ParentParams extends AnyParams,
> = keyof Params & keyof ParentParams extends never
? SubRouteRef>>
: never;
export function createSubRouteRef<
Path extends string,
- ParentParams extends AnyParams = never
+ ParentParams extends AnyParams = never,
>(config: {
id: string;
path: Path;
diff --git a/packages/core-plugin-api/src/routing/types.ts b/packages/core-plugin-api/src/routing/types.ts
index 9ea1e3ff0d..5afcc72265 100644
--- a/packages/core-plugin-api/src/routing/types.ts
+++ b/packages/core-plugin-api/src/routing/types.ts
@@ -21,9 +21,8 @@ export type AnyParams = { [param in string]: string } | undefined;
export type ParamKeys = keyof Params extends never
? []
: (keyof Params)[];
-export type OptionalParams<
- Params extends { [param in string]: string }
-> = Params[keyof Params] extends never ? undefined : Params;
+export type OptionalParams =
+ Params[keyof Params] extends never ? undefined : Params;
// The extra TS magic here is to require a single params argument if the RouteRef
// had at least one param defined, but require 0 arguments if there are no params defined.
@@ -65,7 +64,7 @@ export type SubRouteRef = {
export type ExternalRouteRef<
Params extends AnyParams = any,
- Optional extends boolean = any
+ Optional extends boolean = any,
> = {
readonly [routeRefType]: 'external';
diff --git a/packages/core-plugin-api/src/routing/useRouteRef.tsx b/packages/core-plugin-api/src/routing/useRouteRef.tsx
index 4447759b99..ed261489a4 100644
--- a/packages/core-plugin-api/src/routing/useRouteRef.tsx
+++ b/packages/core-plugin-api/src/routing/useRouteRef.tsx
@@ -48,9 +48,8 @@ export function useRouteRef(
| ExternalRouteRef,
): RouteFunc | undefined {
const sourceLocation = useLocation();
- const versionedContext = useVersionedContext<{ 1: RouteResolver }>(
- 'routing-context',
- );
+ const versionedContext =
+ useVersionedContext<{ 1: RouteResolver }>('routing-context');
const resolver = versionedContext.atVersion(1);
const routeFunc = useMemo(
() => resolver && resolver.resolve(routeRef, sourceLocation),
diff --git a/packages/create-app/package.json b/packages/create-app/package.json
index eb2cf6c9b2..130c69603a 100644
--- a/packages/create-app/package.json
+++ b/packages/create-app/package.json
@@ -39,7 +39,6 @@
"devDependencies": {
"@types/fs-extra": "^9.0.1",
"@types/inquirer": "^7.3.1",
- "@types/react-dev-utils": "^9.0.4",
"@types/recursive-readdir": "^2.2.0",
"ts-node": "^10.0.0"
},
diff --git a/packages/create-app/templates/default-app/packages/app/src/App.tsx b/packages/create-app/templates/default-app/packages/app/src/App.tsx
index 6306b1a685..9b77cf6a95 100644
--- a/packages/create-app/templates/default-app/packages/app/src/App.tsx
+++ b/packages/create-app/templates/default-app/packages/app/src/App.tsx
@@ -42,7 +42,7 @@ const AppRouter = app.getRouter();
const routes = (
-
+
} />
) => (
{/* Global nav, not org-specific */}
-
+
diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx
index e6338cd467..661a93e8b0 100644
--- a/packages/dev-utils/src/devApp/render.tsx
+++ b/packages/dev-utils/src/devApp/render.tsx
@@ -96,7 +96,7 @@ class DevAppBuilder {
registerApi<
Api,
Impl extends Api,
- Deps extends { [name in string]: unknown }
+ Deps extends { [name in string]: unknown },
>(factory: ApiFactory): DevAppBuilder {
this.apis.push(factory);
return this;
diff --git a/packages/docgen/src/docgen/ApiDocGenerator.test.ts b/packages/docgen/src/docgen/ApiDocGenerator.test.ts
index 2d6598b925..ea053b1ef4 100644
--- a/packages/docgen/src/docgen/ApiDocGenerator.test.ts
+++ b/packages/docgen/src/docgen/ApiDocGenerator.test.ts
@@ -186,8 +186,7 @@ describe('ApiDocGenerator', () => {
type: 'method',
name: 'z',
path: 'MyApiType.z',
- text:
- 'z(a: Promise): Array',
+ text: 'z(a: Promise): Array',
docs: ['Multiple', 'JsDoc', 'Comments'],
links: [
{
diff --git a/packages/docgen/src/docgen/ApiDocGenerator.ts b/packages/docgen/src/docgen/ApiDocGenerator.ts
index 3199b2ddf3..32216745a2 100644
--- a/packages/docgen/src/docgen/ApiDocGenerator.ts
+++ b/packages/docgen/src/docgen/ApiDocGenerator.ts
@@ -127,9 +127,9 @@ export default class ApiDocGenerator {
);
const docs = this.getNodeDocs(declaration);
- const membersAndTypes = Array.from(
- interfaceMembers.values(),
- ).flatMap(fieldSymbol => this.getMemberInfo(name, fieldSymbol));
+ const membersAndTypes = Array.from(interfaceMembers.values()).flatMap(
+ fieldSymbol => this.getMemberInfo(name, fieldSymbol),
+ );
const members = membersAndTypes.map(t => t.member);
const dependentTypes = this.flattenTypes(
@@ -174,9 +174,8 @@ export default class ApiDocGenerator {
): { member: FieldInfo; dependentTypes: TypeInfo[] } {
const declaration = symbol.valueDeclaration;
- const { links, infos: dependentTypes } = this.findAllTypeReferences(
- declaration,
- );
+ const { links, infos: dependentTypes } =
+ this.findAllTypeReferences(declaration);
let type: FieldInfo['type'] = 'prop';
if (
diff --git a/packages/docgen/src/docgen/TypeLocator.ts b/packages/docgen/src/docgen/TypeLocator.ts
index 984724e667..30d240da3d 100644
--- a/packages/docgen/src/docgen/TypeLocator.ts
+++ b/packages/docgen/src/docgen/TypeLocator.ts
@@ -92,9 +92,7 @@ export default class TypeLocator {
return result as { [key in T]: ExportedInstance[] };
}
- private getExportedConstructorDeclaration(
- node: ts.Node,
- ):
+ private getExportedConstructorDeclaration(node: ts.Node):
| {
constructorType: ts.Type;
args: ts.Expression[];
diff --git a/packages/docgen/src/docgen/TypescriptHighlighter.ts b/packages/docgen/src/docgen/TypescriptHighlighter.ts
index a48e17ba66..ab70ea8110 100644
--- a/packages/docgen/src/docgen/TypescriptHighlighter.ts
+++ b/packages/docgen/src/docgen/TypescriptHighlighter.ts
@@ -78,9 +78,10 @@ export default class TypescriptHighlighter implements Highlighter {
// Order here is important, e.g. comments must be first to avoid string literals inside comments being highlighted
return TypescriptHighlighter.highlighters
- .reduce((parts, highlighter) => parts.flatMap(painter(...highlighter)), [
- { text: fullText },
- ])
+ .reduce(
+ (parts, highlighter) => parts.flatMap(painter(...highlighter)),
+ [{ text: fullText }],
+ )
.map(({ text }) => text)
.join('');
}
diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts
index 94bb1dd7f5..dde93341ef 100644
--- a/packages/e2e-test/src/commands/run.ts
+++ b/packages/e2e-test/src/commands/run.ts
@@ -403,14 +403,9 @@ async function testBackendStart(appDir: string, isPostgres: boolean) {
if (isPostgres) {
print('Dropping old DBs');
await Promise.all(
- [
- 'catalog',
- 'scaffolder',
- 'auth',
- 'identity',
- 'proxy',
- 'techdocs',
- ].map(name => dropDB(`backstage_plugin_${name}`)),
+ ['catalog', 'scaffolder', 'auth', 'identity', 'proxy', 'techdocs'].map(
+ name => dropDB(`backstage_plugin_${name}`),
+ ),
);
print('Created DBs');
}
diff --git a/packages/e2e-test/src/lib/helpers.ts b/packages/e2e-test/src/lib/helpers.ts
index 2485e46b31..d0e6de2cff 100644
--- a/packages/e2e-test/src/lib/helpers.ts
+++ b/packages/e2e-test/src/lib/helpers.ts
@@ -24,7 +24,8 @@ import { promisify } from 'util';
const execFile = promisify(execFileCb);
-const EXPECTED_LOAD_ERRORS = /ECONNREFUSED|ECONNRESET|did not get to load all resources/;
+const EXPECTED_LOAD_ERRORS =
+ /ECONNREFUSED|ECONNRESET|did not get to load all resources/;
export function spawnPiped(cmd: string[], options?: SpawnOptions) {
function pipeWithPrefix(stream: NodeJS.WriteStream, prefix = '') {
diff --git a/packages/integration-react/src/api/ScmIntegrationsApi.ts b/packages/integration-react/src/api/ScmIntegrationsApi.ts
index 982989540a..6bf2ba8a6d 100644
--- a/packages/integration-react/src/api/ScmIntegrationsApi.ts
+++ b/packages/integration-react/src/api/ScmIntegrationsApi.ts
@@ -27,9 +27,8 @@ export class ScmIntegrationsApi {
}
}
-export const scmIntegrationsApiRef: ApiRef = createApiRef(
- {
+export const scmIntegrationsApiRef: ApiRef =
+ createApiRef({
id: 'integration.scmintegrations',
description: 'All of the registered SCM integrations of your config',
- },
-);
+ });
diff --git a/packages/integration/src/azure/AzureIntegration.test.ts b/packages/integration/src/azure/AzureIntegration.test.ts
index 654ce47836..80cc68047f 100644
--- a/packages/integration/src/azure/AzureIntegration.test.ts
+++ b/packages/integration/src/azure/AzureIntegration.test.ts
@@ -51,8 +51,7 @@ describe('AzureIntegration', () => {
expect(
integration.resolveUrl({
url: '../a.yaml',
- base:
- 'https://dev.azure.com/organization/project/_git/repository?path=%2Ffolder%2Fcatalog-info.yaml',
+ base: 'https://dev.azure.com/organization/project/_git/repository?path=%2Ffolder%2Fcatalog-info.yaml',
}),
).toBe(
'https://dev.azure.com/organization/project/_git/repository?path=%2Fa.yaml',
@@ -61,8 +60,7 @@ describe('AzureIntegration', () => {
expect(
integration.resolveUrl({
url: '/a.yaml',
- base:
- 'https://dev.azure.com/organization/project/_git/repository?path=%2Ffolder%2Fcatalog-info.yaml',
+ base: 'https://dev.azure.com/organization/project/_git/repository?path=%2Ffolder%2Fcatalog-info.yaml',
lineNumber: 14,
}),
).toBe(
@@ -81,8 +79,7 @@ describe('AzureIntegration', () => {
expect(
integration.resolveUrl({
url: 'https://absolute.com/path',
- base:
- 'https://dev.azure.com/organization/project/_git/repository?path=%2Fcatalog-info.yaml',
+ base: 'https://dev.azure.com/organization/project/_git/repository?path=%2Fcatalog-info.yaml',
}),
).toBe('https://absolute.com/path');
});
diff --git a/packages/integration/src/azure/core.test.ts b/packages/integration/src/azure/core.test.ts
index ab5a4bc700..9937008b61 100644
--- a/packages/integration/src/azure/core.test.ts
+++ b/packages/integration/src/azure/core.test.ts
@@ -43,26 +43,22 @@ describe('azure core', () => {
describe('getAzureFileFetchUrl', () => {
it.each([
{
- url:
- 'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster',
+ url: 'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster',
result:
'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml&version=master',
},
{
- url:
- 'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml',
+ url: 'https://dev.azure.com/org-name/project-name/_git/repo-name?path=my-template.yaml',
result:
'https://dev.azure.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml',
},
{
- url:
- 'https://api.com/org-name/project-name/_git/repo-name?path=my-template.yaml',
+ url: 'https://api.com/org-name/project-name/_git/repo-name?path=my-template.yaml',
result:
'https://api.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml',
},
{
- url:
- 'https://api.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster',
+ url: 'https://api.com/org-name/project-name/_git/repo-name?path=my-template.yaml&version=GBmaster',
result:
'https://api.com/org-name/project-name/_apis/git/repositories/repo-name/items?path=my-template.yaml&version=master',
},
diff --git a/packages/integration/src/azure/core.ts b/packages/integration/src/azure/core.ts
index 5aacc09700..18de5aa1d2 100644
--- a/packages/integration/src/azure/core.ts
+++ b/packages/integration/src/azure/core.ts
@@ -31,13 +31,8 @@ export function getAzureFileFetchUrl(url: string): string {
try {
const parsedUrl = new URL(url);
- const [
- empty,
- userOrOrg,
- project,
- srcKeyword,
- repoName,
- ] = parsedUrl.pathname.split('/');
+ const [empty, userOrOrg, project, srcKeyword, repoName] =
+ parsedUrl.pathname.split('/');
const path = parsedUrl.searchParams.get('path') || '';
const ref = parsedUrl.searchParams.get('version')?.substr(2);
@@ -117,13 +112,8 @@ export function getAzureCommitsUrl(url: string): string {
try {
const parsedUrl = new URL(url);
- const [
- empty,
- userOrOrg,
- project,
- srcKeyword,
- repoName,
- ] = parsedUrl.pathname.split('/');
+ const [empty, userOrOrg, project, srcKeyword, repoName] =
+ parsedUrl.pathname.split('/');
// Remove the "GB" from "GBmain" for example.
const ref = parsedUrl.searchParams.get('version')?.substr(2);
diff --git a/packages/integration/src/github/GitHubIntegration.test.ts b/packages/integration/src/github/GitHubIntegration.test.ts
index 416618e53b..efc1de782e 100644
--- a/packages/integration/src/github/GitHubIntegration.test.ts
+++ b/packages/integration/src/github/GitHubIntegration.test.ts
@@ -56,8 +56,7 @@ describe('GitHubIntegration', () => {
expect(
integration.resolveUrl({
url: '../a.yaml',
- base:
- 'https://github.com/backstage/backstage/blob/master/test/README.md',
+ base: 'https://github.com/backstage/backstage/blob/master/test/README.md',
lineNumber: 17,
}),
).toBe('https://github.com/backstage/backstage/tree/master/a.yaml#L17');
@@ -65,8 +64,7 @@ describe('GitHubIntegration', () => {
expect(
integration.resolveUrl({
url: './',
- base:
- 'https://github.com/backstage/backstage/blob/master/test/README.md',
+ base: 'https://github.com/backstage/backstage/blob/master/test/README.md',
}),
).toBe('https://github.com/backstage/backstage/tree/master/test/');
});
diff --git a/packages/integration/src/github/GithubCredentialsProvider.test.ts b/packages/integration/src/github/GithubCredentialsProvider.test.ts
index 47678ddb89..9450d96ab7 100644
--- a/packages/integration/src/github/GithubCredentialsProvider.test.ts
+++ b/packages/integration/src/github/GithubCredentialsProvider.test.ts
@@ -133,7 +133,7 @@ describe('GithubCredentialsProvider tests', () => {
expect(token).toEqual('secret_token');
});
- it('should fail to issue tokens for an organization when the app is installed for a single repo', async () => {
+ it('should not fail to issue tokens for an organization when the app is installed for a single repo', async () => {
octokit.apps.listInstallations.mockResolvedValue({
headers: {
etag: '123',
@@ -156,13 +156,12 @@ describe('GithubCredentialsProvider tests', () => {
},
} as RestEndpointMethodTypes['apps']['createInstallationAccessToken']['response']);
- await expect(
- github.getCredentials({
- url: 'https://github.com/backstage',
- }),
- ).rejects.toThrow(
- 'The Backstage GitHub application used in the backstage organization must be installed for the entire organization to be able to issue credentials without a specified repository.',
- );
+ const { token, headers } = await github.getCredentials({
+ url: 'https://github.com/backstage',
+ });
+ const expectedToken = 'secret_token';
+ expect(headers).toEqual({ Authorization: `Bearer ${expectedToken}` });
+ expect(token).toEqual('secret_token');
});
it('should throw if the app is suspended', async () => {
@@ -232,9 +231,9 @@ describe('GithubCredentialsProvider tests', () => {
],
token: 'hardcoded_token',
});
- octokit.apps.listInstallations.mockResolvedValue(({
+ octokit.apps.listInstallations.mockResolvedValue({
data: [],
- } as unknown) as RestEndpointMethodTypes['apps']['listInstallations']['response']);
+ } as unknown as RestEndpointMethodTypes['apps']['listInstallations']['response']);
await expect(
githubProvider.getCredentials({
diff --git a/packages/integration/src/github/GithubCredentialsProvider.ts b/packages/integration/src/github/GithubCredentialsProvider.ts
index 807bbe164e..a3938b7ba3 100644
--- a/packages/integration/src/github/GithubCredentialsProvider.ts
+++ b/packages/integration/src/github/GithubCredentialsProvider.ts
@@ -23,7 +23,6 @@ import { DateTime } from 'luxon';
type InstallationData = {
installationId: number;
suspended: boolean;
- repositorySelection: 'selected' | 'all';
};
class Cache {
@@ -87,45 +86,41 @@ class GithubAppManager {
owner: string,
repo?: string,
): Promise<{ accessToken: string }> {
- const {
- installationId,
- suspended,
- repositorySelection,
- } = await this.getInstallationData(owner);
+ const { installationId, suspended } = await this.getInstallationData(owner);
if (this.allowedInstallationOwners) {
if (!this.allowedInstallationOwners?.includes(owner)) {
throw new Error(
- `The GitHub application for ${[owner, repo]
- .filter(Boolean)
- .join(
- '/',
- )} is not included in the allowed installation list (${installationId}).`,
+ `The GitHub application for ${owner} is not included in the allowed installation list (${installationId}).`,
);
}
}
if (suspended) {
- throw new Error(
- `The GitHub application for ${[owner, repo]
- .filter(Boolean)
- .join('/')} is suspended`,
- );
- }
- if (repositorySelection !== 'all' && !repo) {
- throw new Error(
- `The Backstage GitHub application used in the ${owner} organization must be installed for the entire organization to be able to issue credentials without a specified repository.`,
- );
+ throw new Error(`The GitHub application for ${owner} is suspended`);
}
- const cacheKey = !repo ? owner : `${owner}/${repo}`;
- const repositories = repositorySelection !== 'all' ? [repo!] : undefined;
+ const cacheKey = repo ? `${owner}/${repo}` : owner;
// Go and grab an access token for the app scoped to a repository if provided, if not use the organisation installation.
return this.cache.getOrCreateToken(cacheKey, async () => {
const result = await this.appClient.apps.createInstallationAccessToken({
installation_id: installationId,
headers: HEADERS,
- repositories,
});
+ if (repo && result.data.repository_selection === 'selected') {
+ const installationClient = new Octokit({
+ auth: result.data.token,
+ });
+ const repos =
+ await installationClient.apps.listReposAccessibleToInstallation();
+ const hasRepo = repos.data.repositories.some(repository => {
+ return repository.name === repo;
+ });
+ if (!hasRepo) {
+ throw new Error(
+ `The Backstage GitHub application used in the ${owner} organization does not have access to a repository with the name ${repo}`,
+ );
+ }
+ }
return {
token: result.data.token,
expiresAt: DateTime.fromISO(result.data.expires_at),
@@ -148,7 +143,6 @@ class GithubAppManager {
return {
installationId: installation.id,
suspended: Boolean(installation.suspended_by),
- repositorySelection: installation.repository_selection,
};
}
const notFoundError = new Error(
diff --git a/packages/integration/src/gitlab/core.test.ts b/packages/integration/src/gitlab/core.test.ts
index 574403d70b..f07d65e02a 100644
--- a/packages/integration/src/gitlab/core.test.ts
+++ b/packages/integration/src/gitlab/core.test.ts
@@ -52,37 +52,32 @@ describe('gitlab core', () => {
// Project URLs
{
config: configWithNoToken,
- url:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file.yaml',
+ url: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file.yaml',
result:
'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile.yaml/raw?ref=branch',
},
{
config: configWithNoToken,
// Works with non URI encoded link
- url:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file with spaces.yaml',
+ url: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path/to/file with spaces.yaml',
result:
'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%2Fto%2Ffile%20with%20spaces.yaml/raw?ref=branch',
},
{
config: configWithNoToken,
- url:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path%20with%20spaces/to/file.yaml',
+ url: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path%20with%20spaces/to/file.yaml',
result:
'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%20with%20spaces%2Fto%2Ffile.yaml/raw?ref=branch',
},
{
config: configWithToken,
- url:
- 'https://gitlab.example.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path%20with%20spaces/to/file.yaml',
+ url: 'https://gitlab.example.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/my/path%20with%20spaces/to/file.yaml',
result:
'https://gitlab.example.com/api/v4/projects/12345/repository/files/my%2Fpath%20with%20spaces%2Fto%2Ffile.yaml/raw?ref=branch',
},
{
config: configWithNoToken,
- url:
- 'https://gitlab.com/groupA/teams/teamA/repoA/-/blob/branch/my/path%20with%20spaces/to/file.yaml', // Repo not in subgroup
+ url: 'https://gitlab.com/groupA/teams/teamA/repoA/-/blob/branch/my/path%20with%20spaces/to/file.yaml', // Repo not in subgroup
result:
'https://gitlab.com/api/v4/projects/12345/repository/files/my%2Fpath%20with%20spaces%2Fto%2Ffile.yaml/raw?ref=branch',
},
diff --git a/packages/integration/src/gitlab/core.ts b/packages/integration/src/gitlab/core.ts
index 9b7b928059..83ab29c62e 100644
--- a/packages/integration/src/gitlab/core.ts
+++ b/packages/integration/src/gitlab/core.ts
@@ -68,13 +68,8 @@ export function buildRawUrl(target: string): URL {
try {
const url = new URL(target);
- const [
- empty,
- userOrOrg,
- repoName,
- blobKeyword,
- ...restOfPath
- ] = url.pathname.split('/');
+ const [empty, userOrOrg, repoName, blobKeyword, ...restOfPath] =
+ url.pathname.split('/');
if (
empty !== '' ||
diff --git a/packages/integration/src/helpers.test.ts b/packages/integration/src/helpers.test.ts
index 90102ce6aa..13e8694c73 100644
--- a/packages/integration/src/helpers.test.ts
+++ b/packages/integration/src/helpers.test.ts
@@ -57,8 +57,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: './b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml',
@@ -67,8 +66,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: './b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml?at=master',
@@ -77,8 +75,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: 'b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/b.yaml',
@@ -89,8 +86,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: '/other/b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/other/b.yaml',
@@ -99,8 +95,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: '/other/b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
}),
).toBe(
'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/other/b.yaml?at=master',
@@ -111,8 +106,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: './b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
lineNumber: 11,
}),
).toBe(
@@ -122,8 +116,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: 'b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
lineNumber: 12,
}),
).toBe(
@@ -133,8 +126,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: '/other/b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml',
lineNumber: 13,
}),
).toBe(
@@ -144,8 +136,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: '/other/b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
lineNumber: 14,
}),
).toBe(
@@ -157,8 +148,7 @@ describe('defaultScmResolveUrl', () => {
expect(
defaultScmResolveUrl({
url: 'https://b.com/b.yaml',
- base:
- 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
+ base: 'https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/folder/a.yaml?at=master',
}),
).toBe('https://b.com/b.yaml');
});
diff --git a/packages/storybook/package.json b/packages/storybook/package.json
index 8195efca1c..736afbb8d8 100644
--- a/packages/storybook/package.json
+++ b/packages/storybook/package.json
@@ -7,12 +7,6 @@
"start": "start-storybook -p 6006",
"build-storybook": "build-storybook --output-dir dist"
},
- "workspaces": {
- "nohoist": [
- "@storybook/react/**",
- "@storybook/addons/**"
- ]
- },
"dependencies": {
"@backstage/theme": "^0.2.0",
"react": "^16.12.0",
@@ -24,7 +18,7 @@
"@storybook/addon-links": "^6.1.11",
"@storybook/addon-storysource": "^6.1.11",
"@storybook/addons": "^6.1.11",
- "@storybook/react": "^6.1.11",
+ "@storybook/react": "^6.3.6",
"storybook-dark-mode": "^1.0.3"
}
}
diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.ts b/packages/techdocs-common/src/stages/publish/googleStorage.ts
index 9def24722a..cbf76cd3d7 100644
--- a/packages/techdocs-common/src/stages/publish/googleStorage.ts
+++ b/packages/techdocs-common/src/stages/publish/googleStorage.ts
@@ -176,9 +176,8 @@ export class GoogleGCSPublish implements PublisherBase {
fileStreamChunks.push(chunk);
})
.on('end', () => {
- const techdocsMetadataJson = Buffer.concat(fileStreamChunks).toString(
- 'utf-8',
- );
+ const techdocsMetadataJson =
+ Buffer.concat(fileStreamChunks).toString('utf-8');
resolve(JSON5.parse(techdocsMetadataJson));
});
});
diff --git a/packages/test-utils/src/testUtils/appWrappers.tsx b/packages/test-utils/src/testUtils/appWrappers.tsx
index b884efd00d..09c9e5d0bf 100644
--- a/packages/test-utils/src/testUtils/appWrappers.tsx
+++ b/packages/test-utils/src/testUtils/appWrappers.tsx
@@ -92,7 +92,7 @@ export function wrapInTestApp(
apis: mockApis,
// Bit of a hack to make sure that the default config loader isn't used
// as that would force every single test to wait for config loading.
- configLoader: (false as unknown) as undefined,
+ configLoader: false as unknown as undefined,
components: {
Progress,
BootErrorPage,
diff --git a/plugins/api-docs/dev/index.tsx b/plugins/api-docs/dev/index.tsx
index bbbfe4a516..e60647e7b9 100644
--- a/plugins/api-docs/dev/index.tsx
+++ b/plugins/api-docs/dev/index.tsx
@@ -30,19 +30,19 @@ import openapiApiEntity from './openapi-example-api.yaml';
import otherApiEntity from './other-example-api.yaml';
import { Content, Header, Page } from '@backstage/core-components';
-const mockEntities = ([
+const mockEntities = [
openapiApiEntity,
asyncapiApiEntity,
graphqlApiEntity,
otherApiEntity,
-] as unknown) as Entity[];
+] as unknown as Entity[];
createDevApp()
.registerApi({
api: catalogApiRef,
deps: {},
factory: () =>
- (({
+ ({
async getEntities() {
return {
items: mockEntities.slice(),
@@ -51,7 +51,7 @@ createDevApp()
async getEntityByName(name: string) {
return mockEntities.find(e => e.metadata.name === name);
},
- } as unknown) as typeof catalogApiRef.T),
+ } as unknown as typeof catalogApiRef.T),
})
.registerApi({
api: apiDocsConfigRef,
@@ -72,7 +72,7 @@ createDevApp()
-
+
@@ -85,7 +85,7 @@ createDevApp()
-
+
@@ -98,7 +98,7 @@ createDevApp()
-
+
@@ -111,7 +111,7 @@ createDevApp()
-
+
diff --git a/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx b/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx
index 0b8462ed6e..f32b5d01b5 100644
--- a/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx
+++ b/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx
@@ -88,13 +88,15 @@ const useStyles = makeStyles(theme => ({
'& .asyncapi__enum': {
color: theme.palette.secondary.main,
},
- '& .asyncapi__info, .asyncapi__channel, .asyncapi__channels > div, .asyncapi__schema, .asyncapi__channel-operations-list .asyncapi__messages-list-item .asyncapi__message, .asyncapi__message, .asyncapi__server, .asyncapi__servers > div, .asyncapi__messages > div, .asyncapi__schemas > div': {
- 'background-color': 'inherit',
- },
- '& .asyncapi__channel-parameters-header, .asyncapi__channel-operations-header, .asyncapi__channel-operation-oneOf-subscribe-header, .asyncapi__channel-operation-oneOf-publish-header, .asyncapi__channel-operation-message-header, .asyncapi__message-header, .asyncapi__message-header-title, .asyncapi__message-header-title > h3, .asyncapi__bindings, .asyncapi__bindings-header, .asyncapi__bindings-header > h4': {
- 'background-color': 'inherit',
- color: theme.palette.text.primary,
- },
+ '& .asyncapi__info, .asyncapi__channel, .asyncapi__channels > div, .asyncapi__schema, .asyncapi__channel-operations-list .asyncapi__messages-list-item .asyncapi__message, .asyncapi__message, .asyncapi__server, .asyncapi__servers > div, .asyncapi__messages > div, .asyncapi__schemas > div':
+ {
+ 'background-color': 'inherit',
+ },
+ '& .asyncapi__channel-parameters-header, .asyncapi__channel-operations-header, .asyncapi__channel-operation-oneOf-subscribe-header, .asyncapi__channel-operation-oneOf-publish-header, .asyncapi__channel-operation-message-header, .asyncapi__message-header, .asyncapi__message-header-title, .asyncapi__message-header-title > h3, .asyncapi__bindings, .asyncapi__bindings-header, .asyncapi__bindings-header > h4':
+ {
+ 'background-color': 'inherit',
+ color: theme.palette.text.primary,
+ },
'& .asyncapi__additional-properties-notice': {
color: theme.palette.text.hint,
},
@@ -104,10 +106,11 @@ const useStyles = makeStyles(theme => ({
'& .asyncapi__schema-example-header-title': {
color: theme.palette.text.secondary,
},
- '& .asyncapi__message-headers-header, .asyncapi__message-payload-header, .asyncapi__server-variables-header, .asyncapi__server-security-header': {
- 'background-color': 'inherit',
- color: theme.palette.text.secondary,
- },
+ '& .asyncapi__message-headers-header, .asyncapi__message-payload-header, .asyncapi__server-variables-header, .asyncapi__server-security-header':
+ {
+ 'background-color': 'inherit',
+ color: theme.palette.text.secondary,
+ },
'& .asyncapi__table-header': {
background: theme.palette.background.default,
},
diff --git a/plugins/api-docs/src/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.tsx b/plugins/api-docs/src/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.tsx
index 206294f931..4c22d29bc2 100644
--- a/plugins/api-docs/src/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.tsx
+++ b/plugins/api-docs/src/components/OpenApiDefinitionWidget/OpenApiDefinitionWidget.tsx
@@ -30,22 +30,26 @@ const useStyles = makeStyles(theme => ({
'& .scheme-container': {
'background-color': theme.palette.background.default,
},
- '& .opblock-tag, .opblock-tag small, table thead tr td, table thead tr th': {
- color: theme.palette.text.primary,
- 'border-color': theme.palette.divider,
- },
+ '& .opblock-tag, .opblock-tag small, table thead tr td, table thead tr th':
+ {
+ color: theme.palette.text.primary,
+ 'border-color': theme.palette.divider,
+ },
'& section.models, section.models.is-open h4': {
'border-color': theme.palette.divider,
},
- '& .opblock .opblock-summary-description, .parameter__type, table.headers td, .model-title, .model .property.primitive, section h3': {
- color: theme.palette.text.secondary,
- },
- '& .opblock .opblock-summary-operation-id, .opblock .opblock-summary-path, .opblock .opblock-summary-path__deprecated, .opblock .opblock-section-header h4, .parameter__name, .response-col_status, .response-col_links, .responses-inner h4, .swagger-ui .responses-inner h5, .opblock-section-header .btn, .tab li, .info li, .info p, .info table, section.models h4, .info .title, table.model tr.description, .property-row': {
- color: theme.palette.text.primary,
- },
- '& .opblock .opblock-section-header, .model-box, section.models .model-container': {
- background: theme.palette.background.default,
- },
+ '& .opblock .opblock-summary-description, .parameter__type, table.headers td, .model-title, .model .property.primitive, section h3':
+ {
+ color: theme.palette.text.secondary,
+ },
+ '& .opblock .opblock-summary-operation-id, .opblock .opblock-summary-path, .opblock .opblock-summary-path__deprecated, .opblock .opblock-section-header h4, .parameter__name, .response-col_status, .response-col_links, .responses-inner h4, .swagger-ui .responses-inner h5, .opblock-section-header .btn, .tab li, .info li, .info p, .info table, section.models h4, .info .title, table.model tr.description, .property-row':
+ {
+ color: theme.palette.text.primary,
+ },
+ '& .opblock .opblock-section-header, .model-box, section.models .model-container':
+ {
+ background: theme.palette.background.default,
+ },
'& .prop-format, .parameter__in': {
color: theme.palette.text.disabled,
},
@@ -53,9 +57,10 @@ const useStyles = makeStyles(theme => ({
color: theme.palette.text.primary,
'border-color': theme.palette.divider,
},
- '& .opblock-description-wrapper p, .opblock-external-docs-wrapper p, .opblock-title_normal p, .response-control-media-type__accept-message, .opblock .opblock-section-header>label, .scheme-container .schemes>label, .info .base-url, .model': {
- color: theme.palette.text.hint,
- },
+ '& .opblock-description-wrapper p, .opblock-external-docs-wrapper p, .opblock-title_normal p, .response-control-media-type__accept-message, .opblock .opblock-section-header>label, .scheme-container .schemes>label, .info .base-url, .model':
+ {
+ color: theme.palette.text.hint,
+ },
'& .parameter__name.required:after': {
color: theme.palette.warning.dark,
},
diff --git a/plugins/app-backend/src/lib/config.test.ts b/plugins/app-backend/src/lib/config.test.ts
index 1d5739e711..f36052116a 100644
--- a/plugins/app-backend/src/lib/config.test.ts
+++ b/plugins/app-backend/src/lib/config.test.ts
@@ -22,7 +22,7 @@ import { injectConfig } from './config';
jest.mock('fs-extra');
const fsMock = fs as jest.Mocked;
-const readFileMock = (fsMock.readFile as unknown) as jest.MockedFunction<
+const readFileMock = fsMock.readFile as unknown as jest.MockedFunction<
(name: string) => Promise
>;
diff --git a/plugins/app-backend/src/service/router.ts b/plugins/app-backend/src/service/router.ts
index 681b6335fe..297029dffc 100644
--- a/plugins/app-backend/src/service/router.ts
+++ b/plugins/app-backend/src/service/router.ts
@@ -104,8 +104,7 @@ export async function createRouter(
// The Cache-Control header instructs the browser to not cache html files since it might
// link to static assets from recently deployed versions.
if (
- ((express.static.mime as unknown) as Mime).lookup(path) ===
- 'text/html'
+ (express.static.mime as unknown as Mime).lookup(path) === 'text/html'
) {
res.setHeader('Cache-Control', 'no-store, max-age=0');
}
diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md
index 1ada822262..9fb9e29a4a 100644
--- a/plugins/auth-backend/api-report.md
+++ b/plugins/auth-backend/api-report.md
@@ -223,9 +223,7 @@ export class OAuthEnvironmentHandler implements AuthProviderRouteHandlers {
export interface OAuthHandlers {
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
- handler(
- req: express.Request,
- ): Promise<{
+ handler(req: express.Request): Promise<{
response: AuthResponse;
refreshToken?: string;
}>;
diff --git a/plugins/auth-backend/src/identity/TokenFactory.ts b/plugins/auth-backend/src/identity/TokenFactory.ts
index ae7c674a58..041a292d44 100644
--- a/plugins/auth-backend/src/identity/TokenFactory.ts
+++ b/plugins/auth-backend/src/identity/TokenFactory.ts
@@ -150,7 +150,7 @@ export class TokenFactory implements TokenIssuer {
// the new one. This also needs to be implemented cross-service though, meaning new services
// that boot up need to be able to grab an existing key to use for signing.
this.logger.info(`Created new signing key ${key.kid}`);
- await this.keyStore.addKey((key.toJWK(false) as unknown) as AnyJWK);
+ await this.keyStore.addKey(key.toJWK(false) as unknown as AnyJWK);
// At this point we are allowed to start using the new key
return key as JSONWebKey;
diff --git a/plugins/auth-backend/src/lib/flow/authFlowHelpers.test.ts b/plugins/auth-backend/src/lib/flow/authFlowHelpers.test.ts
index 5446fbd437..117f1b86e4 100644
--- a/plugins/auth-backend/src/lib/flow/authFlowHelpers.test.ts
+++ b/plugins/auth-backend/src/lib/flow/authFlowHelpers.test.ts
@@ -32,10 +32,10 @@ describe('oauth helpers', () => {
describe('postMessageResponse', () => {
const appOrigin = 'http://localhost:3000';
it('should post a message back with payload success', () => {
- const mockResponse = ({
+ const mockResponse = {
end: jest.fn().mockReturnThis(),
setHeader: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
const data: WebMessageResponse = {
type: 'authorization_response',
@@ -64,10 +64,10 @@ describe('oauth helpers', () => {
});
it('should post a message back with payload error', () => {
- const mockResponse = ({
+ const mockResponse = {
end: jest.fn().mockReturnThis(),
setHeader: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
const data: WebMessageResponse = {
type: 'authorization_response',
@@ -84,13 +84,13 @@ describe('oauth helpers', () => {
it('should call postMessage twice but only one of them with target *', () => {
let responseBody = '';
- const mockResponse = ({
+ const mockResponse = {
end: jest.fn(body => {
responseBody = body;
return this;
}),
setHeader: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
const data: WebMessageResponse = {
type: 'authorization_response',
@@ -128,10 +128,10 @@ describe('oauth helpers', () => {
});
it('handles single quotes and unicode chars safely', () => {
- const mockResponse = ({
+ const mockResponse = {
end: jest.fn().mockReturnThis(),
setHeader: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
const data: WebMessageResponse = {
type: 'authorization_response',
@@ -164,23 +164,23 @@ describe('oauth helpers', () => {
describe('ensuresXRequestedWith', () => {
it('should return false if no header present', () => {
- const mockRequest = ({
+ const mockRequest = {
header: () => jest.fn(),
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(ensuresXRequestedWith(mockRequest)).toBe(false);
});
it('should return false if header present with incorrect value', () => {
- const mockRequest = ({
+ const mockRequest = {
header: () => 'INVALID',
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(ensuresXRequestedWith(mockRequest)).toBe(false);
});
it('should return true if header present with correct value', () => {
- const mockRequest = ({
+ const mockRequest = {
header: () => 'XMLHttpRequest',
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(ensuresXRequestedWith(mockRequest)).toBe(true);
});
});
diff --git a/plugins/auth-backend/src/lib/oauth/OAuthAdapter.test.ts b/plugins/auth-backend/src/lib/oauth/OAuthAdapter.test.ts
index 147cf5216f..0b35ea7bc8 100644
--- a/plugins/auth-backend/src/lib/oauth/OAuthAdapter.test.ts
+++ b/plugins/auth-backend/src/lib/oauth/OAuthAdapter.test.ts
@@ -71,19 +71,19 @@ describe('OAuthAdapter', () => {
providerInstance,
oAuthProviderOptions,
);
- const mockRequest = ({
+ const mockRequest = {
query: {
scope: 'user',
env: 'development',
},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
- const mockResponse = ({
+ const mockResponse = {
cookie: jest.fn().mockReturnThis(),
end: jest.fn().mockReturnThis(),
setHeader: jest.fn().mockReturnThis(),
statusCode: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
await oauthProvider.start(mockRequest, mockResponse);
// nonce cookie checks
@@ -108,20 +108,20 @@ describe('OAuthAdapter', () => {
});
const state = { nonce: 'nonce', env: 'development' };
- const mockRequest = ({
+ const mockRequest = {
cookies: {
'test-provider-nonce': 'nonce',
},
query: {
state: encodeState(state),
},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
- const mockResponse = ({
+ const mockResponse = {
cookie: jest.fn().mockReturnThis(),
setHeader: jest.fn().mockReturnThis(),
end: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
await oauthProvider.frameHandler(mockRequest, mockResponse);
expect(mockResponse.cookie).toHaveBeenCalledTimes(1);
@@ -141,20 +141,20 @@ describe('OAuthAdapter', () => {
disableRefresh: true,
});
- const mockRequest = ({
+ const mockRequest = {
cookies: {
'test-provider-nonce': 'nonce',
},
query: {
state: 'nonce',
},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
- const mockResponse = ({
+ const mockResponse = {
cookie: jest.fn().mockReturnThis(),
setHeader: jest.fn().mockReturnThis(),
end: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
await oauthProvider.frameHandler(mockRequest, mockResponse);
expect(mockResponse.cookie).toHaveBeenCalledTimes(0);
@@ -166,15 +166,15 @@ describe('OAuthAdapter', () => {
disableRefresh: false,
});
- const mockRequest = ({
+ const mockRequest = {
header: () => 'XMLHttpRequest',
- } as unknown) as express.Request;
+ } as unknown as express.Request;
- const mockResponse = ({
+ const mockResponse = {
cookie: jest.fn().mockReturnThis(),
send: jest.fn().mockReturnThis(),
status: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
await oauthProvider.logout(mockRequest, mockResponse);
expect(mockResponse.cookie).toHaveBeenCalledTimes(1);
@@ -192,18 +192,18 @@ describe('OAuthAdapter', () => {
disableRefresh: false,
});
- const mockRequest = ({
+ const mockRequest = {
header: () => 'XMLHttpRequest',
cookies: {
'test-provider-refresh-token': 'token',
},
query: {},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
- const mockResponse = ({
+ const mockResponse = {
json: jest.fn().mockReturnThis(),
status: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
await oauthProvider.refresh(mockRequest, mockResponse);
expect(mockResponse.json).toHaveBeenCalledTimes(1);
@@ -222,18 +222,18 @@ describe('OAuthAdapter', () => {
disableRefresh: true,
});
- const mockRequest = ({
+ const mockRequest = {
header: () => 'XMLHttpRequest',
cookies: {
'test-provider-refresh-token': 'token',
},
query: {},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
- const mockResponse = ({
+ const mockResponse = {
send: jest.fn().mockReturnThis(),
status: jest.fn().mockReturnThis(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
await oauthProvider.refresh(mockRequest, mockResponse);
expect(mockResponse.send).toHaveBeenCalledTimes(1);
diff --git a/plugins/auth-backend/src/lib/oauth/helpers.test.ts b/plugins/auth-backend/src/lib/oauth/helpers.test.ts
index 3ef8d74c13..00161ff8cf 100644
--- a/plugins/auth-backend/src/lib/oauth/helpers.test.ts
+++ b/plugins/auth-backend/src/lib/oauth/helpers.test.ts
@@ -21,24 +21,24 @@ describe('OAuthProvider Utils', () => {
describe('verifyNonce', () => {
it('should throw error if cookie nonce missing', () => {
const state = { nonce: 'NONCE', env: 'development' };
- const mockRequest = ({
+ const mockRequest = {
cookies: {},
query: {
state: encodeState(state),
},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(() => {
verifyNonce(mockRequest, 'providera');
}).toThrowError('Auth response is missing cookie nonce');
});
it('should throw error if state nonce missing', () => {
- const mockRequest = ({
+ const mockRequest = {
cookies: {
'providera-nonce': 'NONCE',
},
query: {},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(() => {
verifyNonce(mockRequest, 'providera');
}).toThrowError('Invalid state passed via request');
@@ -46,14 +46,14 @@ describe('OAuthProvider Utils', () => {
it('should throw error if nonce mismatch', () => {
const state = { nonce: 'NONCEB', env: 'development' };
- const mockRequest = ({
+ const mockRequest = {
cookies: {
'providera-nonce': 'NONCEA',
},
query: {
state: encodeState(state),
},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(() => {
verifyNonce(mockRequest, 'providera');
}).toThrowError('Invalid nonce');
@@ -61,14 +61,14 @@ describe('OAuthProvider Utils', () => {
it('should not throw any error if nonce matches', () => {
const state = { nonce: 'NONCE', env: 'development' };
- const mockRequest = ({
+ const mockRequest = {
cookies: {
'providera-nonce': 'NONCE',
},
query: {
state: encodeState(state),
},
- } as unknown) as express.Request;
+ } as unknown as express.Request;
expect(() => {
verifyNonce(mockRequest, 'providera');
}).not.toThrow();
diff --git a/plugins/auth-backend/src/lib/oauth/types.ts b/plugins/auth-backend/src/lib/oauth/types.ts
index 1c11f8291e..c5ece2b921 100644
--- a/plugins/auth-backend/src/lib/oauth/types.ts
+++ b/plugins/auth-backend/src/lib/oauth/types.ts
@@ -106,9 +106,7 @@ export interface OAuthHandlers {
* Handles the redirect from the auth provider when the user has signed in.
* @param {express.Request} req
*/
- handler(
- req: express.Request,
- ): Promise<{
+ handler(req: express.Request): Promise<{
response: AuthResponse;
refreshToken?: string;
}>;
diff --git a/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.test.ts b/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.test.ts
index 48878e9fa6..f7cb500d92 100644
--- a/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.test.ts
+++ b/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.test.ts
@@ -23,7 +23,7 @@ import {
executeRefreshTokenStrategy,
} from './PassportStrategyHelper';
-const mockRequest = ({} as unknown) as express.Request;
+const mockRequest = {} as unknown as express.Request;
describe('PassportStrategyHelper', () => {
class MyCustomRedirectStrategy extends passport.Strategy {
diff --git a/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts b/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts
index 313b4a79bd..a0c07943c1 100644
--- a/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts
+++ b/plugins/auth-backend/src/lib/passport/PassportStrategyHelper.ts
@@ -195,7 +195,7 @@ export const executeFetchUserProfileStrategy = async (
accessToken: string,
): Promise => {
return new Promise((resolve, reject) => {
- const anyStrategy = (providerStrategy as unknown) as ProviderStrategy;
+ const anyStrategy = providerStrategy as unknown as ProviderStrategy;
anyStrategy.userProfile(
accessToken,
(error: Error, rawProfile: passport.Profile) => {
diff --git a/plugins/auth-backend/src/providers/aws-alb/provider.test.ts b/plugins/auth-backend/src/providers/aws-alb/provider.test.ts
index 3785e11d39..a1606e18f2 100644
--- a/plugins/auth-backend/src/providers/aws-alb/provider.test.ts
+++ b/plugins/auth-backend/src/providers/aws-alb/provider.test.ts
@@ -79,22 +79,22 @@ describe('AwsALBAuthProvider', () => {
getEntityByName: jest.fn(),
};
- const mockRequest = ({
+ const mockRequest = {
header: jest.fn(() => {
return 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImZvbyIsImlzcyI6ImZvbyJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.T2BNS4G-6RoiFnXc8Q8TiwdWzTpNitY8jcsGM3N3-Yo';
}),
- } as unknown) as express.Request;
- const mockRequestWithoutJwt = ({
+ } as unknown as express.Request;
+ const mockRequestWithoutJwt = {
header: jest.fn(() => {
return undefined;
}),
- } as unknown) as express.Request;
- const mockResponse = ({
+ } as unknown as express.Request;
+ const mockResponse = {
end: jest.fn(),
header: () => jest.fn(),
json: jest.fn().mockReturnThis(),
status: jest.fn(),
- } as unknown) as express.Response;
+ } as unknown as express.Response;
describe('should transform to type OAuthResponse', () => {
it('when JWT is valid and identity is resolved successfully', async () => {
diff --git a/plugins/auth-backend/src/providers/github/provider.test.ts b/plugins/auth-backend/src/providers/github/provider.test.ts
index 4e53ce4026..c1270a71dc 100644
--- a/plugins/auth-backend/src/providers/github/provider.test.ts
+++ b/plugins/auth-backend/src/providers/github/provider.test.ts
@@ -19,10 +19,10 @@ import { GithubAuthProvider } from './provider';
import * as helpers from '../../lib/passport/PassportStrategyHelper';
import { OAuthResult } from '../../lib/oauth';
-const mockFrameHandler = (jest.spyOn(
+const mockFrameHandler = jest.spyOn(
helpers,
'executeFrameHandlerStrategy',
-) as unknown) as jest.MockedFunction<
+) as unknown as jest.MockedFunction<
() => Promise<{
result: Omit & { params: { scope: string } };
}>
@@ -87,7 +87,7 @@ describe('GithubAuthProvider', () => {
it('when "email" is missing, it should be able to create the profile without it', async () => {
const accessToken = '19xasczxcm9n7gacn9jdgm19me';
- const fullProfile = ({
+ const fullProfile = {
id: 'uid-123',
username: 'jimmymarkum',
provider: 'github',
@@ -99,7 +99,7 @@ describe('GithubAuthProvider', () => {
'https://a1cf74336522e87f135f-2f21ace9a6cf0052456644b80fa06d4f.ssl.cf2.rackcdn.com/images/characters_opt/p-mystic-river-sean-penn.jpg',
},
],
- } as unknown) as PassportProfile;
+ } as unknown as PassportProfile;
const params = {
scope: 'read:scope',
@@ -131,7 +131,7 @@ describe('GithubAuthProvider', () => {
it('when "displayName" is missing, it should be able to create the profile and map "displayName" with "username"', async () => {
const accessToken = '19xasczxcm9n7gacn9jdgm19me';
- const fullProfile = ({
+ const fullProfile = {
id: 'uid-123',
username: 'jimmymarkum',
provider: 'github',
@@ -143,7 +143,7 @@ describe('GithubAuthProvider', () => {
'https://a1cf74336522e87f135f-2f21ace9a6cf0052456644b80fa06d4f.ssl.cf2.rackcdn.com/images/characters_opt/p-mystic-river-sean-penn.jpg',
},
],
- } as unknown) as PassportProfile;
+ } as unknown as PassportProfile;
const params = {
scope: 'read:scope',
diff --git a/plugins/auth-backend/src/providers/gitlab/provider.test.ts b/plugins/auth-backend/src/providers/gitlab/provider.test.ts
index 2277515cc9..511a3dbc54 100644
--- a/plugins/auth-backend/src/providers/gitlab/provider.test.ts
+++ b/plugins/auth-backend/src/providers/gitlab/provider.test.ts
@@ -18,10 +18,10 @@ import { GitlabAuthProvider } from './provider';
import * as helpers from '../../lib/passport/PassportStrategyHelper';
import { OAuthResult } from '../../lib/oauth';
-const mockFrameHandler = (jest.spyOn(
+const mockFrameHandler = jest.spyOn(
helpers,
'executeFrameHandlerStrategy',
-) as unknown) as jest.MockedFunction<() => Promise<{ result: OAuthResult }>>;
+) as unknown as jest.MockedFunction<() => Promise<{ result: OAuthResult }>>;
describe('GitlabAuthProvider', () => {
it('should transform to type OAuthResponse', async () => {
diff --git a/plugins/auth-backend/src/providers/google/provider.test.ts b/plugins/auth-backend/src/providers/google/provider.test.ts
index 68279dc2dd..a69a7b0485 100644
--- a/plugins/auth-backend/src/providers/google/provider.test.ts
+++ b/plugins/auth-backend/src/providers/google/provider.test.ts
@@ -21,10 +21,10 @@ import { getVoidLogger } from '@backstage/backend-common';
import { TokenIssuer } from '../../identity/types';
import { CatalogIdentityClient } from '../../lib/catalog';
-const mockFrameHandler = (jest.spyOn(
+const mockFrameHandler = jest.spyOn(
helpers,
'executeFrameHandlerStrategy',
-) as unknown) as jest.MockedFunction<
+) as unknown as jest.MockedFunction<
() => Promise<{ result: OAuthResult; privateInfo: any }>
>;
@@ -40,8 +40,9 @@ describe('createGoogleProvider', () => {
const provider = new GoogleAuthProvider({
logger: getVoidLogger(),
- catalogIdentityClient: (catalogIdentityClient as unknown) as CatalogIdentityClient,
- tokenIssuer: (tokenIssuer as unknown) as TokenIssuer,
+ catalogIdentityClient:
+ catalogIdentityClient as unknown as CatalogIdentityClient,
+ tokenIssuer: tokenIssuer as unknown as TokenIssuer,
authHandler: async ({ fullProfile }) => ({
profile: {
email: fullProfile.emails![0]!.value,
diff --git a/plugins/auth-backend/src/providers/microsoft/provider.test.ts b/plugins/auth-backend/src/providers/microsoft/provider.test.ts
index c979bed582..429e6691b6 100644
--- a/plugins/auth-backend/src/providers/microsoft/provider.test.ts
+++ b/plugins/auth-backend/src/providers/microsoft/provider.test.ts
@@ -21,10 +21,10 @@ import { getVoidLogger } from '@backstage/backend-common';
import { TokenIssuer } from '../../identity/types';
import { CatalogIdentityClient } from '../../lib/catalog';
-const mockFrameHandler = (jest.spyOn(
+const mockFrameHandler = jest.spyOn(
helpers,
'executeFrameHandlerStrategy',
-) as unknown) as jest.MockedFunction<
+) as unknown as jest.MockedFunction<
() => Promise<{ result: OAuthResult; privateInfo: any }>
>;
@@ -40,8 +40,9 @@ describe('createMicrosoftProvider', () => {
const provider = new MicrosoftAuthProvider({
logger: getVoidLogger(),
- catalogIdentityClient: (catalogIdentityClient as unknown) as CatalogIdentityClient,
- tokenIssuer: (tokenIssuer as unknown) as TokenIssuer,
+ catalogIdentityClient:
+ catalogIdentityClient as unknown as CatalogIdentityClient,
+ tokenIssuer: tokenIssuer as unknown as TokenIssuer,
authHandler: async ({ fullProfile }) => ({
profile: {
email: fullProfile.emails![0]!.value,
diff --git a/plugins/auth-backend/src/providers/microsoft/provider.ts b/plugins/auth-backend/src/providers/microsoft/provider.ts
index 633844a351..26009474be 100644
--- a/plugins/auth-backend/src/providers/microsoft/provider.ts
+++ b/plugins/auth-backend/src/providers/microsoft/provider.ts
@@ -220,24 +220,22 @@ export const microsoftEmailSignInResolver: SignInResolver = async (
return { id: entity.metadata.name, entity, token };
};
-export const microsoftDefaultSignInResolver: SignInResolver = async (
- info,
- ctx,
-) => {
- const { profile } = info;
+export const microsoftDefaultSignInResolver: SignInResolver =
+ async (info, ctx) => {
+ const { profile } = info;
- if (!profile.email) {
- throw new Error('Profile contained no email');
- }
+ if (!profile.email) {
+ throw new Error('Profile contained no email');
+ }
- const userId = profile.email.split('@')[0];
+ const userId = profile.email.split('@')[0];
- const token = await ctx.tokenIssuer.issueToken({
- claims: { sub: userId, ent: [`user:default/${userId}`] },
- });
+ const token = await ctx.tokenIssuer.issueToken({
+ claims: { sub: userId, ent: [`user:default/${userId}`] },
+ });
- return { id: userId, token };
-};
+ return { id: userId, token };
+ };
export type MicrosoftProviderOptions = {
/**
diff --git a/plugins/auth-backend/src/providers/oidc/provider.test.ts b/plugins/auth-backend/src/providers/oidc/provider.test.ts
index 8ad0adb34e..c302c44082 100644
--- a/plugins/auth-backend/src/providers/oidc/provider.test.ts
+++ b/plugins/auth-backend/src/providers/oidc/provider.test.ts
@@ -70,7 +70,7 @@ describe('OidcAuthProvider', () => {
rest.get('https://oidc.test/.well-known/openid-configuration', handler),
);
const provider = new OidcAuthProvider(clientMetadata);
- const { strategy } = ((await (provider as any).implementation) as any) as {
+ const { strategy } = (await (provider as any).implementation) as any as {
strategy: {
_client: ClientMetadata;
_issuer: IssuerMetadata;
@@ -138,7 +138,7 @@ describe('OidcAuthProvider', () => {
const req = {
method: 'GET',
url: 'https://oidc.test/?code=test2',
- session: ({ 'oidc:oidc.test': 'test' } as any) as Session,
+ session: { 'oidc:oidc.test': 'test' } as any as Session,
} as express.Request;
await provider.handler(req);
expect(requestSequence).toEqual([0, 1, 2].map(i => requests[i].url));
diff --git a/plugins/badges-backend/src/lib/BadgeBuilder/DefaultBadgeBuilder.test.ts b/plugins/badges-backend/src/lib/BadgeBuilder/DefaultBadgeBuilder.test.ts
index e26d4a406b..039c8b9b77 100644
--- a/plugins/badges-backend/src/lib/BadgeBuilder/DefaultBadgeBuilder.test.ts
+++ b/plugins/badges-backend/src/lib/BadgeBuilder/DefaultBadgeBuilder.test.ts
@@ -42,7 +42,7 @@ describe('DefaultBadgeBuilder', () => {
createBadge: () => badge,
},
failbadge: {
- createBadge: () => (undefined as unknown) as Badge, // force a bad return value..
+ createBadge: () => undefined as unknown as Badge, // force a bad return value..
},
invalidbadge: {
createBadge: () => ({ style: 'wrong' as BadgeStyle, ...badge }),
diff --git a/plugins/badges/src/components/EntityBadgesDialog.tsx b/plugins/badges/src/components/EntityBadgesDialog.tsx
index a1840e75c0..75caca2d9d 100644
--- a/plugins/badges/src/components/EntityBadgesDialog.tsx
+++ b/plugins/badges/src/components/EntityBadgesDialog.tsx
@@ -48,7 +48,11 @@ export const EntityBadgesDialog = ({ open, onClose }: Props) => {
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
const badgesApi = useApi(badgesApiRef);
- const { value: badges, loading, error } = useAsync(async () => {
+ const {
+ value: badges,
+ loading,
+ error,
+ } = useAsync(async () => {
if (open && entity) {
return await badgesApi.getEntityBadgeSpecs(entity);
}
diff --git a/plugins/catalog-backend-module-ldap/src/ldap/read.test.ts b/plugins/catalog-backend-module-ldap/src/ldap/read.test.ts
index b357b6b408..49afd65c30 100644
--- a/plugins/catalog-backend-module-ldap/src/ldap/read.test.ts
+++ b/plugins/catalog-backend-module-ldap/src/ldap/read.test.ts
@@ -140,21 +140,7 @@ describe('readLdapUsers', () => {
distinguishedName: ['dn-value'],
objectGUID: [
Buffer.from([
- 68,
- 2,
- 125,
- 190,
- 209,
- 0,
- 94,
- 73,
- 133,
- 33,
- 230,
- 174,
- 234,
- 195,
- 160,
+ 68, 2, 125, 190, 209, 0, 94, 73, 133, 33, 230, 174, 234, 195, 160,
152,
]),
],
@@ -286,21 +272,7 @@ describe('readLdapGroups', () => {
distinguishedName: ['dn-value'],
objectGUID: [
Buffer.from([
- 68,
- 2,
- 125,
- 190,
- 209,
- 0,
- 94,
- 73,
- 133,
- 33,
- 230,
- 174,
- 234,
- 195,
- 160,
+ 68, 2, 125, 190, 209, 0, 94, 73, 133, 33, 230, 174, 234, 195, 160,
152,
]),
],
diff --git a/plugins/catalog-backend-module-msgraph/README.md b/plugins/catalog-backend-module-msgraph/README.md
index df141901aa..5dedb800f1 100644
--- a/plugins/catalog-backend-module-msgraph/README.md
+++ b/plugins/catalog-backend-module-msgraph/README.md
@@ -89,9 +89,11 @@ export async function myGroupTransformer(
groupPhoto?: string,
): Promise {
if (
- ((group as unknown) as {
- creationOptions: string[];
- }).creationOptions.includes('ProvisionGroupHomepage')
+ (
+ group as unknown as {
+ creationOptions: string[];
+ }
+ ).creationOptions.includes('ProvisionGroupHomepage')
) {
return undefined;
}
diff --git a/plugins/catalog-backend-module-msgraph/src/microsoftGraph/client.test.ts b/plugins/catalog-backend-module-msgraph/src/microsoftGraph/client.test.ts
index 2b5e72033b..cefa4a52ce 100644
--- a/plugins/catalog-backend-module-msgraph/src/microsoftGraph/client.test.ts
+++ b/plugins/catalog-backend-module-msgraph/src/microsoftGraph/client.test.ts
@@ -21,9 +21,10 @@ import { setupServer } from 'msw/node';
import { MicrosoftGraphClient } from './client';
describe('MicrosoftGraphClient', () => {
- const confidentialClientApplication: jest.Mocked = {
- acquireTokenByClientCredential: jest.fn(),
- } as any;
+ const confidentialClientApplication: jest.Mocked =
+ {
+ acquireTokenByClientCredential: jest.fn(),
+ } as any;
let client: MicrosoftGraphClient;
const worker = setupServer();
diff --git a/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.test.ts b/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.test.ts
index 929d01e128..68f7e216ea 100644
--- a/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.test.ts
+++ b/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.test.ts
@@ -202,14 +202,10 @@ describe('read microsoft graph', () => {
'data:image/jpeg;base64,...',
);
- const {
- groups,
- groupMember,
- groupMemberOf,
- rootGroup,
- } = await readMicrosoftGraphGroups(client, 'tenantid', {
- groupFilter: 'securityEnabled eq false',
- });
+ const { groups, groupMember, groupMemberOf, rootGroup } =
+ await readMicrosoftGraphGroups(client, 'tenantid', {
+ groupFilter: 'securityEnabled eq false',
+ });
const expectedRootGroup = group({
metadata: {
diff --git a/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.ts b/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.ts
index a9e2465ad7..62513b0e10 100644
--- a/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.ts
+++ b/plugins/catalog-backend-module-msgraph/src/microsoftGraph/read.ts
@@ -318,14 +318,12 @@ export function resolveRelations(
// Make sure every group (except root) has at least one parent. If the parent is missing, add the root.
if (rootGroup) {
- const tenantId = rootGroup.metadata.annotations![
- MICROSOFT_GRAPH_TENANT_ID_ANNOTATION
- ];
+ const tenantId =
+ rootGroup.metadata.annotations![MICROSOFT_GRAPH_TENANT_ID_ANNOTATION];
groups.forEach(group => {
- const groupId = group.metadata.annotations![
- MICROSOFT_GRAPH_GROUP_ID_ANNOTATION
- ];
+ const groupId =
+ group.metadata.annotations![MICROSOFT_GRAPH_GROUP_ID_ANNOTATION];
if (!groupId) {
return;
@@ -392,15 +390,11 @@ export async function readMicrosoftGraphOrg(
userFilter: options.userFilter,
logger: options.logger,
});
- const {
- groups,
- rootGroup,
- groupMember,
- groupMemberOf,
- } = await readMicrosoftGraphGroups(client, tenantId, {
- groupFilter: options?.groupFilter,
- transformer: options?.groupTransformer,
- });
+ const { groups, rootGroup, groupMember, groupMemberOf } =
+ await readMicrosoftGraphGroups(client, tenantId, {
+ groupFilter: options?.groupFilter,
+ transformer: options?.groupTransformer,
+ });
resolveRelations(rootGroup, groups, users, groupMember, groupMemberOf);
users.sort((a, b) => a.metadata.name.localeCompare(b.metadata.name));
diff --git a/plugins/catalog-backend/CHANGELOG.md b/plugins/catalog-backend/CHANGELOG.md
index 07799cfad4..3849fec510 100644
--- a/plugins/catalog-backend/CHANGELOG.md
+++ b/plugins/catalog-backend/CHANGELOG.md
@@ -442,13 +442,11 @@
and lets the other processors take care of further processing.
```typescript
- const customRepositoryParser: BitbucketRepositoryParser = async function* customRepositoryParser({
- client,
- repository,
- }) {
- // Custom logic for interpret the matching repository.
- // See defaultRepositoryParser for an example
- };
+ const customRepositoryParser: BitbucketRepositoryParser =
+ async function* customRepositoryParser({ client, repository }) {
+ // Custom logic for interpret the matching repository.
+ // See defaultRepositoryParser for an example
+ };
const processor = BitbucketDiscoveryProcessor.fromConfig(env.config, {
parser: customRepositoryParser,
@@ -920,7 +918,6 @@
spec:
type: website
---
-
```
This behaves now the same way as Kubernetes handles multiple documents in a single YAML file.
diff --git a/plugins/catalog-backend/api-report.md b/plugins/catalog-backend/api-report.md
index b6f2df602a..7286855d4e 100644
--- a/plugins/catalog-backend/api-report.md
+++ b/plugins/catalog-backend/api-report.md
@@ -88,9 +88,7 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
logger: Logger_2;
});
// (undocumented)
- extractInformationFromArn(
- arn: string,
- ): {
+ extractInformationFromArn(arn: string): {
accountId: string;
organizationId: string;
};
@@ -596,7 +594,8 @@ export class DefaultCatalogCollator implements DocumentCollator {
//
// @public (undocumented)
export class DefaultCatalogProcessingOrchestrator
- implements CatalogProcessingOrchestrator {
+ implements CatalogProcessingOrchestrator
+{
constructor(options: {
processors: CatalogProcessor[];
integrations: ScmIntegrationRegistry;
diff --git a/plugins/catalog-backend/src/catalog/DatabaseLocationsCatalog.ts b/plugins/catalog-backend/src/catalog/DatabaseLocationsCatalog.ts
index fff34d1d78..e81c72a3da 100644
--- a/plugins/catalog-backend/src/catalog/DatabaseLocationsCatalog.ts
+++ b/plugins/catalog-backend/src/catalog/DatabaseLocationsCatalog.ts
@@ -52,12 +52,8 @@ export class DatabaseLocationsCatalog implements LocationsCatalog {
}
async location(id: string): Promise {
- const {
- message,
- status,
- timestamp,
- ...data
- } = await this.database.location(id);
+ const { message, status, timestamp, ...data } =
+ await this.database.location(id);
return {
currentStatus: {
message,
diff --git a/plugins/catalog-backend/src/database/CommonDatabase.ts b/plugins/catalog-backend/src/database/CommonDatabase.ts
index 272ac08c4c..79cad3bd23 100644
--- a/plugins/catalog-backend/src/database/CommonDatabase.ts
+++ b/plugins/catalog-backend/src/database/CommonDatabase.ts
@@ -556,9 +556,10 @@ export class CommonDatabase implements Database {
}
}
-function parsePagination(
- input?: EntityPagination,
-): { limit?: number; offset?: number } {
+function parsePagination(input?: EntityPagination): {
+ limit?: number;
+ offset?: number;
+} {
if (!input) {
return {};
}
diff --git a/plugins/catalog-backend/src/ingestion/processors/AnnotateLocationEntityProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/AnnotateLocationEntityProcessor.ts
index 5a0c8b8418..54079e13ff 100644
--- a/plugins/catalog-backend/src/ingestion/processors/AnnotateLocationEntityProcessor.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/AnnotateLocationEntityProcessor.ts
@@ -71,9 +71,8 @@ export class AnnotateLocationEntityProcessor implements CatalogProcessor {
annotations: pickBy(
{
[LOCATION_ANNOTATION]: stringifyLocationReference(location),
- [ORIGIN_LOCATION_ANNOTATION]: stringifyLocationReference(
- originLocation,
- ),
+ [ORIGIN_LOCATION_ANNOTATION]:
+ stringifyLocationReference(originLocation),
[VIEW_URL_ANNOTATION]: viewUrl,
[EDIT_URL_ANNOTATION]: editUrl,
[SOURCE_LOCATION_ANNOTATION]: sourceLocation,
diff --git a/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.test.ts
index a3b1dfbfcb..88b033c33f 100644
--- a/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.test.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.test.ts
@@ -37,8 +37,7 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
return {
Accounts: [
{
- Arn:
- 'arn:aws:organizations::192594491037:account/o-1vl18kc5a3/957140518395',
+ Arn: 'arn:aws:organizations::192594491037:account/o-1vl18kc5a3/957140518395',
Name: 'testaccount',
},
],
@@ -83,13 +82,11 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
return {
Accounts: [
{
- Arn:
- 'arn:aws:organizations::192594491037:account/o-1vl18kc5a3/957140518395',
+ Arn: 'arn:aws:organizations::192594491037:account/o-1vl18kc5a3/957140518395',
Name: 'testaccount',
},
{
- Arn:
- 'arn:aws:organizations::192594491037:account/o-zzzzzzzzz/957140518395',
+ Arn: 'arn:aws:organizations::192594491037:account/o-zzzzzzzzz/957140518395',
Name: 'testaccount2',
},
],
diff --git a/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.ts
index beb179a0d2..655f99d14a 100644
--- a/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/AwsOrganizationCloudAccountProcessor.ts
@@ -89,9 +89,10 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
.replace(/[^a-zA-Z0-9\-]/g, '-');
}
- extractInformationFromArn(
- arn: string,
- ): { accountId: string; organizationId: string } {
+ extractInformationFromArn(arn: string): {
+ accountId: string;
+ organizationId: string;
+ } {
const parts = arn.split('/');
return {
diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts
index e2b295e7ff..c067958093 100644
--- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts
@@ -256,15 +256,16 @@ describe('BitbucketDiscoveryProcessor', () => {
});
describe('Custom repository parser', () => {
- const customRepositoryParser: BitbucketRepositoryParser = async function* customRepositoryParser({}) {
- yield results.location(
- {
- type: 'custom-location-type',
- target: 'custom-target',
- },
- true,
- );
- };
+ const customRepositoryParser: BitbucketRepositoryParser =
+ async function* customRepositoryParser({}) {
+ yield results.location(
+ {
+ type: 'custom-location-type',
+ target: 'custom-target',
+ },
+ true,
+ );
+ };
const processor = BitbucketDiscoveryProcessor.fromConfig(
new ConfigReader({
diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts
index 9d53b7e5b5..3b535881d9 100644
--- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts
@@ -136,9 +136,11 @@ export async function readBitbucketOrg(
return result;
}
-function parseUrl(
- urlString: string,
-): { projectSearchPath: RegExp; repoSearchPath: RegExp; catalogPath: string } {
+function parseUrl(urlString: string): {
+ projectSearchPath: RegExp;
+ repoSearchPath: RegExp;
+ catalogPath: string;
+} {
const url = new URL(urlString);
const path = url.pathname.substr(1).split('/');
diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.test.ts
index 467e9c1ea2..ca8c702c8f 100644
--- a/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.test.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.test.ts
@@ -21,9 +21,10 @@ import { getOrganizationRepositories } from './github';
import { ConfigReader } from '@backstage/config';
jest.mock('./github');
-const mockGetOrganizationRepositories = getOrganizationRepositories as jest.MockedFunction<
- typeof getOrganizationRepositories
->;
+const mockGetOrganizationRepositories =
+ getOrganizationRepositories as jest.MockedFunction<
+ typeof getOrganizationRepositories
+ >;
describe('GithubDiscoveryProcessor', () => {
describe('parseUrl', () => {
@@ -32,6 +33,7 @@ describe('GithubDiscoveryProcessor', () => {
parseUrl('https://github.com/foo/proj/blob/master/catalog.yaml'),
).toEqual({
org: 'foo',
+ host: 'github.com',
repoSearchPath: /^proj$/,
catalogPath: '/blob/master/catalog.yaml',
});
@@ -39,6 +41,7 @@ describe('GithubDiscoveryProcessor', () => {
parseUrl('https://github.com/foo/proj*/blob/master/catalog.yaml'),
).toEqual({
org: 'foo',
+ host: 'github.com',
repoSearchPath: /^proj.*$/,
catalogPath: '/blob/master/catalog.yaml',
});
diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts
index 2219e02406..f7069a9f64 100644
--- a/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/GithubDiscoveryProcessor.ts
@@ -56,17 +56,26 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
return false;
}
- const gitHubConfig = this.integrations.github.byUrl(location.target)
- ?.config;
+ const gitHubConfig = this.integrations.github.byUrl(
+ location.target,
+ )?.config;
if (!gitHubConfig) {
throw new Error(
`There is no GitHub integration that matches ${location.target}. Please add a configuration entry for it under integrations.github`,
);
}
+
+ const { org, repoSearchPath, catalogPath, host } = parseUrl(
+ location.target,
+ );
+
+ // Building the org url here so that the github creds provider doesn't need to know
+ // about how to handle the wild card which is special for this processor.
+ const orgUrl = `https://${host}/${org}`;
+
const { headers } = await GithubCredentialsProvider.create(
gitHubConfig,
- ).getCredentials({ url: location.target });
- const { org, repoSearchPath, catalogPath } = parseUrl(location.target);
+ ).getCredentials({ url: orgUrl });
const client = graphql.defaults({
baseUrl: gitHubConfig.apiBaseUrl,
@@ -110,9 +119,12 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
* Helpers
*/
-export function parseUrl(
- urlString: string,
-): { org: string; repoSearchPath: RegExp; catalogPath: string } {
+export function parseUrl(urlString: string): {
+ org: string;
+ repoSearchPath: RegExp;
+ catalogPath: string;
+ host: string;
+} {
const url = new URL(urlString);
const path = url.pathname.substr(1).split('/');
@@ -122,6 +134,7 @@ export function parseUrl(
org: decodeURIComponent(path[0]),
repoSearchPath: escapeRegExp(decodeURIComponent(path[1])),
catalogPath: `/${decodeURIComponent(path.slice(2).join('/'))}`,
+ host: url.host,
};
}
diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubMultiOrgReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubMultiOrgReaderProcessor.ts
index 5223acba4a..ebfcaf5b5d 100644
--- a/plugins/catalog-backend/src/ingestion/processors/GithubMultiOrgReaderProcessor.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/GithubMultiOrgReaderProcessor.ts
@@ -75,8 +75,9 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
return false;
}
- const gitHubConfig = this.integrations.github.byUrl(location.target)
- ?.config;
+ const gitHubConfig = this.integrations.github.byUrl(
+ location.target,
+ )?.config;
if (!gitHubConfig) {
throw new Error(
`There is no GitHub integration that matches ${location.target}. Please add a configuration entry for it under integrations.github`,
@@ -93,12 +94,10 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
for (const orgConfig of orgsToProcess) {
try {
- const {
- headers,
- type: tokenType,
- } = await credentialsProvider.getCredentials({
- url: `${baseUrl}/${orgConfig.name}`,
- });
+ const { headers, type: tokenType } =
+ await credentialsProvider.getCredentials({
+ url: `${baseUrl}/${orgConfig.name}`,
+ });
const client = graphql.defaults({
baseUrl: gitHubConfig.apiBaseUrl,
headers,
diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts
index 364042f74d..3a82ff6516 100644
--- a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts
@@ -113,12 +113,10 @@ export class GithubOrgReaderProcessor implements CatalogProcessor {
}
const credentialsProvider = GithubCredentialsProvider.create(gitHubConfig);
- const {
- headers,
- type: tokenType,
- } = await credentialsProvider.getCredentials({
- url: orgUrl,
- });
+ const { headers, type: tokenType } =
+ await credentialsProvider.getCredentials({
+ url: orgUrl,
+ });
const client = graphql.defaults({
baseUrl: gitHubConfig.apiBaseUrl,
diff --git a/plugins/catalog-backend/src/ingestion/processors/LocationEntityProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/LocationEntityProcessor.test.ts
index b018542fcc..c4551e30f8 100644
--- a/plugins/catalog-backend/src/ingestion/processors/LocationEntityProcessor.test.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/LocationEntityProcessor.test.ts
@@ -26,7 +26,7 @@ import { toAbsoluteUrl } from './LocationEntityProcessor';
describe('LocationEntityProcessor', () => {
describe('toAbsoluteUrl', () => {
it('handles files', () => {
- const integrations = ({} as unknown) as ScmIntegrationRegistry;
+ const integrations = {} as unknown as ScmIntegrationRegistry;
const base: LocationSpec = {
type: 'file',
target: `some${path.sep}path${path.sep}catalog-info.yaml`,
diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts
index 6f33646c54..27f07d58a2 100644
--- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts
@@ -24,17 +24,16 @@ export type BitbucketRepositoryParser = (options: {
logger: Logger;
}) => AsyncIterable;
-export const defaultRepositoryParser: BitbucketRepositoryParser = async function* defaultRepositoryParser({
- target,
-}) {
- yield results.location(
- {
- type: 'url',
- target: target,
- },
- // Not all locations may actually exist, since the user defined them as a wildcard pattern.
- // Thus, we emit them as optional and let the downstream processor find them while not outputting
- // an error if it couldn't.
- true,
- );
-};
+export const defaultRepositoryParser: BitbucketRepositoryParser =
+ async function* defaultRepositoryParser({ target }) {
+ yield results.location(
+ {
+ type: 'url',
+ target: target,
+ },
+ // Not all locations may actually exist, since the user defined them as a wildcard pattern.
+ // Thus, we emit them as optional and let the downstream processor find them while not outputting
+ // an error if it couldn't.
+ true,
+ );
+ };
diff --git a/plugins/catalog-backend/src/ingestion/processors/github/github.ts b/plugins/catalog-backend/src/ingestion/processors/github/github.ts
index 7e1ef136eb..70479110c2 100644
--- a/plugins/catalog-backend/src/ingestion/processors/github/github.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/github/github.ts
@@ -330,7 +330,7 @@ export async function queryWithPaging<
GraphqlType,
OutputType,
Variables extends {},
- Response = QueryResponse
+ Response = QueryResponse,
>(
client: typeof graphql,
query: string,
diff --git a/plugins/catalog-backend/src/ingestion/processors/util/parse.ts b/plugins/catalog-backend/src/ingestion/processors/util/parse.ts
index e93b2a0200..c9c6c79311 100644
--- a/plugins/catalog-backend/src/ingestion/processors/util/parse.ts
+++ b/plugins/catalog-backend/src/ingestion/processors/util/parse.ts
@@ -58,11 +58,9 @@ export function* parseEntityYaml(
}
}
-export const defaultEntityDataParser: CatalogProcessorParser = async function* defaultEntityDataParser({
- data,
- location,
-}) {
- for (const e of parseEntityYaml(data, location)) {
- yield e;
- }
-};
+export const defaultEntityDataParser: CatalogProcessorParser =
+ async function* defaultEntityDataParser({ data, location }) {
+ for (const e of parseEntityYaml(data, location)) {
+ yield e;
+ }
+ };
diff --git a/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts b/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts
index d177b1aa32..32ce28dc1b 100644
--- a/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts
+++ b/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts
@@ -31,9 +31,9 @@ describe('ConfigLocationEntityProvider', () => {
},
});
- const mockConnection = ({
+ const mockConnection = {
applyMutation: jest.fn(),
- } as unknown) as EntityProviderConnection;
+ } as unknown as EntityProviderConnection;
const locationProvider = new ConfigLocationEntityProvider(mockConfig);
await locationProvider.connect(mockConnection);
diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.test.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.test.ts
index b87635db85..5f3bab63e7 100644
--- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.test.ts
+++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.test.ts
@@ -22,17 +22,17 @@ import { CatalogProcessingOrchestrator } from './processing/types';
import { Stitcher } from './stitching/Stitcher';
describe('DefaultCatalogProcessingEngine', () => {
- const db = ({
+ const db = {
transaction: jest.fn(),
getProcessableEntities: jest.fn(),
updateProcessedEntity: jest.fn(),
- } as unknown) as jest.Mocked;
+ } as unknown as jest.Mocked;
const orchestrator: jest.Mocked = {
process: jest.fn(),
};
- const stitcher = ({
+ const stitcher = {
stitch: jest.fn(),
- } as unknown) as jest.Mocked;
+ } as unknown as jest.Mocked;
beforeEach(() => {
jest.resetAllMocks();
diff --git a/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts b/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts
index 7cc99210c9..e9772b4aa3 100644
--- a/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts
+++ b/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts
@@ -28,9 +28,10 @@ import {
DbSearchRow,
} from './database/tables';
-function parsePagination(
- input?: EntityPagination,
-): { limit?: number; offset?: number } {
+function parsePagination(input?: EntityPagination): {
+ limit?: number;
+ offset?: number;
+} {
if (!input) {
return {};
}
diff --git a/plugins/catalog-backend/src/next/NextRouter.ts b/plugins/catalog-backend/src/next/NextRouter.ts
index eb9e5247ed..849d2ee36d 100644
--- a/plugins/catalog-backend/src/next/NextRouter.ts
+++ b/plugins/catalog-backend/src/next/NextRouter.ts
@@ -47,13 +47,8 @@ export interface RouterOptions {
export async function createNextRouter(
options: RouterOptions,
): Promise {
- const {
- entitiesCatalog,
- locationAnalyzer,
- locationService,
- config,
- logger,
- } = options;
+ const { entitiesCatalog, locationAnalyzer, locationService, config, logger } =
+ options;
const router = Router();
router.use(express.json());
diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts
index e449e5580c..6a0626afc4 100644
--- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts
+++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts
@@ -79,10 +79,10 @@ describe('Default Processing Database', () => {
'updates refresh state with varying location keys, %p',
async databaseId => {
const mockWarn = jest.fn();
- const { db } = await createDatabase(databaseId, ({
+ const { db } = await createDatabase(databaseId, {
debug: jest.fn(),
warn: mockWarn,
- } as unknown) as Logger);
+ } as unknown as Logger);
await db.transaction(async tx => {
const knexTx = tx as Knex.Transaction;
diff --git a/plugins/catalog-backend/src/next/processing/DefaultCatalogProcessingOrchestrator.ts b/plugins/catalog-backend/src/next/processing/DefaultCatalogProcessingOrchestrator.ts
index bb23b6afb3..d7f51807a3 100644
--- a/plugins/catalog-backend/src/next/processing/DefaultCatalogProcessingOrchestrator.ts
+++ b/plugins/catalog-backend/src/next/processing/DefaultCatalogProcessingOrchestrator.ts
@@ -54,7 +54,8 @@ type Context = {
};
export class DefaultCatalogProcessingOrchestrator
- implements CatalogProcessingOrchestrator {
+ implements CatalogProcessingOrchestrator
+{
constructor(
private readonly options: {
processors: CatalogProcessor[];
diff --git a/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts b/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts
index 7ab91560b1..1f9c68e549 100644
--- a/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts
+++ b/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts
@@ -59,23 +59,21 @@ export class DefaultCatalogCollator implements DocumentCollator {
const baseUrl = await this.discovery.getBaseUrl('catalog');
const res = await fetch(`${baseUrl}/entities`);
const entities: Entity[] = await res.json();
- return entities.map(
- (entity: Entity): CatalogEntityDocument => {
- return {
- title: entity.metadata.name,
- location: this.applyArgsToFormat(this.locationTemplate, {
- namespace: entity.metadata.namespace || 'default',
- kind: entity.kind,
- name: entity.metadata.name,
- }),
- text: entity.metadata.description || '',
- componentType: entity.spec?.type?.toString() || 'other',
+ return entities.map((entity: Entity): CatalogEntityDocument => {
+ return {
+ title: entity.metadata.name,
+ location: this.applyArgsToFormat(this.locationTemplate, {
namespace: entity.metadata.namespace || 'default',
kind: entity.kind,
- lifecycle: (entity.spec?.lifecycle as string) || '',
- owner: (entity.spec?.owner as string) || '',
- };
- },
- );
+ name: entity.metadata.name,
+ }),
+ text: entity.metadata.description || '',
+ componentType: entity.spec?.type?.toString() || 'other',
+ namespace: entity.metadata.namespace || 'default',
+ kind: entity.kind,
+ lifecycle: (entity.spec?.lifecycle as string) || '',
+ owner: (entity.spec?.owner as string) || '',
+ };
+ });
}
}
diff --git a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts
index 9f867e241f..1d5d41fc03 100644
--- a/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts
+++ b/plugins/catalog-backend/src/service/request/parseEntityTransformParams.test.ts
@@ -60,8 +60,8 @@ describe('parseEntityTransformParams', () => {
expect(
parseEntityTransformParams({ fields: 'kind,metadata.name' })!(entity),
).toEqual({ kind: 'k', metadata: { name: 'n' } });
- expect(
- parseEntityTransformParams({ fields: 'metadata' })!(entity),
- ).toEqual({ metadata: { name: 'n', tags: ['t1', 't2'] } });
+ expect(parseEntityTransformParams({ fields: 'metadata' })!(entity)).toEqual(
+ { metadata: { name: 'n', tags: ['t1', 't2'] } },
+ );
});
});
diff --git a/plugins/catalog-backend/src/service/router.test.ts b/plugins/catalog-backend/src/service/router.test.ts
index c4631c6c2c..8e8b91d013 100644
--- a/plugins/catalog-backend/src/service/router.test.ts
+++ b/plugins/catalog-backend/src/service/router.test.ts
@@ -291,10 +291,10 @@ describe('createRouter readonly disabled', () => {
describe('POST /locations', () => {
it('rejects malformed locations', async () => {
- const spec = ({
+ const spec = {
typez: 'b',
target: 'c',
- } as unknown) as LocationSpec;
+ } as unknown as LocationSpec;
const response = await request(app).post('/locations').send(spec);
diff --git a/plugins/catalog-backend/src/service/standaloneServer.ts b/plugins/catalog-backend/src/service/standaloneServer.ts
index ab8d40d74c..7e0bacde32 100644
--- a/plugins/catalog-backend/src/service/standaloneServer.ts
+++ b/plugins/catalog-backend/src/service/standaloneServer.ts
@@ -49,11 +49,8 @@ export async function startStandaloneServer(
config,
reader,
});
- const {
- entitiesCatalog,
- locationsCatalog,
- higherOrderOperation,
- } = await builder.build();
+ const { entitiesCatalog, locationsCatalog, higherOrderOperation } =
+ await builder.build();
logger.debug('Starting application server...');
const router = await createRouter({
diff --git a/plugins/catalog-backend/src/service/util.ts b/plugins/catalog-backend/src/service/util.ts
index 7902458900..d2f9fa0a4c 100644
--- a/plugins/catalog-backend/src/service/util.ts
+++ b/plugins/catalog-backend/src/service/util.ts
@@ -52,7 +52,7 @@ export async function validateRequestBody(
throw new InputError(`Malformed request: ${e}`);
}
- return (body as unknown) as T;
+ return body as unknown as T;
}
export function disallowReadonlyMode(readonly: boolean) {
diff --git a/plugins/catalog-graphql/src/graphql/types.ts b/plugins/catalog-graphql/src/graphql/types.ts
index dbcf30152f..71e40181d4 100644
--- a/plugins/catalog-graphql/src/graphql/types.ts
+++ b/plugins/catalog-graphql/src/graphql/types.ts
@@ -219,7 +219,7 @@ export interface SubscriptionSubscriberObject<
TKey extends string,
TParent,
TContext,
- TArgs
+ TArgs,
> {
subscribe: SubscriptionSubscribeFn<
{ [key in TKey]: TResult },
@@ -245,7 +245,7 @@ export type SubscriptionObject<
TKey extends string,
TParent,
TContext,
- TArgs
+ TArgs,
> =
| SubscriptionSubscriberObject
| SubscriptionResolverObject;
@@ -255,7 +255,7 @@ export type SubscriptionResolver<
TKey extends string,
TParent = {},
TContext = {},
- TArgs = {}
+ TArgs = {},
> =
| ((
...args: any[]
@@ -279,7 +279,7 @@ export type DirectiveResolverFn<
TResult = {},
TParent = {},
TContext = {},
- TArgs = {}
+ TArgs = {},
> = (
next: NextResolverFn,
parent: TParent,
@@ -364,7 +364,7 @@ export interface JsonObjectScalarConfig
export type EntityMetadataResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['EntityMetadata']
+ ParentType = ResolversParentTypes['EntityMetadata'],
> = ResolversObject<{
__resolveType: TypeResolveFn<
'DefaultEntityMetadata' | 'ComponentMetadata' | 'TemplateMetadata',
@@ -393,7 +393,7 @@ export type EntityMetadataResolvers<
export type DefaultEntityMetadataResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['DefaultEntityMetadata']
+ ParentType = ResolversParentTypes['DefaultEntityMetadata'],
> = ResolversObject<{
name?: Resolver;
annotations?: Resolver;
@@ -418,7 +418,7 @@ export type DefaultEntityMetadataResolvers<
export type ComponentMetadataResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['ComponentMetadata']
+ ParentType = ResolversParentTypes['ComponentMetadata'],
> = ResolversObject<{
name?: Resolver;
annotations?: Resolver;
@@ -448,7 +448,7 @@ export type ComponentMetadataResolvers<
export type TemplateMetadataResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['TemplateMetadata']
+ ParentType = ResolversParentTypes['TemplateMetadata'],
> = ResolversObject<{
name?: Resolver;
annotations?: Resolver;
@@ -478,7 +478,7 @@ export type TemplateMetadataResolvers<
export type TemplateEntitySpecResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['TemplateEntitySpec']
+ ParentType = ResolversParentTypes['TemplateEntitySpec'],
> = ResolversObject<{
type?: Resolver;
path?: Resolver, ParentType, ContextType>;
@@ -489,7 +489,7 @@ export type TemplateEntitySpecResolvers<
export type ComponentEntitySpecResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['ComponentEntitySpec']
+ ParentType = ResolversParentTypes['ComponentEntitySpec'],
> = ResolversObject<{
title?: Resolver;
lifecycle?: Resolver;
@@ -499,7 +499,7 @@ export type ComponentEntitySpecResolvers<
export type LocationEntitySpecResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['LocationEntitySpec']
+ ParentType = ResolversParentTypes['LocationEntitySpec'],
> = ResolversObject<{
type?: Resolver;
target?: Resolver, ParentType, ContextType>;
@@ -509,7 +509,7 @@ export type LocationEntitySpecResolvers<
export type DefaultEntitySpecResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['DefaultEntitySpec']
+ ParentType = ResolversParentTypes['DefaultEntitySpec'],
> = ResolversObject<{
raw?: Resolver, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn;
@@ -517,7 +517,7 @@ export type DefaultEntitySpecResolvers<
export type EntitySpecResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['EntitySpec']
+ ParentType = ResolversParentTypes['EntitySpec'],
> = ResolversObject<{
__resolveType: TypeResolveFn<
| 'DefaultEntitySpec'
@@ -531,7 +531,7 @@ export type EntitySpecResolvers<
export type CatalogEntityResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['CatalogEntity']
+ ParentType = ResolversParentTypes['CatalogEntity'],
> = ResolversObject<{
apiVersion?: Resolver;
kind?: Resolver;
@@ -546,7 +546,7 @@ export type CatalogEntityResolvers<
export type CatalogQueryResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['CatalogQuery']
+ ParentType = ResolversParentTypes['CatalogQuery'],
> = ResolversObject<{
list?: Resolver<
Array,
@@ -558,7 +558,7 @@ export type CatalogQueryResolvers<
export type QueryResolvers<
ContextType = ModuleContext,
- ParentType = ResolversParentTypes['Query']
+ ParentType = ResolversParentTypes['Query'],
> = ResolversObject<{
catalog?: Resolver;
}>;
diff --git a/plugins/catalog-import/api-report.md b/plugins/catalog-import/api-report.md
index ac4360f463..708ee84fd0 100644
--- a/plugins/catalog-import/api-report.md
+++ b/plugins/catalog-import/api-report.md
@@ -178,7 +178,7 @@ export const ImportStepper: ({
//
// @public
export const PreparePullRequestForm: <
- TFieldValues extends Record
+ TFieldValues extends Record,
>({
defaultValues,
onSubmit,
diff --git a/plugins/catalog-import/src/api/CatalogImportClient.test.ts b/plugins/catalog-import/src/api/CatalogImportClient.test.ts
index e2c3f2dc47..bae363d700 100644
--- a/plugins/catalog-import/src/api/CatalogImportClient.test.ts
+++ b/plugins/catalog-import/src/api/CatalogImportClient.test.ts
@@ -192,7 +192,7 @@ describe('CatalogImportClient', () => {
});
it('should find locations from github', async () => {
- ((new Octokit().search.code as any) as jest.Mock).mockResolvedValueOnce({
+ (new Octokit().search.code as any as jest.Mock).mockResolvedValueOnce({
data: {
total_count: 2,
items: [
@@ -248,7 +248,7 @@ describe('CatalogImportClient', () => {
});
it('should find repository from github', async () => {
- ((new Octokit().search.code as any) as jest.Mock).mockResolvedValueOnce({
+ (new Octokit().search.code as any as jest.Mock).mockResolvedValueOnce({
data: { total_count: 0, items: [] },
});
@@ -312,7 +312,7 @@ describe('CatalogImportClient', () => {
});
expect(
- ((new Octokit().git.createRef as any) as jest.Mock).mock.calls[0][0],
+ (new Octokit().git.createRef as any as jest.Mock).mock.calls[0][0],
).toEqual({
owner: 'backstage',
repo: 'backstage',
@@ -320,7 +320,7 @@ describe('CatalogImportClient', () => {
sha: 'any',
});
expect(
- ((new Octokit().repos.createOrUpdateFileContents as any) as jest.Mock)
+ (new Octokit().repos.createOrUpdateFileContents as any as jest.Mock)
.mock.calls[0][0],
).toEqual({
owner: 'backstage',
@@ -331,7 +331,7 @@ describe('CatalogImportClient', () => {
branch: 'backstage-integration',
});
expect(
- ((new Octokit().pulls.create as any) as jest.Mock).mock.calls[0][0],
+ (new Octokit().pulls.create as any as jest.Mock).mock.calls[0][0],
).toEqual({
owner: 'backstage',
repo: 'backstage',
diff --git a/plugins/catalog-import/src/components/ImportComponentPage.tsx b/plugins/catalog-import/src/components/ImportComponentPage.tsx
index f4ca144165..bf53af134f 100644
--- a/plugins/catalog-import/src/components/ImportComponentPage.tsx
+++ b/plugins/catalog-import/src/components/ImportComponentPage.tsx
@@ -53,8 +53,7 @@ export const ImportComponentPage = (opts: StepperProviderOpts) => {
title="Register an existing component"
deepLink={{
title: 'Learn more about the Software Catalog',
- link:
- 'https://backstage.io/docs/features/software-catalog/software-catalog-overview',
+ link: 'https://backstage.io/docs/features/software-catalog/software-catalog-overview',
}}
>
diff --git a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx
index 51524dae26..054fd99895 100644
--- a/plugins/catalog-import/src/components/ImportStepper/defaults.tsx
+++ b/plugins/catalog-import/src/components/ImportStepper/defaults.tsx
@@ -39,9 +39,10 @@ import { ConfigApi } from '@backstage/core-plugin-api';
export type StepperProviderOpts = {
pullRequest?: {
disable?: boolean;
- preparePullRequest?: (
- apis: StepperApis,
- ) => { title?: string; body?: string };
+ preparePullRequest?: (apis: StepperApis) => {
+ title?: string;
+ body?: string;
+ };
};
};
diff --git a/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx b/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx
index 69f58751b8..9cc9532a3d 100644
--- a/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx
+++ b/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx
@@ -382,7 +382,7 @@ describe('', () => {
);
catalogImportApi.analyzeUrl.mockReturnValueOnce(
- Promise.resolve(({ type: 'unknown' } as any) as AnalyzeResult),
+ Promise.resolve({ type: 'unknown' } as any as AnalyzeResult),
);
await act(async () => {
diff --git a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx
index dea3b4bac9..ab3241add4 100644
--- a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx
+++ b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreparePullRequestForm.tsx
@@ -49,19 +49,14 @@ type Props> = Pick<
* @param render render the form elements
*/
export const PreparePullRequestForm = <
- TFieldValues extends Record
+ TFieldValues extends Record,
>({
defaultValues,
onSubmit,
render,
}: Props) => {
- const {
- handleSubmit,
- watch,
- control,
- register,
- errors,
- } = useForm({ mode: 'onTouched', defaultValues });
+ const { handleSubmit, watch, control, register, errors } =
+ useForm({ mode: 'onTouched', defaultValues });
return (