Merge pull request #8488 from cmpadden/remove-deprecations
Remove Deprecations (release-2021-01-28, 2021-06-01, 2021-10-28, 2021-11-18)
This commit is contained in:
@@ -73,7 +73,7 @@ const DefaultErrorBoundaryFallback = ({
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a set of default components to pass along to {@link @backstage/core-app-api#createApp}.
|
||||
* Creates a set of default components to pass along to {@link @backstage/core-app-api#createSpecializedApp}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,6 @@ export const themes: AppTheme[] = [
|
||||
title: 'Light Theme',
|
||||
variant: 'light',
|
||||
icon: <LightIcon />,
|
||||
theme: lightTheme,
|
||||
Provider: ({ children }) => (
|
||||
<ThemeProvider theme={lightTheme}>
|
||||
<CssBaseline>{children}</CssBaseline>
|
||||
@@ -40,7 +39,6 @@ export const themes: AppTheme[] = [
|
||||
title: 'Dark Theme',
|
||||
variant: 'dark',
|
||||
icon: <DarkIcon />,
|
||||
theme: darkTheme,
|
||||
Provider: ({ children }) => (
|
||||
<ThemeProvider theme={darkTheme}>
|
||||
<CssBaseline>{children}</CssBaseline>
|
||||
|
||||
@@ -45,9 +45,9 @@ return something()
|
||||
it('should refactor imports', () => {
|
||||
const input = `
|
||||
/* COPYRIGHT: ME */
|
||||
import { Button as MyButton, createApiRef, createApp } from '@backstage/core';
|
||||
import { Button as MyButton, createApiRef, createSpecializedApp } from '@backstage/core';
|
||||
|
||||
const app = createApp();
|
||||
const app = createSpecializedApp();
|
||||
const apiRef = createApiRef();
|
||||
const button = <MyButton />
|
||||
`;
|
||||
@@ -57,9 +57,9 @@ const button = <MyButton />
|
||||
import { Button as MyButton } from '@backstage/core-components';
|
||||
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
import { createApp } from '@backstage/core-app-api';
|
||||
import { createSpecializedApp } from '@backstage/core-app-api';
|
||||
|
||||
const app = createApp();
|
||||
const app = createSpecializedApp();
|
||||
const apiRef = createApiRef();
|
||||
const button = <MyButton />
|
||||
`;
|
||||
|
||||
@@ -46,7 +46,6 @@ export function loadConfig(
|
||||
export type LoadConfigOptions = {
|
||||
configRoot: string;
|
||||
configTargets: ConfigTarget[];
|
||||
env?: string;
|
||||
experimentalEnvFunc?: (name: string) => Promise<string | undefined>;
|
||||
remote?: LoadConfigOptionsRemote;
|
||||
watch?: LoadConfigOptionsWatch;
|
||||
|
||||
@@ -119,7 +119,6 @@ describe('loadConfig', () => {
|
||||
loadConfig({
|
||||
configRoot: '/root',
|
||||
configTargets: [],
|
||||
env: 'production',
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
appConfigs: [
|
||||
@@ -146,7 +145,6 @@ describe('loadConfig', () => {
|
||||
loadConfig({
|
||||
configRoot: '/root',
|
||||
configTargets: [{ url: configUrl }],
|
||||
env: 'production',
|
||||
remote: {
|
||||
reloadIntervalSeconds: 30,
|
||||
},
|
||||
@@ -175,7 +173,6 @@ describe('loadConfig', () => {
|
||||
{ path: '/root/app-config.yaml' },
|
||||
{ path: '/root/app-config2.yaml' },
|
||||
],
|
||||
env: 'production',
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
appConfigs: [
|
||||
@@ -208,7 +205,6 @@ describe('loadConfig', () => {
|
||||
loadConfig({
|
||||
configRoot: '/root',
|
||||
configTargets: [{ path: '/root/app-config.yaml' }],
|
||||
env: 'production',
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
appConfigs: [
|
||||
@@ -234,7 +230,6 @@ describe('loadConfig', () => {
|
||||
{ path: '/root/app-config.yaml' },
|
||||
{ path: '/root/app-config.development.yaml' },
|
||||
],
|
||||
env: 'development',
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
appConfigs: [
|
||||
@@ -273,7 +268,6 @@ describe('loadConfig', () => {
|
||||
loadConfig({
|
||||
configRoot: '/root',
|
||||
configTargets: [{ path: '/root/app-config.substitute.yaml' }],
|
||||
env: 'development',
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
appConfigs: [
|
||||
|
||||
@@ -62,9 +62,6 @@ export type LoadConfigOptions = {
|
||||
// Paths to load config files from. Configs from earlier paths have lower priority.
|
||||
configTargets: ConfigTarget[];
|
||||
|
||||
/** @deprecated This option has been removed */
|
||||
env?: string;
|
||||
|
||||
/**
|
||||
* Custom environment variable loading function
|
||||
*
|
||||
|
||||
@@ -26,7 +26,6 @@ import { bitbucketAuthApiRef } from '@backstage/core-plugin-api';
|
||||
import { ComponentType } from 'react';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { createApp as createApp_2 } from '@backstage/app-defaults';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { ErrorApi } from '@backstage/core-plugin-api';
|
||||
import { ErrorApiError } from '@backstage/core-plugin-api';
|
||||
@@ -277,19 +276,6 @@ export type BackstageApp = {
|
||||
getRouter(): ComponentType<{}>;
|
||||
};
|
||||
|
||||
// @public @deprecated
|
||||
export type BackstagePluginWithAnyOutput = Omit<
|
||||
BackstagePlugin<any, any>,
|
||||
'output'
|
||||
> & {
|
||||
output(): (
|
||||
| PluginOutput
|
||||
| {
|
||||
type: string;
|
||||
}
|
||||
)[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export class BitbucketAuth {
|
||||
// (undocumented)
|
||||
@@ -315,11 +301,6 @@ export type BootErrorPageProps = {
|
||||
|
||||
export { ConfigReader };
|
||||
|
||||
// @public @deprecated
|
||||
export function createApp(
|
||||
options?: Parameters<typeof createApp_2>[0],
|
||||
): BackstageApp & AppContext;
|
||||
|
||||
// @public
|
||||
export function createFetchApi(options: {
|
||||
baseImplementation?: typeof fetch | undefined;
|
||||
@@ -408,10 +389,6 @@ export type FlatRoutesProps = {
|
||||
|
||||
// @public
|
||||
export class GithubAuth implements OAuthApi, SessionApi {
|
||||
// Warning: (ae-forgotten-export) The symbol "SessionManager" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @deprecated
|
||||
constructor(sessionManager: SessionManager<GithubSession>);
|
||||
// (undocumented)
|
||||
static create(options: OAuthApiCreateOptions): GithubAuth;
|
||||
// (undocumented)
|
||||
@@ -488,11 +465,6 @@ export class OAuth2
|
||||
BackstageIdentityApi,
|
||||
SessionApi
|
||||
{
|
||||
// @deprecated
|
||||
constructor(options: {
|
||||
sessionManager: SessionManager<OAuth2Session>;
|
||||
scopeTransform: (scopes: string[]) => string[];
|
||||
});
|
||||
// (undocumented)
|
||||
static create(options: OAuth2CreateOptions): OAuth2;
|
||||
// (undocumented)
|
||||
@@ -573,8 +545,6 @@ export type OneLoginAuthCreateOptions = {
|
||||
export class SamlAuth
|
||||
implements ProfileInfoApi, BackstageIdentityApi, SessionApi
|
||||
{
|
||||
// @deprecated
|
||||
constructor(sessionManager: SessionManager<SamlSession>);
|
||||
// (undocumented)
|
||||
static create(options: AuthApiCreateOptions): SamlAuth;
|
||||
// (undocumented)
|
||||
|
||||
@@ -118,10 +118,9 @@ export default class GithubAuth implements OAuthApi, SessionApi {
|
||||
return new GithubAuth(sessionManagerMux);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated will be made private in the future. Use create method instead.
|
||||
*/
|
||||
constructor(private readonly sessionManager: SessionManager<GithubSession>) {}
|
||||
private constructor(
|
||||
private readonly sessionManager: SessionManager<GithubSession>,
|
||||
) {}
|
||||
|
||||
async signIn() {
|
||||
await this.getAccessToken();
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
import OAuth2 from './OAuth2';
|
||||
import MockOAuthApi from '../../OAuthRequestApi/MockOAuthApi';
|
||||
import { UrlPatternDiscovery } from '../../DiscoveryApi';
|
||||
|
||||
const theFuture = new Date(Date.now() + 3600000);
|
||||
const thePast = new Date(Date.now() - 10);
|
||||
@@ -23,14 +25,24 @@ const PREFIX = 'https://www.googleapis.com/auth/';
|
||||
|
||||
const scopeTransform = (x: string[]) => x;
|
||||
|
||||
let getSession = jest.fn();
|
||||
|
||||
jest.mock('../../../../lib/AuthSessionManager', () => ({
|
||||
...(jest.requireActual('../../../../lib/AuthSessionManager') as any),
|
||||
RefreshingAuthSessionManager: class {
|
||||
getSession = getSession;
|
||||
},
|
||||
}));
|
||||
|
||||
describe('OAuth2', () => {
|
||||
it('should get refreshed access token', async () => {
|
||||
const getSession = jest.fn().mockResolvedValue({
|
||||
getSession = jest.fn().mockResolvedValue({
|
||||
providerInfo: { accessToken: 'access-token', expiresAt: theFuture },
|
||||
});
|
||||
const oauth2 = new OAuth2({
|
||||
sessionManager: { getSession } as any,
|
||||
scopeTransform,
|
||||
const oauth2 = OAuth2.create({
|
||||
scopeTransform: scopeTransform,
|
||||
oauthRequestApi: new MockOAuthApi(),
|
||||
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
|
||||
});
|
||||
|
||||
expect(await oauth2.getAccessToken('my-scope my-scope2')).toBe(
|
||||
@@ -43,12 +55,13 @@ describe('OAuth2', () => {
|
||||
});
|
||||
|
||||
it('should transform scopes', async () => {
|
||||
const getSession = jest.fn().mockResolvedValue({
|
||||
getSession = jest.fn().mockResolvedValue({
|
||||
providerInfo: { accessToken: 'access-token', expiresAt: theFuture },
|
||||
});
|
||||
const oauth2 = new OAuth2({
|
||||
sessionManager: { getSession } as any,
|
||||
const oauth2 = OAuth2.create({
|
||||
scopeTransform: scopes => scopes.map(scope => `my-prefix/${scope}`),
|
||||
oauthRequestApi: new MockOAuthApi(),
|
||||
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
|
||||
});
|
||||
|
||||
expect(await oauth2.getAccessToken('my-scope')).toBe('access-token');
|
||||
@@ -59,12 +72,13 @@ describe('OAuth2', () => {
|
||||
});
|
||||
|
||||
it('should get refreshed id token', async () => {
|
||||
const getSession = jest.fn().mockResolvedValue({
|
||||
getSession = jest.fn().mockResolvedValue({
|
||||
providerInfo: { idToken: 'id-token', expiresAt: theFuture },
|
||||
});
|
||||
const oauth2 = new OAuth2({
|
||||
sessionManager: { getSession } as any,
|
||||
scopeTransform,
|
||||
const oauth2 = OAuth2.create({
|
||||
scopeTransform: scopeTransform,
|
||||
oauthRequestApi: new MockOAuthApi(),
|
||||
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
|
||||
});
|
||||
|
||||
expect(await oauth2.getIdToken()).toBe('id-token');
|
||||
@@ -72,12 +86,13 @@ describe('OAuth2', () => {
|
||||
});
|
||||
|
||||
it('should get optional id token', async () => {
|
||||
const getSession = jest.fn().mockResolvedValue({
|
||||
getSession = jest.fn().mockResolvedValue({
|
||||
providerInfo: { idToken: 'id-token', expiresAt: theFuture },
|
||||
});
|
||||
const oauth2 = new OAuth2({
|
||||
sessionManager: { getSession } as any,
|
||||
scopeTransform,
|
||||
const oauth2 = OAuth2.create({
|
||||
scopeTransform: scopes => scopes.map(scope => `my-prefix/${scope}`),
|
||||
oauthRequestApi: new MockOAuthApi(),
|
||||
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
|
||||
});
|
||||
|
||||
expect(await oauth2.getIdToken({ optional: true })).toBe('id-token');
|
||||
@@ -87,7 +102,7 @@ describe('OAuth2', () => {
|
||||
it('should share popup closed errors', async () => {
|
||||
const error = new Error('NOPE');
|
||||
error.name = 'RejectedError';
|
||||
const getSession = jest
|
||||
getSession = jest
|
||||
.fn()
|
||||
.mockResolvedValueOnce({
|
||||
providerInfo: {
|
||||
@@ -97,9 +112,10 @@ describe('OAuth2', () => {
|
||||
},
|
||||
})
|
||||
.mockRejectedValue(error);
|
||||
const oauth2 = new OAuth2({
|
||||
sessionManager: { getSession } as any,
|
||||
scopeTransform,
|
||||
const oauth2 = OAuth2.create({
|
||||
scopeTransform: scopes => scopes.map(scope => `my-prefix/${scope}`),
|
||||
oauthRequestApi: new MockOAuthApi(),
|
||||
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
|
||||
});
|
||||
|
||||
// Make sure we have a session before we do the double request, so that we get past the !this.currentSession check
|
||||
@@ -120,7 +136,7 @@ describe('OAuth2', () => {
|
||||
scopes: new Set(),
|
||||
},
|
||||
};
|
||||
const getSession = jest
|
||||
getSession = jest
|
||||
.fn()
|
||||
.mockResolvedValueOnce(initialSession)
|
||||
.mockResolvedValue({
|
||||
@@ -130,9 +146,10 @@ describe('OAuth2', () => {
|
||||
scopes: new Set(),
|
||||
},
|
||||
});
|
||||
const oauth2 = new OAuth2({
|
||||
sessionManager: { getSession } as any,
|
||||
scopeTransform,
|
||||
const oauth2 = OAuth2.create({
|
||||
scopeTransform: scopes => scopes.map(scope => `my-prefix/${scope}`),
|
||||
oauthRequestApi: new MockOAuthApi(),
|
||||
discoveryApi: UrlPatternDiscovery.compile('http://example.com'),
|
||||
});
|
||||
|
||||
// Grab the expired session first
|
||||
|
||||
@@ -120,10 +120,7 @@ export default class OAuth2
|
||||
private readonly sessionManager: SessionManager<OAuth2Session>;
|
||||
private readonly scopeTransform: (scopes: string[]) => string[];
|
||||
|
||||
/**
|
||||
* @deprecated will be made private in the future. Use create method instead.
|
||||
*/
|
||||
constructor(options: {
|
||||
private constructor(options: {
|
||||
sessionManager: SessionManager<OAuth2Session>;
|
||||
scopeTransform: (scopes: string[]) => string[];
|
||||
}) {
|
||||
|
||||
@@ -81,10 +81,9 @@ export default class SamlAuth
|
||||
return this.sessionManager.sessionState$();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated will be made private in the future. Use create method instead.
|
||||
*/
|
||||
constructor(private readonly sessionManager: SessionManager<SamlSession>) {}
|
||||
private constructor(
|
||||
private readonly sessionManager: SessionManager<SamlSession>,
|
||||
) {}
|
||||
|
||||
async signIn() {
|
||||
await this.getBackstageIdentity({});
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
|
||||
import React, { useMemo, useEffect, useState, PropsWithChildren } from 'react';
|
||||
import { ThemeProvider } from '@material-ui/core/styles';
|
||||
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||
import { useApi, appThemeApiRef, AppTheme } from '@backstage/core-plugin-api';
|
||||
import { useObservable } from 'react-use';
|
||||
|
||||
@@ -90,20 +88,5 @@ export function AppThemeProvider({ children }: PropsWithChildren<{}>) {
|
||||
throw new Error('App has no themes');
|
||||
}
|
||||
|
||||
if (appTheme.Provider) {
|
||||
return <appTheme.Provider children={children} />;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
"DEPRECATION WARNING: A provided app theme is using the deprecated 'theme' property " +
|
||||
'and should be migrated to use a Provider instead. ' +
|
||||
'See https://backstage.io/docs/api/deprecations#app-theme for more info.',
|
||||
);
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={appTheme.theme}>
|
||||
<CssBaseline>{children}</CssBaseline>
|
||||
</ThemeProvider>
|
||||
);
|
||||
return <appTheme.Provider children={children} />;
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createApp as createDefaultApp } from '@backstage/app-defaults';
|
||||
import { AppContext, BackstageApp } from './types';
|
||||
|
||||
/**
|
||||
* Creates a new Backstage App.
|
||||
*
|
||||
* @deprecated Use {@link @backstage/app-defaults#createApp} from `@backstage/app-defaults` instead
|
||||
* @param options - A set of options for creating the app
|
||||
* @public
|
||||
*/
|
||||
export function createApp(
|
||||
options?: Parameters<typeof createDefaultApp>[0],
|
||||
): BackstageApp & AppContext {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'DEPRECATION WARNING: The createApp function from @backstage/core-app-api will soon be removed, ' +
|
||||
'migrate to importing createApp from the @backstage/app-defaults package instead. ' +
|
||||
'If you do not wish to use a standard app configuration but instead supply all options yourself ' +
|
||||
' you can use createSpecializedApp from @backstage/core-app-api instead.',
|
||||
);
|
||||
return createDefaultApp(options) as BackstageApp & AppContext;
|
||||
}
|
||||
@@ -23,6 +23,13 @@ import { AppOptions, BackstageApp } from './types';
|
||||
* @public
|
||||
* @param options - A set of options for creating the app
|
||||
* @returns
|
||||
* @remarks
|
||||
*
|
||||
* You will most likely want to use {@link @backstage/app-defaults#createApp},
|
||||
* however, this low-level API allows you to provide a full set of options,
|
||||
* including your own `components`, `icons`, `defaultApis`, and `themes`. This
|
||||
* is particularly useful if you are not using `@backstage/core-components` or
|
||||
* MUI, as it allows you to avoid those dependencies completely.
|
||||
*/
|
||||
export function createSpecializedApp(options: AppOptions): BackstageApp {
|
||||
return new AppManager(options);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { createApp } from './createApp';
|
||||
export { createSpecializedApp } from './createSpecializedApp';
|
||||
export { defaultConfigLoader } from './defaultConfigLoader';
|
||||
export * from './types';
|
||||
|
||||
@@ -189,7 +189,7 @@ type TargetRouteMap<
|
||||
|
||||
/**
|
||||
* A function that can bind from external routes of a given plugin, to concrete
|
||||
* routes of other plugins. See {@link createApp}.
|
||||
* routes of other plugins. See {@link createSpecializedApp}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
@@ -204,30 +204,7 @@ export type AppRouteBinder = <
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Internal helper type that represents a plugin with any type of output.
|
||||
*
|
||||
* @public
|
||||
* @remarks
|
||||
* @deprecated Will be removed
|
||||
*
|
||||
* The `type: string` type is there to handle output from newer or older plugin
|
||||
* API versions that might not be supported by this version of the app API, but
|
||||
* we don't want to break at the type checking level. We only use this more
|
||||
* permissive type for the `createApp` options, as we otherwise want to stick
|
||||
* to using the type for the outputs that we know about in this version of the
|
||||
* app api.
|
||||
*
|
||||
* TODO(freben): This should be marked internal but that's not supported by the api report generation tools yet
|
||||
*/
|
||||
export type BackstagePluginWithAnyOutput = Omit<
|
||||
BackstagePlugin<any, any>,
|
||||
'output'
|
||||
> & {
|
||||
output(): (PluginOutput | { type: string })[];
|
||||
};
|
||||
|
||||
/**
|
||||
* The options accepted by {@link createApp}.
|
||||
* The options accepted by {@link createSpecializedApp}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
@@ -329,7 +306,7 @@ export type AppOptions = {
|
||||
};
|
||||
|
||||
/**
|
||||
* The public API of the output of {@link createApp}.
|
||||
* The public API of the output of {@link createSpecializedApp}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
|
||||
@@ -6,24 +6,21 @@
|
||||
/// <reference types="react" />
|
||||
|
||||
import { BackstagePlugin as BackstagePlugin_2 } from '@backstage/core-plugin-api';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import { ComponentType } from 'react';
|
||||
import { Config } from '@backstage/config';
|
||||
import { IconComponent as IconComponent_2 } from '@backstage/core-plugin-api';
|
||||
import { IdentityApi as IdentityApi_2 } from '@backstage/core-plugin-api';
|
||||
import { Observable as Observable_2 } from '@backstage/types';
|
||||
import { Observer as Observer_2 } from '@backstage/types';
|
||||
import { Observable } from '@backstage/types';
|
||||
import { ProfileInfo as ProfileInfo_2 } from '@backstage/core-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
import { ReactElement } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { Subscription as Subscription_2 } from '@backstage/types';
|
||||
import { SvgIconProps } from '@material-ui/core';
|
||||
|
||||
// @public
|
||||
export type AlertApi = {
|
||||
post(alert: AlertMessage): void;
|
||||
alert$(): Observable_2<AlertMessage>;
|
||||
alert$(): Observable<AlertMessage>;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -141,7 +138,6 @@ export type ApiRef<T> = {
|
||||
// @public
|
||||
export type ApiRefConfig = {
|
||||
id: string;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -167,15 +163,14 @@ export type AppTheme = {
|
||||
id: string;
|
||||
title: string;
|
||||
variant: 'light' | 'dark';
|
||||
theme: BackstageTheme;
|
||||
icon?: React.ReactElement;
|
||||
Provider?(props: { children: ReactNode }): JSX.Element | null;
|
||||
Provider(props: { children: ReactNode }): JSX.Element | null;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type AppThemeApi = {
|
||||
getInstalledThemes(): AppTheme[];
|
||||
activeThemeId$(): Observable_2<string | undefined>;
|
||||
activeThemeId$(): Observable<string | undefined>;
|
||||
getActiveThemeId(): string | undefined;
|
||||
setActiveThemeId(themeId?: string): void;
|
||||
};
|
||||
@@ -362,11 +357,8 @@ export function createRouteRef<
|
||||
},
|
||||
ParamKey extends string = never,
|
||||
>(config: {
|
||||
id?: string;
|
||||
id: string;
|
||||
params?: ParamKey[];
|
||||
path?: string;
|
||||
icon?: OldIconComponent;
|
||||
title?: string;
|
||||
}): RouteRef<OptionalParams<Params>>;
|
||||
|
||||
// @public
|
||||
@@ -401,14 +393,10 @@ export interface ElementCollection {
|
||||
}): ElementCollection;
|
||||
}
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
type Error_2 = ErrorApiError;
|
||||
export { Error_2 as Error };
|
||||
|
||||
// @public
|
||||
export type ErrorApi = {
|
||||
post(error: ErrorApiError, context?: ErrorApiErrorContext): void;
|
||||
error$(): Observable_2<{
|
||||
error$(): Observable<{
|
||||
error: ErrorApiError;
|
||||
context?: ErrorApiErrorContext;
|
||||
}>;
|
||||
@@ -436,9 +424,6 @@ export type ErrorBoundaryFallbackProps = {
|
||||
resetError: () => void;
|
||||
};
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export type ErrorContext = ErrorApiErrorContext;
|
||||
|
||||
// @public
|
||||
export type Extension<T> = {
|
||||
expose(plugin: BackstagePlugin<any, any>): T;
|
||||
@@ -597,7 +582,7 @@ export type OAuthRequestApi = {
|
||||
createAuthRequester<OAuthResponse>(
|
||||
options: OAuthRequesterOptions<OAuthResponse>,
|
||||
): OAuthRequester<OAuthResponse>;
|
||||
authRequest$(): Observable_2<PendingOAuthRequest[]>;
|
||||
authRequest$(): Observable<PendingOAuthRequest[]>;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -619,12 +604,6 @@ export type OAuthRequesterOptions<TOAuthResponse> = {
|
||||
// @public
|
||||
export type OAuthScope = string | string[];
|
||||
|
||||
// @public @deprecated
|
||||
export type Observable<T> = Observable_2<T>;
|
||||
|
||||
// @public @deprecated
|
||||
export type Observer<T> = Observer_2<T>;
|
||||
|
||||
// @public @deprecated
|
||||
export const oidcAuthApiRef: ApiRef<
|
||||
OAuthApi &
|
||||
@@ -747,9 +726,6 @@ export type RouteFunc<Params extends AnyParams> = (
|
||||
export type RouteRef<Params extends AnyParams = any> = {
|
||||
$$routeRefType: 'absolute';
|
||||
params: ParamKeys<Params>;
|
||||
path: string;
|
||||
icon?: OldIconComponent;
|
||||
title?: string;
|
||||
};
|
||||
|
||||
// @public @deprecated
|
||||
@@ -761,7 +737,7 @@ export const samlAuthApiRef: ApiRef<
|
||||
export type SessionApi = {
|
||||
signIn(): Promise<void>;
|
||||
signOut(): Promise<void>;
|
||||
sessionState$(): Observable_2<SessionState>;
|
||||
sessionState$(): Observable<SessionState>;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -787,7 +763,7 @@ export type SignInResult = {
|
||||
export interface StorageApi {
|
||||
forBucket(name: string): StorageApi;
|
||||
get<T>(key: string): T | undefined;
|
||||
observe$<T>(key: string): Observable_2<StorageValueChange<T>>;
|
||||
observe$<T>(key: string): Observable<StorageValueChange<T>>;
|
||||
remove(key: string): Promise<void>;
|
||||
set(key: string, data: any): Promise<void>;
|
||||
}
|
||||
@@ -809,9 +785,6 @@ export type SubRouteRef<Params extends AnyParams = any> = {
|
||||
params: ParamKeys<Params>;
|
||||
};
|
||||
|
||||
// @public @deprecated
|
||||
export type Subscription = Subscription_2;
|
||||
|
||||
// @public
|
||||
export type TypesToApiRefs<T> = {
|
||||
[key in keyof T]: ApiRef<T[key]>;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { ReactNode } from 'react';
|
||||
import { ApiRef, createApiRef } from '../system';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import { Observable } from '@backstage/types';
|
||||
|
||||
/**
|
||||
@@ -40,18 +39,12 @@ export type AppTheme = {
|
||||
*/
|
||||
variant: 'light' | 'dark';
|
||||
|
||||
/**
|
||||
* The specialized MaterialUI theme instance.
|
||||
* @deprecated use Provider instead, see https://backstage.io/docs/api/deprecations#app-theme
|
||||
*/
|
||||
theme: BackstageTheme;
|
||||
|
||||
/**
|
||||
* An Icon for the theme mode setting.
|
||||
*/
|
||||
icon?: React.ReactElement;
|
||||
|
||||
Provider?(props: { children: ReactNode }): JSX.Element | null;
|
||||
Provider(props: { children: ReactNode }): JSX.Element | null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,12 +29,6 @@ export type ErrorApiError = {
|
||||
stack?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated Use ErrorApiError instead
|
||||
*/
|
||||
export type Error = ErrorApiError;
|
||||
|
||||
/**
|
||||
* Provides additional information about an error that was posted to the application.
|
||||
*
|
||||
@@ -53,12 +47,6 @@ export type ErrorApiErrorContext = {
|
||||
hidden?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated Use ErrorApiErrorContext instead
|
||||
*/
|
||||
export type ErrorContext = ErrorApiErrorContext;
|
||||
|
||||
/**
|
||||
* The error API is used to report errors to the app, and display them to the user.
|
||||
*
|
||||
|
||||
@@ -23,10 +23,6 @@ import type { ApiRef } from './types';
|
||||
*/
|
||||
export type ApiRefConfig = {
|
||||
id: string;
|
||||
/**
|
||||
* @deprecated Will be removed in the future
|
||||
*/
|
||||
description?: string;
|
||||
};
|
||||
|
||||
class ApiRefImpl<T> implements ApiRef<T> {
|
||||
@@ -46,12 +42,6 @@ class ApiRefImpl<T> implements ApiRef<T> {
|
||||
return this.config.id;
|
||||
}
|
||||
|
||||
get description() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Deprecated use of ApiRef.description');
|
||||
return this.config.description;
|
||||
}
|
||||
|
||||
// Utility for getting type of an api, using `typeof apiRef.T`
|
||||
get T(): T {
|
||||
throw new Error(`tried to read ApiRef.T of ${this}`);
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Observer as CoreObserver,
|
||||
Subscription as CoreSubscription,
|
||||
Observable as CoreObservable,
|
||||
} from '@backstage/types';
|
||||
|
||||
/**
|
||||
* Observer interface for consuming an Observer, see TC39.
|
||||
*
|
||||
* @public
|
||||
* @deprecated Please use the same type from `@backstage/types` instead
|
||||
*/
|
||||
export type Observer<T> = CoreObserver<T>;
|
||||
|
||||
/**
|
||||
* Subscription returned when subscribing to an Observable, see TC39.
|
||||
*
|
||||
* @public
|
||||
* @deprecated Please use the same type from `@backstage/types` instead
|
||||
*/
|
||||
export type Subscription = CoreSubscription;
|
||||
|
||||
/**
|
||||
* Observable sequence of values and errors, see TC39.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* {@link https://github.com/tc39/proposal-observable}
|
||||
* This is used as a common return type for observable values and can be created
|
||||
* using many different observable implementations, such as zen-observable or RxJS 5.
|
||||
*
|
||||
* @public
|
||||
* @deprecated Please use the same type from `@backstage/types` instead
|
||||
*/
|
||||
export type Observable<T> = CoreObservable<T>;
|
||||
@@ -27,4 +27,3 @@ export * from './extensions';
|
||||
export * from './icons';
|
||||
export * from './plugin';
|
||||
export * from './routing';
|
||||
export * from './deprecatedTypes';
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
ParamKeys,
|
||||
OptionalParams,
|
||||
} from './types';
|
||||
import { OldIconComponent } from '../icons/types';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -36,48 +35,10 @@ export class RouteRefImpl<Params extends AnyParams>
|
||||
constructor(
|
||||
private readonly id: string,
|
||||
readonly params: ParamKeys<Params>,
|
||||
private readonly config: {
|
||||
/** @deprecated */
|
||||
path?: string;
|
||||
/** @deprecated */
|
||||
icon?: OldIconComponent;
|
||||
/** @deprecated */
|
||||
title?: string;
|
||||
},
|
||||
) {
|
||||
if (config.path) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`DEPRECATION WARNING: Passing a path to createRouteRef is deprecated, please remove the path for ${this}.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (config.icon) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`DEPRECATION WARNING: Passing an icon to createRouteRef is deprecated, please remove the icon for ${this}.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (config.title) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`DEPRECATION WARNING: Passing a title to createRouteRef is deprecated, please remove the title for ${this}.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated use `useRouteRef` instead */
|
||||
get path() {
|
||||
return this.config.path ?? '';
|
||||
}
|
||||
|
||||
get icon() {
|
||||
return this.config.icon;
|
||||
}
|
||||
) {}
|
||||
|
||||
get title() {
|
||||
return this.config.title ?? this.id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
toString() {
|
||||
@@ -101,23 +62,12 @@ export function createRouteRef<
|
||||
ParamKey extends string = never,
|
||||
>(config: {
|
||||
/** The id of the route ref, used to identify it when printed */
|
||||
id?: string;
|
||||
id: string;
|
||||
/** A list of parameter names that the path that this route ref is bound to must contain */
|
||||
params?: ParamKey[];
|
||||
/** @deprecated Route refs no longer decide their own path */
|
||||
path?: string;
|
||||
/** @deprecated Route refs no longer decide their own icon */
|
||||
icon?: OldIconComponent;
|
||||
/** @deprecated Route refs no longer decide their own title */
|
||||
title?: string;
|
||||
}): RouteRef<OptionalParams<Params>> {
|
||||
const id = config.id || config.title;
|
||||
if (!id) {
|
||||
throw new Error('RouteRef must be provided a non-empty id');
|
||||
}
|
||||
return new RouteRefImpl(
|
||||
id,
|
||||
config.id,
|
||||
(config.params ?? []) as ParamKeys<OptionalParams<Params>>,
|
||||
config,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { OldIconComponent } from '../icons/types';
|
||||
import { getOrCreateGlobalSingleton } from '@backstage/version-bridge';
|
||||
|
||||
/**
|
||||
@@ -85,14 +84,6 @@ export type RouteRef<Params extends AnyParams = any> = {
|
||||
$$routeRefType: 'absolute'; // See routeRefType above
|
||||
|
||||
params: ParamKeys<Params>;
|
||||
|
||||
// TODO(Rugvip): Remove all of these once plugins don't rely on the path
|
||||
/** @deprecated paths are no longer accessed directly from RouteRefs, use useRouteRef instead */
|
||||
path: string;
|
||||
/** @deprecated icons are no longer accessed via RouteRefs */
|
||||
icon?: OldIconComponent;
|
||||
/** @deprecated titles are no longer accessed via RouteRefs */
|
||||
title?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import { AppThemeApi, appThemeApiRef } from '@backstage/core-plugin-api';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import ObservableImpl from 'zen-observable';
|
||||
@@ -41,13 +40,13 @@ describe('SidebarThemeSwitcher', () => {
|
||||
id: 'dark',
|
||||
title: 'Dark Theme',
|
||||
variant: 'dark',
|
||||
theme: {} as unknown as BackstageTheme,
|
||||
Provider: jest.fn(),
|
||||
},
|
||||
{
|
||||
id: 'light',
|
||||
title: 'Light Theme',
|
||||
variant: 'light',
|
||||
theme: {} as unknown as BackstageTheme,
|
||||
Provider: jest.fn(),
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -159,7 +159,7 @@ export class DevAppBuilder {
|
||||
* Build a DevApp component using the resources registered so far
|
||||
*/
|
||||
build(): ComponentType<{}> {
|
||||
const dummyRouteRef = createRouteRef({ title: 'Page of another plugin' });
|
||||
const dummyRouteRef = createRouteRef({ id: 'dummy' });
|
||||
const DummyPage = () => <Box p={3}>Page belonging to another plugin.</Box>;
|
||||
attachComponentData(DummyPage, 'core.mountPoint', dummyRouteRef);
|
||||
|
||||
|
||||
@@ -45,5 +45,4 @@ export class ScmIntegrationsApi {
|
||||
export const scmIntegrationsApiRef: ApiRef<ScmIntegrationRegistry> =
|
||||
createApiRef({
|
||||
id: 'integration.scmintegrations',
|
||||
description: 'All of the registered SCM integrations of your config',
|
||||
});
|
||||
|
||||
@@ -93,15 +93,6 @@ export type MockStorageBucket = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export const msw: {
|
||||
setupDefaultHandlers: (worker: {
|
||||
listen: (t: any) => void;
|
||||
close: () => void;
|
||||
resetHandlers: () => void;
|
||||
}) => void;
|
||||
};
|
||||
|
||||
// @public
|
||||
export function renderInTestApp(
|
||||
Component: ComponentType | ReactNode,
|
||||
|
||||
@@ -73,7 +73,6 @@ export function withLogCollector<T extends LogFuncs>(
|
||||
/**
|
||||
* Log collector that collect logs either from a sync or async collector.
|
||||
* @public
|
||||
* @deprecated import from test-utils instead
|
||||
* */
|
||||
export function withLogCollector(
|
||||
logsToCollect: LogFuncs[] | LogCollector,
|
||||
|
||||
@@ -14,20 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated use {@link setupRequestMockHandlers} instead which can be called directly with the worker.
|
||||
* @public
|
||||
*/
|
||||
export const msw = {
|
||||
setupDefaultHandlers: (worker: {
|
||||
listen: (t: any) => void;
|
||||
close: () => void;
|
||||
resetHandlers: () => void;
|
||||
}) => {
|
||||
setupRequestMockHandlers(worker);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets up handlers for request mocking
|
||||
* @public
|
||||
|
||||
Reference in New Issue
Block a user