From e56c95a9412f90ccbc7f575be3b694a12a09c3e9 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 13:39:17 -0500 Subject: [PATCH 01/25] release-2021-01-28 packages/config-loader/src/loader.ts:70 Remove reference to `env?: string;` and usages in `loader.test.ts` Signed-off-by: Colton Padden --- packages/config-loader/src/loader.test.ts | 6 ------ packages/config-loader/src/loader.ts | 3 --- 2 files changed, 9 deletions(-) diff --git a/packages/config-loader/src/loader.test.ts b/packages/config-loader/src/loader.test.ts index 97c3037244..9faeda64ea 100644 --- a/packages/config-loader/src/loader.test.ts +++ b/packages/config-loader/src/loader.test.ts @@ -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: [ diff --git a/packages/config-loader/src/loader.ts b/packages/config-loader/src/loader.ts index 906eb3917d..e16a49df89 100644 --- a/packages/config-loader/src/loader.ts +++ b/packages/config-loader/src/loader.ts @@ -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 * From 345dcea56085bd89d3f7b28ac042049e06a13ea1 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 14:03:55 -0500 Subject: [PATCH 02/25] release-2021-06-01 packages/core-plugin-api/src/apis/system/ApiRef.ts:27 Signed-off-by: Colton Padden --- packages/core-plugin-api/src/apis/system/ApiRef.ts | 10 ---------- .../integration-react/src/api/ScmIntegrationsApi.ts | 1 - plugins/apache-airflow/src/api/ApacheAirflowApi.ts | 1 - plugins/api-docs/src/config.ts | 1 - plugins/azure-devops/src/api/AzureDevOpsApi.ts | 2 -- plugins/badges/src/api/types.ts | 1 - plugins/bazaar/src/api.ts | 1 - plugins/bitrise/src/plugin.ts | 2 -- plugins/catalog-import/src/api/CatalogImportApi.ts | 1 - plugins/circleci/src/api/CircleCIApi.ts | 1 - plugins/cloudbuild/src/api/CloudbuildApi.ts | 1 - plugins/code-coverage/src/api.ts | 1 - plugins/cost-insights/src/api/CostInsightsApi.ts | 1 - plugins/explore-react/src/tools/api.ts | 1 - plugins/firehydrant/src/api/index.ts | 1 - plugins/fossa/src/api/FossaApi.ts | 1 - plugins/gcp-projects/src/api/GcpApi.ts | 1 - plugins/git-release-manager/src/api/serviceApiRef.ts | 1 - plugins/github-actions/src/api/GithubActionsApi.ts | 1 - plugins/github-deployments/src/api/index.ts | 1 - plugins/gitops-profiles/src/api.ts | 1 - plugins/ilert/src/api/client.ts | 1 - plugins/jenkins/src/api/JenkinsApi.ts | 1 - plugins/kafka/src/api/types.ts | 2 -- plugins/kubernetes/src/api/types.ts | 2 -- .../kubernetes/src/kubernetes-auth-provider/types.ts | 2 -- plugins/lighthouse/src/api.ts | 1 - plugins/newrelic/src/api/index.ts | 1 - plugins/pagerduty/src/api/client.ts | 1 - plugins/rollbar/src/api/RollbarApi.ts | 2 -- plugins/scaffolder/src/api.ts | 1 - plugins/search/src/apis.ts | 1 - plugins/sentry/src/api/sentry-api.ts | 1 - plugins/shortcuts/src/api/ShortcutApi.ts | 1 - plugins/sonarqube/src/api/SonarQubeApi.ts | 1 - plugins/splunk-on-call/src/api/client.ts | 1 - plugins/tech-insights/src/api/TechInsightsApi.ts | 1 - plugins/tech-radar/src/api.ts | 1 - plugins/techdocs/src/api.ts | 2 -- plugins/todo/src/api/types.ts | 1 - plugins/xcmetrics/src/api/types.ts | 1 - 41 files changed, 57 deletions(-) diff --git a/packages/core-plugin-api/src/apis/system/ApiRef.ts b/packages/core-plugin-api/src/apis/system/ApiRef.ts index 7e13a1963f..adedff9f73 100644 --- a/packages/core-plugin-api/src/apis/system/ApiRef.ts +++ b/packages/core-plugin-api/src/apis/system/ApiRef.ts @@ -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 implements ApiRef { @@ -46,12 +42,6 @@ class ApiRefImpl implements ApiRef { 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}`); diff --git a/packages/integration-react/src/api/ScmIntegrationsApi.ts b/packages/integration-react/src/api/ScmIntegrationsApi.ts index 06f28a6c4d..ec2185701b 100644 --- a/packages/integration-react/src/api/ScmIntegrationsApi.ts +++ b/packages/integration-react/src/api/ScmIntegrationsApi.ts @@ -45,5 +45,4 @@ export class ScmIntegrationsApi { export const scmIntegrationsApiRef: ApiRef = createApiRef({ id: 'integration.scmintegrations', - description: 'All of the registered SCM integrations of your config', }); diff --git a/plugins/apache-airflow/src/api/ApacheAirflowApi.ts b/plugins/apache-airflow/src/api/ApacheAirflowApi.ts index b0a0229df4..dde8c57802 100644 --- a/plugins/apache-airflow/src/api/ApacheAirflowApi.ts +++ b/plugins/apache-airflow/src/api/ApacheAirflowApi.ts @@ -19,7 +19,6 @@ import { Dag, InstanceStatus, InstanceVersion } from './types'; export const apacheAirflowApiRef = createApiRef({ id: 'plugin.apacheairflow.service', - description: 'Used by the Apache Airflow plugin to make requests', }); export type ApacheAirflowApi = { diff --git a/plugins/api-docs/src/config.ts b/plugins/api-docs/src/config.ts index e035bcfbd1..979340164b 100644 --- a/plugins/api-docs/src/config.ts +++ b/plugins/api-docs/src/config.ts @@ -20,7 +20,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const apiDocsConfigRef = createApiRef({ id: 'plugin.api-docs.config', - description: 'Used to configure api-docs widgets', }); export interface ApiDocsConfig { diff --git a/plugins/azure-devops/src/api/AzureDevOpsApi.ts b/plugins/azure-devops/src/api/AzureDevOpsApi.ts index 80d36f0adf..d6e926b9a5 100644 --- a/plugins/azure-devops/src/api/AzureDevOpsApi.ts +++ b/plugins/azure-devops/src/api/AzureDevOpsApi.ts @@ -27,8 +27,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const azureDevOpsApiRef = createApiRef({ id: 'plugin.azure-devops.service', - description: - 'Used by the Azure DevOps plugin to make requests to accompanying backend', }); export interface AzureDevOpsApi { diff --git a/plugins/badges/src/api/types.ts b/plugins/badges/src/api/types.ts index 499c144fca..884daa08ea 100644 --- a/plugins/badges/src/api/types.ts +++ b/plugins/badges/src/api/types.ts @@ -19,7 +19,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const badgesApiRef = createApiRef({ id: 'plugin.badges.client', - description: 'Used to make requests to the badges backend', }); export type BadgeStyle = diff --git a/plugins/bazaar/src/api.ts b/plugins/bazaar/src/api.ts index db20e5e0cb..3a770e6905 100644 --- a/plugins/bazaar/src/api.ts +++ b/plugins/bazaar/src/api.ts @@ -24,7 +24,6 @@ import { BazaarProject } from './types'; export const bazaarApiRef = createApiRef({ id: 'bazaar', - description: 'Used to make requests towards the bazaar backend', }); export interface BazaarApi { diff --git a/plugins/bitrise/src/plugin.ts b/plugins/bitrise/src/plugin.ts index a6f0706999..92beda287c 100644 --- a/plugins/bitrise/src/plugin.ts +++ b/plugins/bitrise/src/plugin.ts @@ -26,8 +26,6 @@ import { export const bitriseApiRef = createApiRef({ id: 'plugin.bitrise.service', - description: - 'Used by the BitriseCI plugin to retrieve information about builds.', }); export const bitrisePlugin = createPlugin({ diff --git a/plugins/catalog-import/src/api/CatalogImportApi.ts b/plugins/catalog-import/src/api/CatalogImportApi.ts index 89c27f1875..5fae076479 100644 --- a/plugins/catalog-import/src/api/CatalogImportApi.ts +++ b/plugins/catalog-import/src/api/CatalogImportApi.ts @@ -20,7 +20,6 @@ import { PartialEntity } from '../types'; export const catalogImportApiRef = createApiRef({ id: 'plugin.catalog-import.service', - description: 'Used by the catalog import plugin to make requests', }); // result of the analyze state diff --git a/plugins/circleci/src/api/CircleCIApi.ts b/plugins/circleci/src/api/CircleCIApi.ts index 498cbb588a..78b8b378d6 100644 --- a/plugins/circleci/src/api/CircleCIApi.ts +++ b/plugins/circleci/src/api/CircleCIApi.ts @@ -33,7 +33,6 @@ export type { BuildWithSteps, BuildStepAction, BuildSummary }; export const circleCIApiRef = createApiRef({ id: 'plugin.circleci.service', - description: 'Used by the CircleCI plugin to make requests', }); const DEFAULT_PROXY_PATH = '/circleci/api'; diff --git a/plugins/cloudbuild/src/api/CloudbuildApi.ts b/plugins/cloudbuild/src/api/CloudbuildApi.ts index 2b09d24e64..92ea8511fe 100644 --- a/plugins/cloudbuild/src/api/CloudbuildApi.ts +++ b/plugins/cloudbuild/src/api/CloudbuildApi.ts @@ -22,7 +22,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const cloudbuildApiRef = createApiRef({ id: 'plugin.cloudbuild.service', - description: 'Used by the Cloudbuild plugin to make requests', }); export type CloudbuildApi = { diff --git a/plugins/code-coverage/src/api.ts b/plugins/code-coverage/src/api.ts index a4a7bba37c..61f920106b 100644 --- a/plugins/code-coverage/src/api.ts +++ b/plugins/code-coverage/src/api.ts @@ -34,7 +34,6 @@ export type CodeCoverageApi = { export const codeCoverageApiRef = createApiRef({ id: 'plugin.code-coverage.service', - description: 'Used by the code coverage plugin to make requests', }); export class CodeCoverageRestApi implements CodeCoverageApi { diff --git a/plugins/cost-insights/src/api/CostInsightsApi.ts b/plugins/cost-insights/src/api/CostInsightsApi.ts index 40882ebd95..58c8592273 100644 --- a/plugins/cost-insights/src/api/CostInsightsApi.ts +++ b/plugins/cost-insights/src/api/CostInsightsApi.ts @@ -148,5 +148,4 @@ export type CostInsightsApi = { export const costInsightsApiRef = createApiRef({ id: 'plugin.costinsights.service', - description: 'Provides cost data and alerts for the cost-insights plugin', }); diff --git a/plugins/explore-react/src/tools/api.ts b/plugins/explore-react/src/tools/api.ts index 33b4b7b66c..8a91b84785 100644 --- a/plugins/explore-react/src/tools/api.ts +++ b/plugins/explore-react/src/tools/api.ts @@ -18,7 +18,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const exploreToolsConfigRef = createApiRef({ id: 'plugin.explore.toolsconfig', - description: 'Used to configure tools displayed in the explore plugin', }); export type ExploreTool = { diff --git a/plugins/firehydrant/src/api/index.ts b/plugins/firehydrant/src/api/index.ts index b78e81a024..7101b5dc62 100644 --- a/plugins/firehydrant/src/api/index.ts +++ b/plugins/firehydrant/src/api/index.ts @@ -39,7 +39,6 @@ export interface FireHydrantAPI { export const fireHydrantApiRef = createApiRef({ id: 'plugin.firehydrant.service', - description: 'Used by FireHydrant plugin for requests', }); export type Options = { diff --git a/plugins/fossa/src/api/FossaApi.ts b/plugins/fossa/src/api/FossaApi.ts index 918eab62a4..9a3932fea0 100644 --- a/plugins/fossa/src/api/FossaApi.ts +++ b/plugins/fossa/src/api/FossaApi.ts @@ -26,7 +26,6 @@ export interface FindingSummary { export const fossaApiRef = createApiRef({ id: 'plugin.fossa.service', - description: 'Used by the Fossa plugin to make requests', }); export type FossaApi = { diff --git a/plugins/gcp-projects/src/api/GcpApi.ts b/plugins/gcp-projects/src/api/GcpApi.ts index 5626796a05..9167d2983f 100644 --- a/plugins/gcp-projects/src/api/GcpApi.ts +++ b/plugins/gcp-projects/src/api/GcpApi.ts @@ -19,7 +19,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const gcpApiRef = createApiRef({ id: 'plugin.gcpprojects.service', - description: 'Used by the GCP Projects plugin to make requests', }); export type GcpApi = { diff --git a/plugins/git-release-manager/src/api/serviceApiRef.ts b/plugins/git-release-manager/src/api/serviceApiRef.ts index 75f0203e47..f2c695f455 100644 --- a/plugins/git-release-manager/src/api/serviceApiRef.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.ts @@ -20,5 +20,4 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const gitReleaseManagerApiRef = createApiRef({ id: 'plugin.git-release-manager.service', - description: 'Used by the Git Release Manager plugin to make requests', }); diff --git a/plugins/github-actions/src/api/GithubActionsApi.ts b/plugins/github-actions/src/api/GithubActionsApi.ts index e30145c4b3..fe516a0211 100644 --- a/plugins/github-actions/src/api/GithubActionsApi.ts +++ b/plugins/github-actions/src/api/GithubActionsApi.ts @@ -19,7 +19,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const githubActionsApiRef = createApiRef({ id: 'plugin.githubactions.service', - description: 'Used by the GitHub Actions plugin to make requests', }); export type GithubActionsApi = { diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index bec0167f63..b64d914612 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -91,7 +91,6 @@ export interface GithubDeploymentsApi { export const githubDeploymentsApiRef = createApiRef({ id: 'plugin.github-deployments.service', - description: 'Used by the GitHub Deployments plugin to make requests', }); export type Options = { diff --git a/plugins/gitops-profiles/src/api.ts b/plugins/gitops-profiles/src/api.ts index 86cfd805c9..ca141140d8 100644 --- a/plugins/gitops-profiles/src/api.ts +++ b/plugins/gitops-profiles/src/api.ts @@ -113,7 +113,6 @@ export type GitOpsApi = { export const gitOpsApiRef = createApiRef({ id: 'plugin.gitops.service', - description: 'Used by the GitOps profiles plugin to make requests', }); export class GitOpsRestApi implements GitOpsApi { diff --git a/plugins/ilert/src/api/client.ts b/plugins/ilert/src/api/client.ts index f05e58878f..13de8c1f2c 100644 --- a/plugins/ilert/src/api/client.ts +++ b/plugins/ilert/src/api/client.ts @@ -41,7 +41,6 @@ import { export const ilertApiRef = createApiRef({ id: 'plugin.ilert.service', - description: 'Used to make requests towards iLert API', }); const DEFAULT_PROXY_PATH = '/ilert'; diff --git a/plugins/jenkins/src/api/JenkinsApi.ts b/plugins/jenkins/src/api/JenkinsApi.ts index 4b23fb4292..c63d7a7f15 100644 --- a/plugins/jenkins/src/api/JenkinsApi.ts +++ b/plugins/jenkins/src/api/JenkinsApi.ts @@ -23,7 +23,6 @@ import { EntityName, EntityRef } from '@backstage/catalog-model'; export const jenkinsApiRef = createApiRef({ id: 'plugin.jenkins.service2', - description: 'Used by the Jenkins plugin to make requests', }); export interface Build { diff --git a/plugins/kafka/src/api/types.ts b/plugins/kafka/src/api/types.ts index 80a0866290..7804574761 100644 --- a/plugins/kafka/src/api/types.ts +++ b/plugins/kafka/src/api/types.ts @@ -18,8 +18,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const kafkaApiRef = createApiRef({ id: 'plugin.kafka.service', - description: - 'Used by the Kafka plugin to make requests to accompanying backend', }); export type ConsumerGroupOffsetsResponse = { diff --git a/plugins/kubernetes/src/api/types.ts b/plugins/kubernetes/src/api/types.ts index 5132c8794d..8b95dd820c 100644 --- a/plugins/kubernetes/src/api/types.ts +++ b/plugins/kubernetes/src/api/types.ts @@ -22,8 +22,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const kubernetesApiRef = createApiRef({ id: 'plugin.kubernetes.service', - description: - 'Used by the Kubernetes plugin to make requests to accompanying backend', }); export interface KubernetesApi { diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/types.ts b/plugins/kubernetes/src/kubernetes-auth-provider/types.ts index 3c5564e7cc..ffa0fd5961 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/types.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/types.ts @@ -26,8 +26,6 @@ export interface KubernetesAuthProvider { export const kubernetesAuthProvidersApiRef = createApiRef({ id: 'plugin.kubernetes-auth-providers.service', - description: - 'Used by the Kubernetes plugin to fetch KubernetesAuthProviders', }); export interface KubernetesAuthProvidersApi { diff --git a/plugins/lighthouse/src/api.ts b/plugins/lighthouse/src/api.ts index 7dbd48b960..b40b70356f 100644 --- a/plugins/lighthouse/src/api.ts +++ b/plugins/lighthouse/src/api.ts @@ -109,7 +109,6 @@ export type LighthouseApi = { export const lighthouseApiRef = createApiRef({ id: 'plugin.lighthouse.service', - description: 'Used by the Lighthouse plugin to make requests', }); export class LighthouseRestApi implements LighthouseApi { diff --git a/plugins/newrelic/src/api/index.ts b/plugins/newrelic/src/api/index.ts index 980a690d40..2734dd2b4f 100644 --- a/plugins/newrelic/src/api/index.ts +++ b/plugins/newrelic/src/api/index.ts @@ -55,7 +55,6 @@ export type NewRelicApplications = { export const newRelicApiRef = createApiRef({ id: 'plugin.newrelic.service', - description: 'Used by the NewRelic plugin to make requests', }); const DEFAULT_PROXY_PATH_BASE = '/newrelic'; diff --git a/plugins/pagerduty/src/api/client.ts b/plugins/pagerduty/src/api/client.ts index 65ff83e7ba..81d3792ecf 100644 --- a/plugins/pagerduty/src/api/client.ts +++ b/plugins/pagerduty/src/api/client.ts @@ -35,7 +35,6 @@ export class UnauthorizedError extends Error {} export const pagerDutyApiRef = createApiRef({ id: 'plugin.pagerduty.api', - description: 'Used to fetch data from PagerDuty API', }); export class PagerDutyClient implements PagerDutyApi { diff --git a/plugins/rollbar/src/api/RollbarApi.ts b/plugins/rollbar/src/api/RollbarApi.ts index 4c28630db6..3da52338ec 100644 --- a/plugins/rollbar/src/api/RollbarApi.ts +++ b/plugins/rollbar/src/api/RollbarApi.ts @@ -23,8 +23,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const rollbarApiRef = createApiRef({ id: 'plugin.rollbar.service', - description: - 'Used by the Rollbar plugin to make requests to accompanying backend', }); export interface RollbarApi { diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts index 34e16708ea..d7696fadde 100644 --- a/plugins/scaffolder/src/api.ts +++ b/plugins/scaffolder/src/api.ts @@ -30,7 +30,6 @@ import { ListActionsResponse, ScaffolderTask, Status } from './types'; export const scaffolderApiRef = createApiRef({ id: 'plugin.scaffolder.service', - description: 'Used to make requests towards the scaffolder backend', }); type TemplateParameterSchema = { diff --git a/plugins/search/src/apis.ts b/plugins/search/src/apis.ts index fa6d9ce908..4ce638fcca 100644 --- a/plugins/search/src/apis.ts +++ b/plugins/search/src/apis.ts @@ -25,7 +25,6 @@ import qs from 'qs'; export const searchApiRef = createApiRef({ id: 'plugin.search.queryservice', - description: 'Used to make requests against the search API', }); export interface SearchApi { diff --git a/plugins/sentry/src/api/sentry-api.ts b/plugins/sentry/src/api/sentry-api.ts index d2177cde2a..0c5b709508 100644 --- a/plugins/sentry/src/api/sentry-api.ts +++ b/plugins/sentry/src/api/sentry-api.ts @@ -19,7 +19,6 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const sentryApiRef = createApiRef({ id: 'plugin.sentry.service', - description: 'Used by the Sentry plugin to make requests', }); export interface SentryApi { diff --git a/plugins/shortcuts/src/api/ShortcutApi.ts b/plugins/shortcuts/src/api/ShortcutApi.ts index dcecc9945b..893a2fd74b 100644 --- a/plugins/shortcuts/src/api/ShortcutApi.ts +++ b/plugins/shortcuts/src/api/ShortcutApi.ts @@ -20,7 +20,6 @@ import { Observable } from '@backstage/types'; export const shortcutsApiRef = createApiRef({ id: 'plugin.shortcuts.api', - description: 'API to handle shortcuts in a Backstage Sidebar', }); export interface ShortcutApi { diff --git a/plugins/sonarqube/src/api/SonarQubeApi.ts b/plugins/sonarqube/src/api/SonarQubeApi.ts index 5bafd87ca8..3b39b30eb0 100644 --- a/plugins/sonarqube/src/api/SonarQubeApi.ts +++ b/plugins/sonarqube/src/api/SonarQubeApi.ts @@ -35,7 +35,6 @@ export interface FindingSummary { export const sonarQubeApiRef = createApiRef({ id: 'plugin.sonarqube.service', - description: 'Used by the SonarQube plugin to make requests', }); export type SonarQubeApi = { diff --git a/plugins/splunk-on-call/src/api/client.ts b/plugins/splunk-on-call/src/api/client.ts index a0256fcf07..437c6365ed 100644 --- a/plugins/splunk-on-call/src/api/client.ts +++ b/plugins/splunk-on-call/src/api/client.ts @@ -41,7 +41,6 @@ export class UnauthorizedError extends Error {} export const splunkOnCallApiRef = createApiRef({ id: 'plugin.splunk-on-call.api', - description: 'Used to fetch data from Splunk On-Call API', }); export class SplunkOnCallClient implements SplunkOnCallApi { diff --git a/plugins/tech-insights/src/api/TechInsightsApi.ts b/plugins/tech-insights/src/api/TechInsightsApi.ts index 2c55930f0a..d3ff9ac2ff 100644 --- a/plugins/tech-insights/src/api/TechInsightsApi.ts +++ b/plugins/tech-insights/src/api/TechInsightsApi.ts @@ -22,7 +22,6 @@ import { EntityName } from '@backstage/catalog-model'; export const techInsightsApiRef = createApiRef({ id: 'plugin.techinsights.service', - description: 'Used by the tech insights plugin to make requests', }); export interface TechInsightsApi { diff --git a/plugins/tech-radar/src/api.ts b/plugins/tech-radar/src/api.ts index db1be29f26..241f3dce85 100644 --- a/plugins/tech-radar/src/api.ts +++ b/plugins/tech-radar/src/api.ts @@ -21,7 +21,6 @@ import { ApiRef, createApiRef } from '@backstage/core-plugin-api'; export const techRadarApiRef: ApiRef = createApiRef( { id: 'plugin.techradar.service', - description: 'Used to populate data in the TechRadar plugin', }, ); diff --git a/plugins/techdocs/src/api.ts b/plugins/techdocs/src/api.ts index a23d9fc7f0..cd130f083d 100644 --- a/plugins/techdocs/src/api.ts +++ b/plugins/techdocs/src/api.ts @@ -20,12 +20,10 @@ import { createApiRef } from '@backstage/core-plugin-api'; export const techdocsStorageApiRef = createApiRef({ id: 'plugin.techdocs.storageservice', - description: 'Used to make requests towards the techdocs storage', }); export const techdocsApiRef = createApiRef({ id: 'plugin.techdocs.service', - description: 'Used to make requests towards techdocs API', }); export type SyncResult = 'cached' | 'updated'; diff --git a/plugins/todo/src/api/types.ts b/plugins/todo/src/api/types.ts index f1f647f6e3..51b846a30f 100644 --- a/plugins/todo/src/api/types.ts +++ b/plugins/todo/src/api/types.ts @@ -107,5 +107,4 @@ export interface TodoApi { */ export const todoApiRef = createApiRef({ id: 'plugin.todo.api', - description: 'Lists TODOs', }); diff --git a/plugins/xcmetrics/src/api/types.ts b/plugins/xcmetrics/src/api/types.ts index 6c7d133259..b4656e9478 100644 --- a/plugins/xcmetrics/src/api/types.ts +++ b/plugins/xcmetrics/src/api/types.ts @@ -193,5 +193,4 @@ export interface XcmetricsApi { export const xcmetricsApiRef = createApiRef({ id: 'plugin.xcmetrics.api', - description: 'Used by the XCMetrics plugin to make requests', }); From 864fd4f3e08fa8a75f9bb5c33325e5d6f451ebea Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 14:11:01 -0500 Subject: [PATCH 03/25] release-2021-06-01 packages/core-plugin-api/src/apis/system/ApiRef.ts:27 docs Signed-off-by: Colton Padden --- docs/tutorials/journey.md | 1 - docs/tutorials/using-backstage-proxy-within-plugin.md | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/tutorials/journey.md b/docs/tutorials/journey.md index 249507ddf0..126bb5ae0d 100644 --- a/docs/tutorials/journey.md +++ b/docs/tutorials/journey.md @@ -48,7 +48,6 @@ that implements the `OAuthApi` type, it's now working in the frontend too. ```ts const spotifyAuthApiRef = createApiRef({ id: 'core.auth.spotify', - description: 'Provides authentication towards Spotify APIs', }); ``` diff --git a/docs/tutorials/using-backstage-proxy-within-plugin.md b/docs/tutorials/using-backstage-proxy-within-plugin.md index b0c6bef8ef..771aa7a652 100644 --- a/docs/tutorials/using-backstage-proxy-within-plugin.md +++ b/docs/tutorials/using-backstage-proxy-within-plugin.md @@ -99,7 +99,6 @@ export interface MyAwesomeApi { export const myAwesomeApiRef = createApiRef({ id: 'plugin.my-awesome-api.service', - description: 'Example API definition', }); ``` From 46b84f79f83ded5c8f1b711195b5f416ef08e38a Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 14:27:41 -0500 Subject: [PATCH 04/25] release-2021-06-01 packages/core-plugin-api/src/routing/RouteRef.ts:118,120,122 Signed-off-by: Colton Padden --- .../core-plugin-api/src/routing/RouteRef.ts | 51 ++----------------- packages/core-plugin-api/src/routing/types.ts | 9 ---- packages/dev-utils/src/devApp/render.tsx | 2 +- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/packages/core-plugin-api/src/routing/RouteRef.ts b/packages/core-plugin-api/src/routing/RouteRef.ts index 37d79f3b83..abb05c54c5 100644 --- a/packages/core-plugin-api/src/routing/RouteRef.ts +++ b/packages/core-plugin-api/src/routing/RouteRef.ts @@ -36,48 +36,10 @@ export class RouteRefImpl constructor( private readonly id: string, readonly params: ParamKeys, - 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() { @@ -104,20 +66,13 @@ export function createRouteRef< 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> { - const id = config.id || config.title; + const id = config.id; if (!id) { throw new Error('RouteRef must be provided a non-empty id'); } return new RouteRefImpl( id, (config.params ?? []) as ParamKeys>, - config, ); } diff --git a/packages/core-plugin-api/src/routing/types.ts b/packages/core-plugin-api/src/routing/types.ts index 6232810e56..80653518bb 100644 --- a/packages/core-plugin-api/src/routing/types.ts +++ b/packages/core-plugin-api/src/routing/types.ts @@ -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 = { $$routeRefType: 'absolute'; // See routeRefType above params: ParamKeys; - - // 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; }; /** diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx index adea9e14f2..36d6abcfd1 100644 --- a/packages/dev-utils/src/devApp/render.tsx +++ b/packages/dev-utils/src/devApp/render.tsx @@ -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 = () => Page belonging to another plugin.; attachComponentData(DummyPage, 'core.mountPoint', dummyRouteRef); From 19e336ed09b43302e7ff9f2ccc949f445a2312f4 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 14:32:46 -0500 Subject: [PATCH 05/25] release-2021-06-01 packages/core-plugin-api/src/routing/RouteRef.ts:118,120,122 docs Signed-off-by: Colton Padden --- docs/plugins/composability.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/composability.md b/docs/plugins/composability.md index 33568ac561..05af512f92 100644 --- a/docs/plugins/composability.md +++ b/docs/plugins/composability.md @@ -368,7 +368,7 @@ The following is an example of creation and usage of a parameterized route: ```tsx // Creation of a parameterized route const myRouteRef = createRouteRef({ - title: 'My Named Route', + id: 'myroute', params: ['name'] }) From eba9d2415f32e1f74e598479adf8de9d055ac562 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 15:01:20 -0500 Subject: [PATCH 06/25] release-2021-10-28 packages/core-plugin-api/src/deprecatedTypes.ts:27,35,49 Signed-off-by: Colton Padden --- .../core-plugin-api/src/deprecatedTypes.ts | 51 ------------------- packages/core-plugin-api/src/index.ts | 1 - 2 files changed, 52 deletions(-) delete mode 100644 packages/core-plugin-api/src/deprecatedTypes.ts diff --git a/packages/core-plugin-api/src/deprecatedTypes.ts b/packages/core-plugin-api/src/deprecatedTypes.ts deleted file mode 100644 index 5596ff9f46..0000000000 --- a/packages/core-plugin-api/src/deprecatedTypes.ts +++ /dev/null @@ -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 = CoreObserver; - -/** - * 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 = CoreObservable; diff --git a/packages/core-plugin-api/src/index.ts b/packages/core-plugin-api/src/index.ts index 7a4f2e72ba..30fc35b62a 100644 --- a/packages/core-plugin-api/src/index.ts +++ b/packages/core-plugin-api/src/index.ts @@ -27,4 +27,3 @@ export * from './extensions'; export * from './icons'; export * from './plugin'; export * from './routing'; -export * from './deprecatedTypes'; From 24d466c373017010b60a8a27fa3f7654c9ec9866 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 15:05:38 -0500 Subject: [PATCH 07/25] release-2021-10-28 packages/test-utils/src/testUtils/msw/index.ts:18 Signed-off-by: Colton Padden --- packages/test-utils/src/testUtils/msw/index.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/test-utils/src/testUtils/msw/index.ts b/packages/test-utils/src/testUtils/msw/index.ts index 40bc47e8f0..625ef0e0fc 100644 --- a/packages/test-utils/src/testUtils/msw/index.ts +++ b/packages/test-utils/src/testUtils/msw/index.ts @@ -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 From ead7c922faeed9877d31a2668113e255b63f1b8f Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 17:56:32 -0500 Subject: [PATCH 08/25] build api-reports with removed deprecations Signed-off-by: Colton Padden --- packages/config-loader/api-report.md | 1 - packages/core-plugin-api/api-report.md | 32 ++++++-------------------- packages/test-utils/api-report.md | 9 -------- 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/packages/config-loader/api-report.md b/packages/config-loader/api-report.md index 76c6468556..269159aab4 100644 --- a/packages/config-loader/api-report.md +++ b/packages/config-loader/api-report.md @@ -46,7 +46,6 @@ export function loadConfig( export type LoadConfigOptions = { configRoot: string; configTargets: ConfigTarget[]; - env?: string; experimentalEnvFunc?: (name: string) => Promise; remote?: LoadConfigOptionsRemote; watch?: LoadConfigOptionsWatch; diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index 0cf97a4c13..ee7a0764b1 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -11,19 +11,17 @@ 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; + alert$(): Observable; }; // @public @@ -141,7 +139,6 @@ export type ApiRef = { // @public export type ApiRefConfig = { id: string; - description?: string; }; // @public @@ -175,7 +172,7 @@ export type AppTheme = { // @public export type AppThemeApi = { getInstalledThemes(): AppTheme[]; - activeThemeId$(): Observable_2; + activeThemeId$(): Observable; getActiveThemeId(): string | undefined; setActiveThemeId(themeId?: string): void; }; @@ -364,9 +361,6 @@ export function createRouteRef< >(config: { id?: string; params?: ParamKey[]; - path?: string; - icon?: OldIconComponent; - title?: string; }): RouteRef>; // @public @@ -408,7 +402,7 @@ export { Error_2 as Error }; // @public export type ErrorApi = { post(error: ErrorApiError, context?: ErrorApiErrorContext): void; - error$(): Observable_2<{ + error$(): Observable<{ error: ErrorApiError; context?: ErrorApiErrorContext; }>; @@ -597,7 +591,7 @@ export type OAuthRequestApi = { createAuthRequester( options: OAuthRequesterOptions, ): OAuthRequester; - authRequest$(): Observable_2; + authRequest$(): Observable; }; // @public @@ -619,12 +613,6 @@ export type OAuthRequesterOptions = { // @public export type OAuthScope = string | string[]; -// @public @deprecated -export type Observable = Observable_2; - -// @public @deprecated -export type Observer = Observer_2; - // @public @deprecated export const oidcAuthApiRef: ApiRef< OAuthApi & @@ -747,9 +735,6 @@ export type RouteFunc = ( export type RouteRef = { $$routeRefType: 'absolute'; params: ParamKeys; - path: string; - icon?: OldIconComponent; - title?: string; }; // @public @deprecated @@ -761,7 +746,7 @@ export const samlAuthApiRef: ApiRef< export type SessionApi = { signIn(): Promise; signOut(): Promise; - sessionState$(): Observable_2; + sessionState$(): Observable; }; // @public @@ -787,7 +772,7 @@ export type SignInResult = { export interface StorageApi { forBucket(name: string): StorageApi; get(key: string): T | undefined; - observe$(key: string): Observable_2>; + observe$(key: string): Observable>; remove(key: string): Promise; set(key: string, data: any): Promise; } @@ -809,9 +794,6 @@ export type SubRouteRef = { params: ParamKeys; }; -// @public @deprecated -export type Subscription = Subscription_2; - // @public export type TypesToApiRefs = { [key in keyof T]: ApiRef; diff --git a/packages/test-utils/api-report.md b/packages/test-utils/api-report.md index 295cf3a8c3..24f17e0b84 100644 --- a/packages/test-utils/api-report.md +++ b/packages/test-utils/api-report.md @@ -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, From c90d26133f439c6fa0c5be414038a2f4f6b462c3 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 18:31:42 -0500 Subject: [PATCH 09/25] remove API ref description from serviceApiRef.test.ts Signed-off-by: Colton Padden --- plugins/git-release-manager/src/api/serviceApiRef.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/git-release-manager/src/api/serviceApiRef.test.ts b/plugins/git-release-manager/src/api/serviceApiRef.test.ts index 03a6bbae02..b27738671d 100644 --- a/plugins/git-release-manager/src/api/serviceApiRef.test.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.test.ts @@ -23,7 +23,6 @@ describe('gitReleaseManagerApiRef', () => { expect(result).toMatchInlineSnapshot(` ApiRefImpl { "config": Object { - "description": "Used by the Git Release Manager plugin to make requests", "id": "plugin.git-release-manager.service", }, } From f6722d245848c06bd9c8466d1864c63389a1bd10 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 19:48:53 -0500 Subject: [PATCH 10/25] add changesets for core-plugin-api, test-utils, and config-loader Signed-off-by: Colton Padden --- .changeset/many-trees-happen.md | 5 +++++ .changeset/nice-apricots-grow.md | 7 +++++++ .changeset/olive-cameras-rush.md | 5 +++++ 3 files changed, 17 insertions(+) create mode 100644 .changeset/many-trees-happen.md create mode 100644 .changeset/nice-apricots-grow.md create mode 100644 .changeset/olive-cameras-rush.md diff --git a/.changeset/many-trees-happen.md b/.changeset/many-trees-happen.md new file mode 100644 index 0000000000..0893eab4a2 --- /dev/null +++ b/.changeset/many-trees-happen.md @@ -0,0 +1,5 @@ +--- +'@backstage/config-loader': patch +--- + +Removed deprecated option `env` from `LoadConfigOptions` and associated tests diff --git a/.changeset/nice-apricots-grow.md b/.changeset/nice-apricots-grow.md new file mode 100644 index 0000000000..ed16036d74 --- /dev/null +++ b/.changeset/nice-apricots-grow.md @@ -0,0 +1,7 @@ +--- +'@backstage/core-plugin-api': patch +--- + +- Removed deprecated option `description` from `ApiRefConfig` +- Removed descriptions from all plugin API refs +- Removed deprecated parameters `path`, `icon`, and `title` in `createRouteRef` diff --git a/.changeset/olive-cameras-rush.md b/.changeset/olive-cameras-rush.md new file mode 100644 index 0000000000..fe1f38befb --- /dev/null +++ b/.changeset/olive-cameras-rush.md @@ -0,0 +1,5 @@ +--- +'@backstage/test-utils': patch +--- + +Removed deprecated `msw` definition which was replaced by calling `setupRequestMockHandlers` directly From c24bae00855e57bd56ba95d79f8428090da28fbb Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 08:57:02 -0500 Subject: [PATCH 11/25] release-2021-11-18 packages/core-plugin-api/src/apis/definitions/ErrorApi.ts:34,50 Signed-off-by: Colton Padden --- .changeset/nice-apricots-grow.md | 1 + packages/core-plugin-api/api-report.md | 7 ------- .../core-plugin-api/src/apis/definitions/ErrorApi.ts | 12 ------------ 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/.changeset/nice-apricots-grow.md b/.changeset/nice-apricots-grow.md index ed16036d74..3e2f890717 100644 --- a/.changeset/nice-apricots-grow.md +++ b/.changeset/nice-apricots-grow.md @@ -5,3 +5,4 @@ - Removed deprecated option `description` from `ApiRefConfig` - Removed descriptions from all plugin API refs - Removed deprecated parameters `path`, `icon`, and `title` in `createRouteRef` +- Removed deprecated types `Error` and `ErrorContext` from `ErrorApi` diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index ee7a0764b1..709e56c22d 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -395,10 +395,6 @@ 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; @@ -430,9 +426,6 @@ export type ErrorBoundaryFallbackProps = { resetError: () => void; }; -// @public @deprecated (undocumented) -export type ErrorContext = ErrorApiErrorContext; - // @public export type Extension = { expose(plugin: BackstagePlugin): T; diff --git a/packages/core-plugin-api/src/apis/definitions/ErrorApi.ts b/packages/core-plugin-api/src/apis/definitions/ErrorApi.ts index 364a7bd29a..9c73d94cac 100644 --- a/packages/core-plugin-api/src/apis/definitions/ErrorApi.ts +++ b/packages/core-plugin-api/src/apis/definitions/ErrorApi.ts @@ -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. * From 5d6684f0df0516cdc0ec315cfdfd78db4bbf7fd7 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 09:18:17 -0500 Subject: [PATCH 12/25] release-2021-11-18 packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts:45 Signed-off-by: Colton Padden --- packages/app-defaults/src/defaults/themes.tsx | 2 -- .../core-app-api/src/app/AppThemeProvider.tsx | 19 +++---------------- packages/core-plugin-api/api-report.md | 2 -- .../src/apis/definitions/AppThemeApi.ts | 7 ------- .../src/devApp/SidebarThemeSwitcher.test.tsx | 3 --- .../General/UserSettingsThemeToggle.test.tsx | 8 +++++++- 6 files changed, 10 insertions(+), 31 deletions(-) diff --git a/packages/app-defaults/src/defaults/themes.tsx b/packages/app-defaults/src/defaults/themes.tsx index 90a4a0f47f..397c160168 100644 --- a/packages/app-defaults/src/defaults/themes.tsx +++ b/packages/app-defaults/src/defaults/themes.tsx @@ -28,7 +28,6 @@ export const themes: AppTheme[] = [ title: 'Light Theme', variant: 'light', icon: , - theme: lightTheme, Provider: ({ children }) => ( {children} @@ -40,7 +39,6 @@ export const themes: AppTheme[] = [ title: 'Dark Theme', variant: 'dark', icon: , - theme: darkTheme, Provider: ({ children }) => ( {children} diff --git a/packages/core-app-api/src/app/AppThemeProvider.tsx b/packages/core-app-api/src/app/AppThemeProvider.tsx index 2e145025d5..797e2bce87 100644 --- a/packages/core-app-api/src/app/AppThemeProvider.tsx +++ b/packages/core-app-api/src/app/AppThemeProvider.tsx @@ -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,9 @@ export function AppThemeProvider({ children }: PropsWithChildren<{}>) { throw new Error('App has no themes'); } - if (appTheme.Provider) { - return ; + if (!appTheme.Provider) { + throw new Error('App has no theme provider'); } - // 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 ( - - {children} - - ); + return ; } diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index 709e56c22d..b31722f29d 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -6,7 +6,6 @@ /// 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'; @@ -164,7 +163,6 @@ export type AppTheme = { id: string; title: string; variant: 'light' | 'dark'; - theme: BackstageTheme; icon?: React.ReactElement; Provider?(props: { children: ReactNode }): JSX.Element | null; }; diff --git a/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts b/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts index 8053c449a1..7f8aed9573 100644 --- a/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts +++ b/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts @@ -16,7 +16,6 @@ import { ReactNode } from 'react'; import { ApiRef, createApiRef } from '../system'; -import { BackstageTheme } from '@backstage/theme'; import { Observable } from '@backstage/types'; /** @@ -40,12 +39,6 @@ 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. */ diff --git a/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx b/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx index 43eaa6218c..bc44b69dbb 100644 --- a/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx +++ b/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx @@ -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,11 @@ describe('SidebarThemeSwitcher', () => { id: 'dark', title: 'Dark Theme', variant: 'dark', - theme: {} as unknown as BackstageTheme, }, { id: 'light', title: 'Light Theme', variant: 'light', - theme: {} as unknown as BackstageTheme, }, ]); }); diff --git a/plugins/user-settings/src/components/General/UserSettingsThemeToggle.test.tsx b/plugins/user-settings/src/components/General/UserSettingsThemeToggle.test.tsx index 83d9e23f83..09b27cb559 100644 --- a/plugins/user-settings/src/components/General/UserSettingsThemeToggle.test.tsx +++ b/plugins/user-settings/src/components/General/UserSettingsThemeToggle.test.tsx @@ -21,6 +21,8 @@ import { wrapInTestApp, } from '@backstage/test-utils'; import { lightTheme } from '@backstage/theme'; +import { ThemeProvider } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; import { fireEvent } from '@testing-library/react'; import React from 'react'; import { UserSettingsThemeToggle } from './UserSettingsThemeToggle'; @@ -30,7 +32,11 @@ const mockTheme: AppTheme = { id: 'light-theme', title: 'Mock Theme', variant: 'light', - theme: lightTheme, + Provider: ({ children }) => ( + + {children} + + ), }; const apiRegistry = TestApiRegistry.from([ From b3605da81ce0ec8dbcc7a03b41192cf7bcf6c207 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 10:11:32 -0500 Subject: [PATCH 13/25] release-2021-11-18 packages/core-app-api/src/app/createApp.tsx:23,32 Signed-off-by: Colton Padden --- .changeset/new-waves-rule.md | 5 +++ packages/core-app-api/api-report.md | 12 +++---- packages/core-app-api/src/app/createApp.tsx | 38 --------------------- packages/core-app-api/src/app/index.ts | 1 - 4 files changed, 11 insertions(+), 45 deletions(-) create mode 100644 .changeset/new-waves-rule.md delete mode 100644 packages/core-app-api/src/app/createApp.tsx diff --git a/.changeset/new-waves-rule.md b/.changeset/new-waves-rule.md new file mode 100644 index 0000000000..abea57d81b --- /dev/null +++ b/.changeset/new-waves-rule.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-app-api': patch +--- + +Remove deprecated `@backstage/core-app-api@createApp` which has been replaced by `@backstage/app-defaults#createApp` diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index 78bfd83251..e963f64465 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -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'; @@ -201,6 +200,8 @@ export type AppIcons = { warning: IconComponent; }; +// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-app-api" does not have an export "createApp" +// // @public export type AppOptions = { apis?: Iterable; @@ -222,6 +223,8 @@ export type AppOptions = { bindRoutes?(context: { bind: AppRouteBinder }): void; }; +// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-app-api" does not have an export "createApp" +// // @public export type AppRouteBinder = < ExternalRoutes extends { @@ -269,6 +272,8 @@ export type AuthApiCreateOptions = { provider?: AuthProviderInfo; }; +// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-app-api" does not have an export "createApp" +// // @public export type BackstageApp = { getPlugins(): BackstagePlugin[]; @@ -315,11 +320,6 @@ export type BootErrorPageProps = { export { ConfigReader }; -// @public @deprecated -export function createApp( - options?: Parameters[0], -): BackstageApp & AppContext; - // @public export function createFetchApi(options: { baseImplementation?: typeof fetch | undefined; diff --git a/packages/core-app-api/src/app/createApp.tsx b/packages/core-app-api/src/app/createApp.tsx deleted file mode 100644 index b2a21634d3..0000000000 --- a/packages/core-app-api/src/app/createApp.tsx +++ /dev/null @@ -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[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; -} diff --git a/packages/core-app-api/src/app/index.ts b/packages/core-app-api/src/app/index.ts index 5ea5405632..7843b36339 100644 --- a/packages/core-app-api/src/app/index.ts +++ b/packages/core-app-api/src/app/index.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -export { createApp } from './createApp'; export { createSpecializedApp } from './createSpecializedApp'; export { defaultConfigLoader } from './defaultConfigLoader'; export * from './types'; From 68f8b10ccd505539e60c94c52fc5be781da071f5 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 10:12:31 -0500 Subject: [PATCH 14/25] include changeset for `theme` removal of `AppTheme` Signed-off-by: Colton Padden --- .changeset/short-rockets-remain.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/short-rockets-remain.md diff --git a/.changeset/short-rockets-remain.md b/.changeset/short-rockets-remain.md new file mode 100644 index 0000000000..25d8eda84f --- /dev/null +++ b/.changeset/short-rockets-remain.md @@ -0,0 +1,9 @@ +--- +'@backstage/app-defaults': patch +'@backstage/core-app-api': patch +'@backstage/core-plugin-api': patch +--- + +- Remove deprecation configuration option `theme` from `AppTheme` of the `AppThemeApi` +- Removed reference to `theme` in the `app-defaults` default `AppTheme` +- Removed logic in `AppThemeProvider` that creates `ThemeProvider` from `appTheme.theme` From 17de72e406ec73b19e35f5a00ef24ce741e9729f Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 12:42:07 -0500 Subject: [PATCH 15/25] update docs reference from @backstage/core-app-api#createApp to backstage/app-defaults#createApp Signed-off-by: Colton Padden --- docs/api/utility-apis.md | 8 ++++---- docs/getting-started/app-custom-theme.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api/utility-apis.md b/docs/api/utility-apis.md index 14920513af..9ebcfc0945 100644 --- a/docs/api/utility-apis.md +++ b/docs/api/utility-apis.md @@ -128,8 +128,8 @@ the core APIs. The core APIs are the ones exported by [configApiRef](../reference/core-plugin-api.configapiref.md). The core APIs are loaded for any app created with -[createApp](../reference/core-app-api.createapp.md) from -[@backstage/core-plugin-api](../reference/core-plugin-api.md), which means that +[createApp](../reference/app-defaults.createapp.md) from +[@backstage/core-plugin-api](../reference/app-defaults.md), which means that there is no step that needs to be taken to include these APIs in an app. ### Plugin APIs @@ -168,7 +168,7 @@ Lastly, the app itself is the final point where APIs can be added, and what has the final say in what APIs will be loaded at runtime. The app may override the factories for any of the core or plugin APIs, with the exception of the config, app theme, and identity APIs. These are static APIs that are tied into the -[createApp](../reference/core-app-api.createapp.md) implementation, and +[createApp](../reference/app-defaults.createapp.md) implementation, and therefore not possible to override. Overriding APIs is useful for apps that want to switch out behavior to tailor it @@ -313,7 +313,7 @@ The common development environment for plugins is included in [createDevApp](../reference/dev-utils.createdevapp.md) function creates an application with implementations for all core APIs already present. Contrary to the method for wiring up Utility API implementations in an app created with -[createApp](../reference/core-app-api.createapp.md), +[createApp](../reference/app-defaults.createapp.md), [createDevApp](../reference/dev-utils.createdevapp.md) uses automatic dependency injection. This is to make it possible to replace any API implementation, and having that be reflected in dependents of that API. diff --git a/docs/getting-started/app-custom-theme.md b/docs/getting-started/app-custom-theme.md index 241ae7ef03..a4ca0771df 100644 --- a/docs/getting-started/app-custom-theme.md +++ b/docs/getting-started/app-custom-theme.md @@ -54,7 +54,7 @@ For example, adding the theme that we created in the previous section can be done like this: ```ts -import { createApp } from '@backstage/core-app-api'; +import { createApp } from '@backstage/app-defaults'; const app = createApp({ apis: ..., From 0cad4e741f14308df256699915b26e6f51897029 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 12:50:10 -0500 Subject: [PATCH 16/25] release-2021-11-18 packages/core-app-api/src/app/types.ts:209 Signed-off-by: Colton Padden --- .changeset/new-waves-rule.md | 3 ++- packages/core-app-api/api-report.md | 13 ------------- packages/core-app-api/src/app/types.ts | 23 ----------------------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/.changeset/new-waves-rule.md b/.changeset/new-waves-rule.md index abea57d81b..108e80274d 100644 --- a/.changeset/new-waves-rule.md +++ b/.changeset/new-waves-rule.md @@ -2,4 +2,5 @@ '@backstage/core-app-api': patch --- -Remove deprecated `@backstage/core-app-api@createApp` which has been replaced by `@backstage/app-defaults#createApp` +- Remove deprecated `@backstage/core-app-api@createApp` which has been replaced by `@backstage/app-defaults#createApp` +- Remove deprecated type `BackstagePluginWithAnyOutput` diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index e963f64465..55f87ec1eb 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -282,19 +282,6 @@ export type BackstageApp = { getRouter(): ComponentType<{}>; }; -// @public @deprecated -export type BackstagePluginWithAnyOutput = Omit< - BackstagePlugin, - 'output' -> & { - output(): ( - | PluginOutput - | { - type: string; - } - )[]; -}; - // @public export class BitbucketAuth { // (undocumented) diff --git a/packages/core-app-api/src/app/types.ts b/packages/core-app-api/src/app/types.ts index a538ccd366..4b20aeff7e 100644 --- a/packages/core-app-api/src/app/types.ts +++ b/packages/core-app-api/src/app/types.ts @@ -203,29 +203,6 @@ 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, - 'output' -> & { - output(): (PluginOutput | { type: string })[]; -}; - /** * The options accepted by {@link createApp}. * From cdf2c76a399e0bb86ca1e1f951db6e53b1159d1c Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 13:52:11 -0500 Subject: [PATCH 17/25] release-2021-11-18 packages/core-app-api/src/apis/implementations/auth/* Signed-off-by: Colton Padden --- .changeset/new-waves-rule.md | 1 + packages/core-app-api/api-report.md | 11 ---- .../implementations/auth/github/GithubAuth.ts | 7 +-- .../auth/oauth2/OAuth2.test.ts | 63 ++++++++++++------- .../implementations/auth/oauth2/OAuth2.ts | 5 +- .../implementations/auth/saml/SamlAuth.ts | 7 +-- 6 files changed, 48 insertions(+), 46 deletions(-) diff --git a/.changeset/new-waves-rule.md b/.changeset/new-waves-rule.md index 108e80274d..e68e679159 100644 --- a/.changeset/new-waves-rule.md +++ b/.changeset/new-waves-rule.md @@ -4,3 +4,4 @@ - Remove deprecated `@backstage/core-app-api@createApp` which has been replaced by `@backstage/app-defaults#createApp` - Remove deprecated type `BackstagePluginWithAnyOutput` +- Remove deprecated constructors for `GithubAuth`, `OAuth2`, and `SamlAuth` as the `create` method should be used instead diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index 55f87ec1eb..09078cd904 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -395,10 +395,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); // (undocumented) static create(options: OAuthApiCreateOptions): GithubAuth; // (undocumented) @@ -475,11 +471,6 @@ export class OAuth2 BackstageIdentityApi, SessionApi { - // @deprecated - constructor(options: { - sessionManager: SessionManager; - scopeTransform: (scopes: string[]) => string[]; - }); // (undocumented) static create(options: OAuth2CreateOptions): OAuth2; // (undocumented) @@ -560,8 +551,6 @@ export type OneLoginAuthCreateOptions = { export class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi { - // @deprecated - constructor(sessionManager: SessionManager); // (undocumented) static create(options: AuthApiCreateOptions): SamlAuth; // (undocumented) diff --git a/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts b/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts index 4da92efbdf..fb86f13f19 100644 --- a/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts +++ b/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts @@ -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) {} + private constructor( + private readonly sessionManager: SessionManager, + ) {} async signIn() { await this.getAccessToken(); diff --git a/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.test.ts b/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.test.ts index 4f030d1c64..b2398f64de 100644 --- a/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.test.ts +++ b/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.test.ts @@ -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 diff --git a/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts b/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts index 582526083b..18644a037f 100644 --- a/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts +++ b/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts @@ -120,10 +120,7 @@ export default class OAuth2 private readonly sessionManager: SessionManager; 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; scopeTransform: (scopes: string[]) => string[]; }) { diff --git a/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts b/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts index 5988e81c48..46c3550a3f 100644 --- a/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts +++ b/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts @@ -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) {} + private constructor( + private readonly sessionManager: SessionManager, + ) {} async signIn() { await this.getBackstageIdentity({}); From e4974087570784d729b7678914c716af71fc2072 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 13:59:11 -0500 Subject: [PATCH 18/25] remove creatApp from core-import test because of updated package resolution Signed-off-by: Colton Padden --- packages/codemods/src/tests/core-imports.test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/codemods/src/tests/core-imports.test.ts b/packages/codemods/src/tests/core-imports.test.ts index d8dea7eb90..ac1733e7fb 100644 --- a/packages/codemods/src/tests/core-imports.test.ts +++ b/packages/codemods/src/tests/core-imports.test.ts @@ -45,9 +45,8 @@ return something() it('should refactor imports', () => { const input = ` /* COPYRIGHT: ME */ -import { Button as MyButton, createApiRef, createApp } from '@backstage/core'; +import { Button as MyButton, createApiRef } from '@backstage/core'; -const app = createApp(); const apiRef = createApiRef(); const button = `; @@ -57,9 +56,7 @@ const button = import { Button as MyButton } from '@backstage/core-components'; import { createApiRef } from '@backstage/core-plugin-api'; -import { createApp } from '@backstage/core-app-api'; -const app = createApp(); const apiRef = createApiRef(); const button = `; From 35b03e9dba2feda26a5a39749b417bb299772d25 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 20:17:07 -0500 Subject: [PATCH 19/25] Remove improperly labelled deprecation of withLogCollector Signed-off-by: Colton Padden --- packages/test-utils/src/testUtils/logCollector.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/test-utils/src/testUtils/logCollector.ts b/packages/test-utils/src/testUtils/logCollector.ts index 25629f2c13..b9fa6220ed 100644 --- a/packages/test-utils/src/testUtils/logCollector.ts +++ b/packages/test-utils/src/testUtils/logCollector.ts @@ -73,7 +73,6 @@ export function withLogCollector( /** * 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, From df8ee362882826cde937ee60b1126262211f01fc Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 21:31:13 -0500 Subject: [PATCH 20/25] Implemented feedback to changesets, theme provider, and core-imports test - Removed validation logic for `appTheme.Provider` as type checking should be enough - Replaced `createApp` with `createSpecializedApp` in `core-imports.test.ts` - Upped changeset level from patch to minor and made minor verbiage tweaks Signed-off-by: Colton Padden --- .changeset/many-trees-happen.md | 2 +- .changeset/new-waves-rule.md | 8 ++++---- .changeset/nice-apricots-grow.md | 2 +- .changeset/olive-cameras-rush.md | 2 +- .changeset/short-rockets-remain.md | 6 +++--- packages/codemods/src/tests/core-imports.test.ts | 5 ++++- packages/core-app-api/src/app/AppThemeProvider.tsx | 4 ---- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.changeset/many-trees-happen.md b/.changeset/many-trees-happen.md index 0893eab4a2..f29c11fb22 100644 --- a/.changeset/many-trees-happen.md +++ b/.changeset/many-trees-happen.md @@ -1,5 +1,5 @@ --- -'@backstage/config-loader': patch +'@backstage/config-loader': minor --- Removed deprecated option `env` from `LoadConfigOptions` and associated tests diff --git a/.changeset/new-waves-rule.md b/.changeset/new-waves-rule.md index e68e679159..7470a1d08e 100644 --- a/.changeset/new-waves-rule.md +++ b/.changeset/new-waves-rule.md @@ -1,7 +1,7 @@ --- -'@backstage/core-app-api': patch +'@backstage/core-app-api': minor --- -- Remove deprecated `@backstage/core-app-api@createApp` which has been replaced by `@backstage/app-defaults#createApp` -- Remove deprecated type `BackstagePluginWithAnyOutput` -- Remove deprecated constructors for `GithubAuth`, `OAuth2`, and `SamlAuth` as the `create` method should be used instead +- Removed deprecated definition `createApp` from `@backstage/core-app-api` which has been replaced by `@backstage/app-defaults#createApp` +- Removed deprecated type `BackstagePluginWithAnyOutput` +- Removed deprecated constructors for `GithubAuth`, `OAuth2`, and `SamlAuth` as the `create` method should be used instead diff --git a/.changeset/nice-apricots-grow.md b/.changeset/nice-apricots-grow.md index 3e2f890717..290041091d 100644 --- a/.changeset/nice-apricots-grow.md +++ b/.changeset/nice-apricots-grow.md @@ -1,5 +1,5 @@ --- -'@backstage/core-plugin-api': patch +'@backstage/core-plugin-api': minor --- - Removed deprecated option `description` from `ApiRefConfig` diff --git a/.changeset/olive-cameras-rush.md b/.changeset/olive-cameras-rush.md index fe1f38befb..9a83aea699 100644 --- a/.changeset/olive-cameras-rush.md +++ b/.changeset/olive-cameras-rush.md @@ -1,5 +1,5 @@ --- -'@backstage/test-utils': patch +'@backstage/test-utils': minor --- Removed deprecated `msw` definition which was replaced by calling `setupRequestMockHandlers` directly diff --git a/.changeset/short-rockets-remain.md b/.changeset/short-rockets-remain.md index 25d8eda84f..603caec71a 100644 --- a/.changeset/short-rockets-remain.md +++ b/.changeset/short-rockets-remain.md @@ -1,9 +1,9 @@ --- '@backstage/app-defaults': patch -'@backstage/core-app-api': patch -'@backstage/core-plugin-api': patch +'@backstage/core-app-api': minor +'@backstage/core-plugin-api': minor --- -- Remove deprecation configuration option `theme` from `AppTheme` of the `AppThemeApi` +- Removed deprecation configuration option `theme` from `AppTheme` of the `AppThemeApi` - Removed reference to `theme` in the `app-defaults` default `AppTheme` - Removed logic in `AppThemeProvider` that creates `ThemeProvider` from `appTheme.theme` diff --git a/packages/codemods/src/tests/core-imports.test.ts b/packages/codemods/src/tests/core-imports.test.ts index ac1733e7fb..0b416e5c8e 100644 --- a/packages/codemods/src/tests/core-imports.test.ts +++ b/packages/codemods/src/tests/core-imports.test.ts @@ -45,8 +45,9 @@ return something() it('should refactor imports', () => { const input = ` /* COPYRIGHT: ME */ -import { Button as MyButton, createApiRef } from '@backstage/core'; +import { Button as MyButton, createApiRef, createSpecializedApp } from '@backstage/core'; +const app = createSpecializedApp(); const apiRef = createApiRef(); const button = `; @@ -56,7 +57,9 @@ const button = import { Button as MyButton } from '@backstage/core-components'; import { createApiRef } from '@backstage/core-plugin-api'; +import { createSpecializedApp } from '@backstage/core-app-api'; +const app = createSpecializedApp(); const apiRef = createApiRef(); const button = `; diff --git a/packages/core-app-api/src/app/AppThemeProvider.tsx b/packages/core-app-api/src/app/AppThemeProvider.tsx index 797e2bce87..b2c800f673 100644 --- a/packages/core-app-api/src/app/AppThemeProvider.tsx +++ b/packages/core-app-api/src/app/AppThemeProvider.tsx @@ -88,9 +88,5 @@ export function AppThemeProvider({ children }: PropsWithChildren<{}>) { throw new Error('App has no themes'); } - if (!appTheme.Provider) { - throw new Error('App has no theme provider'); - } - return ; } From ec3c47bee6b106a1743fc8c0ab24639cea4a3322 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 21:50:53 -0500 Subject: [PATCH 21/25] reintroduce check that provider is not null Signed-off-by: Colton Padden --- packages/core-app-api/src/app/AppThemeProvider.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core-app-api/src/app/AppThemeProvider.tsx b/packages/core-app-api/src/app/AppThemeProvider.tsx index b2c800f673..5bc06e61e8 100644 --- a/packages/core-app-api/src/app/AppThemeProvider.tsx +++ b/packages/core-app-api/src/app/AppThemeProvider.tsx @@ -87,6 +87,9 @@ export function AppThemeProvider({ children }: PropsWithChildren<{}>) { if (!appTheme) { throw new Error('App has no themes'); } + if (!appTheme.Provider) { + throw new Error('App has no theme provider'); + } return ; } From 80d4435e3736fee0f4a376ff988df86cd7cf74d0 Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Wed, 15 Dec 2021 21:52:09 -0500 Subject: [PATCH 22/25] removed documentation links to the @backstage/core-app-api#createApp Signed-off-by: Colton Padden --- packages/app-defaults/src/defaults/components.tsx | 2 +- packages/core-app-api/api-report.md | 6 ------ packages/core-app-api/src/app/createSpecializedApp.tsx | 7 +++++++ packages/core-app-api/src/app/types.ts | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/app-defaults/src/defaults/components.tsx b/packages/app-defaults/src/defaults/components.tsx index 139bea4862..93a5d9cd50 100644 --- a/packages/app-defaults/src/defaults/components.tsx +++ b/packages/app-defaults/src/defaults/components.tsx @@ -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 */ diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index 09078cd904..8746211a45 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -200,8 +200,6 @@ export type AppIcons = { warning: IconComponent; }; -// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-app-api" does not have an export "createApp" -// // @public export type AppOptions = { apis?: Iterable; @@ -223,8 +221,6 @@ export type AppOptions = { bindRoutes?(context: { bind: AppRouteBinder }): void; }; -// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-app-api" does not have an export "createApp" -// // @public export type AppRouteBinder = < ExternalRoutes extends { @@ -272,8 +268,6 @@ export type AuthApiCreateOptions = { provider?: AuthProviderInfo; }; -// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-app-api" does not have an export "createApp" -// // @public export type BackstageApp = { getPlugins(): BackstagePlugin[]; diff --git a/packages/core-app-api/src/app/createSpecializedApp.tsx b/packages/core-app-api/src/app/createSpecializedApp.tsx index 9bda223722..40906ef5c7 100644 --- a/packages/core-app-api/src/app/createSpecializedApp.tsx +++ b/packages/core-app-api/src/app/createSpecializedApp.tsx @@ -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); diff --git a/packages/core-app-api/src/app/types.ts b/packages/core-app-api/src/app/types.ts index 4b20aeff7e..4b8d2741cb 100644 --- a/packages/core-app-api/src/app/types.ts +++ b/packages/core-app-api/src/app/types.ts @@ -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,7 +204,7 @@ export type AppRouteBinder = < ) => void; /** - * The options accepted by {@link createApp}. + * The options accepted by {@link createSpecializedApp}. * * @public */ @@ -306,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 */ From e654134d229121a559c2356590089931a790d58b Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Fri, 17 Dec 2021 15:14:16 -0500 Subject: [PATCH 23/25] remove unused reference to OldIconComponent Signed-off-by: Colton Padden --- packages/core-plugin-api/src/routing/RouteRef.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core-plugin-api/src/routing/RouteRef.ts b/packages/core-plugin-api/src/routing/RouteRef.ts index abb05c54c5..7a4b228fab 100644 --- a/packages/core-plugin-api/src/routing/RouteRef.ts +++ b/packages/core-plugin-api/src/routing/RouteRef.ts @@ -21,7 +21,6 @@ import { ParamKeys, OptionalParams, } from './types'; -import { OldIconComponent } from '../icons/types'; /** * @internal From cb278fa3ad601f59312412eaa729638012ab4cca Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Mon, 20 Dec 2021 13:16:52 -0500 Subject: [PATCH 24/25] make Provider required in AppTheme Signed-off-by: Colton Padden --- packages/core-app-api/src/app/AppThemeProvider.tsx | 3 --- packages/core-plugin-api/api-report.md | 2 +- packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts | 2 +- packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx | 2 ++ 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core-app-api/src/app/AppThemeProvider.tsx b/packages/core-app-api/src/app/AppThemeProvider.tsx index 5bc06e61e8..b2c800f673 100644 --- a/packages/core-app-api/src/app/AppThemeProvider.tsx +++ b/packages/core-app-api/src/app/AppThemeProvider.tsx @@ -87,9 +87,6 @@ export function AppThemeProvider({ children }: PropsWithChildren<{}>) { if (!appTheme) { throw new Error('App has no themes'); } - if (!appTheme.Provider) { - throw new Error('App has no theme provider'); - } return ; } diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index b31722f29d..e4db8e1033 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -164,7 +164,7 @@ export type AppTheme = { title: string; variant: 'light' | 'dark'; icon?: React.ReactElement; - Provider?(props: { children: ReactNode }): JSX.Element | null; + Provider(props: { children: ReactNode }): JSX.Element | null; }; // @public diff --git a/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts b/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts index 7f8aed9573..e771fad597 100644 --- a/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts +++ b/packages/core-plugin-api/src/apis/definitions/AppThemeApi.ts @@ -44,7 +44,7 @@ export type AppTheme = { */ icon?: React.ReactElement; - Provider?(props: { children: ReactNode }): JSX.Element | null; + Provider(props: { children: ReactNode }): JSX.Element | null; }; /** diff --git a/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx b/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx index bc44b69dbb..9229bc61dc 100644 --- a/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx +++ b/packages/dev-utils/src/devApp/SidebarThemeSwitcher.test.tsx @@ -40,11 +40,13 @@ describe('SidebarThemeSwitcher', () => { id: 'dark', title: 'Dark Theme', variant: 'dark', + Provider: jest.fn(), }, { id: 'light', title: 'Light Theme', variant: 'light', + Provider: jest.fn(), }, ]); }); From 2928eeda77765581252260412cbbbbf632c5edfc Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Mon, 20 Dec 2021 13:20:31 -0500 Subject: [PATCH 25/25] make id required in createRouteRef config Signed-off-by: Colton Padden --- packages/core-plugin-api/api-report.md | 2 +- packages/core-plugin-api/src/routing/RouteRef.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index e4db8e1033..c9045a21d4 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -357,7 +357,7 @@ export function createRouteRef< }, ParamKey extends string = never, >(config: { - id?: string; + id: string; params?: ParamKey[]; }): RouteRef>; diff --git a/packages/core-plugin-api/src/routing/RouteRef.ts b/packages/core-plugin-api/src/routing/RouteRef.ts index 7a4b228fab..36ca3f073d 100644 --- a/packages/core-plugin-api/src/routing/RouteRef.ts +++ b/packages/core-plugin-api/src/routing/RouteRef.ts @@ -62,16 +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[]; }): RouteRef> { - const id = config.id; - if (!id) { - throw new Error('RouteRef must be provided a non-empty id'); - } return new RouteRefImpl( - id, + config.id, (config.params ?? []) as ParamKeys>, ); }