From 7cfc0c190217d5bcab3659e1613a5d9cefc977bd Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 13 Oct 2024 13:11:11 +0200 Subject: [PATCH] plugins/*-backend: flip around alpha exports to stable Signed-off-by: Patrik Oldsberg --- plugins/app-backend/report-alpha.api.md | 10 +- plugins/app-backend/report.api.md | 9 +- plugins/app-backend/src/alpha.ts | 6 +- plugins/app-backend/src/index.ts | 7 +- plugins/app-backend/src/service/appPlugin.ts | 2 +- plugins/catalog-backend/report-alpha.api.md | 12 +- plugins/catalog-backend/report.api.md | 9 +- plugins/catalog-backend/src/alpha.ts | 7 +- plugins/catalog-backend/src/index.ts | 7 +- .../src/service/CatalogPlugin.ts | 2 +- plugins/events-backend/report-alpha.api.md | 10 +- plugins/events-backend/report.api.md | 7 +- plugins/events-backend/src/alpha.ts | 6 +- plugins/events-backend/src/index.ts | 7 +- .../src/service/EventsPlugin.ts | 2 +- .../kubernetes-backend/report-alpha.api.md | 10 +- plugins/kubernetes-backend/report.api.md | 9 +- plugins/kubernetes-backend/src/alpha.ts | 7 +- plugins/kubernetes-backend/src/index.ts | 7 +- plugins/kubernetes-backend/src/plugin.ts | 3 +- .../permission-backend/report-alpha.api.md | 10 +- plugins/permission-backend/report.api.md | 7 +- plugins/permission-backend/src/alpha.ts | 6 +- plugins/permission-backend/src/index.ts | 7 +- plugins/permission-backend/src/plugin.ts | 2 +- plugins/proxy-backend/report-alpha.api.md | 10 +- plugins/proxy-backend/report.api.md | 7 +- plugins/proxy-backend/src/alpha.ts | 36 +---- plugins/proxy-backend/src/index.ts | 7 +- plugins/proxy-backend/src/plugin.ts | 49 ++++++ .../scaffolder-backend/report-alpha.api.md | 9 +- plugins/scaffolder-backend/report.api.md | 9 +- .../src/ScaffolderPlugin.ts | 2 +- plugins/scaffolder-backend/src/alpha.ts | 6 +- plugins/scaffolder-backend/src/index.ts | 7 +- plugins/search-backend/dev/index.ts | 2 +- plugins/search-backend/report-alpha.api.md | 10 +- plugins/search-backend/report.api.md | 7 +- plugins/search-backend/src/alpha.ts | 142 +--------------- plugins/search-backend/src/index.ts | 7 +- .../src/{alpha.test.ts => plugin.test.ts} | 2 +- plugins/search-backend/src/plugin.ts | 153 ++++++++++++++++++ plugins/techdocs-backend/report-alpha.api.md | 10 +- plugins/techdocs-backend/report.api.md | 15 +- plugins/techdocs-backend/src/alpha.ts | 6 +- plugins/techdocs-backend/src/index.ts | 6 +- plugins/techdocs-backend/src/plugin.ts | 2 +- plugins/user-settings-backend/dev/index.ts | 2 +- .../user-settings-backend/report-alpha.api.md | 10 +- plugins/user-settings-backend/report.api.md | 10 +- plugins/user-settings-backend/src/alpha.ts | 39 +---- plugins/user-settings-backend/src/index.ts | 7 +- plugins/user-settings-backend/src/plugin.ts | 50 ++++++ 53 files changed, 430 insertions(+), 363 deletions(-) create mode 100644 plugins/proxy-backend/src/plugin.ts rename plugins/search-backend/src/{alpha.test.ts => plugin.test.ts} (96%) create mode 100644 plugins/search-backend/src/plugin.ts create mode 100644 plugins/user-settings-backend/src/plugin.ts diff --git a/plugins/app-backend/report-alpha.api.md b/plugins/app-backend/report-alpha.api.md index 1c9b6b2902..f5bd67554d 100644 --- a/plugins/app-backend/report-alpha.api.md +++ b/plugins/app-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const appPlugin: BackendFeature; -export default appPlugin; +// @alpha (undocumented) +const _appPlugin: BackendFeature; +export default _appPlugin; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_appPlugin". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/app-backend/report.api.md b/plugins/app-backend/report.api.md index b1a3eaa9a7..4ec356951f 100644 --- a/plugins/app-backend/report.api.md +++ b/plugins/app-backend/report.api.md @@ -12,13 +12,13 @@ import { HttpAuthService } from '@backstage/backend-plugin-api'; import { LoggerService } from '@backstage/backend-plugin-api'; import { RootConfigService } from '@backstage/backend-plugin-api'; +// @public +const appPlugin: BackendFeature; +export default appPlugin; + // @public @deprecated (undocumented) export function createRouter(options: RouterOptions): Promise; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; - // @public @deprecated (undocumented) export interface RouterOptions { appPackageName: string; @@ -38,7 +38,6 @@ export interface RouterOptions { // Warnings were encountered during analysis: // -// src/index.d.ts:8:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/router.d.ts:9:1 - (ae-undocumented) Missing documentation for "RouterOptions". // src/service/router.d.ts:10:5 - (ae-undocumented) Missing documentation for "config". // src/service/router.d.ts:11:5 - (ae-undocumented) Missing documentation for "logger". diff --git a/plugins/app-backend/src/alpha.ts b/plugins/app-backend/src/alpha.ts index 830e3587dc..eb661bc295 100644 --- a/plugins/app-backend/src/alpha.ts +++ b/plugins/app-backend/src/alpha.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export { appPlugin as default } from './service/appPlugin'; +import { appPlugin } from './service/appPlugin'; + +/** @alpha */ +const _appPlugin = appPlugin; +export default _appPlugin; diff --git a/plugins/app-backend/src/index.ts b/plugins/app-backend/src/index.ts index f59fcb7da5..9f83f6e30a 100644 --- a/plugins/app-backend/src/index.ts +++ b/plugins/app-backend/src/index.ts @@ -14,16 +14,11 @@ * limitations under the License. */ -import { appPlugin as feature } from './service/appPlugin'; - /** * A Backstage backend plugin that serves the Backstage frontend app * * @packageDocumentation */ +export { appPlugin as default } from './service/appPlugin'; export * from './service/router'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/app-backend/src/service/appPlugin.ts b/plugins/app-backend/src/service/appPlugin.ts index 000db80911..f8d9d5f7f4 100644 --- a/plugins/app-backend/src/service/appPlugin.ts +++ b/plugins/app-backend/src/service/appPlugin.ts @@ -28,7 +28,7 @@ import { ConfigSchema } from '@backstage/config-loader'; /** * The App plugin is responsible for serving the frontend app bundle and static assets. - * @alpha + * @public */ export const appPlugin = createBackendPlugin({ pluginId: 'app', diff --git a/plugins/catalog-backend/report-alpha.api.md b/plugins/catalog-backend/report-alpha.api.md index 74f1e7d1b4..59155670ba 100644 --- a/plugins/catalog-backend/report-alpha.api.md +++ b/plugins/catalog-backend/report-alpha.api.md @@ -74,10 +74,6 @@ export type CatalogPermissionRule< TParams extends PermissionRuleParams = PermissionRuleParams, > = PermissionRule; -// @alpha -const catalogPlugin: BackendFeature; -export default catalogPlugin; - // @alpha export const createCatalogConditionalDecision: ( permission: ResourcePermission<'catalog-entity'>, @@ -91,6 +87,10 @@ export const createCatalogPermissionRule: < rule: PermissionRule, ) => PermissionRule; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + // @alpha export const permissionRules: { hasAnnotation: PermissionRule< @@ -146,5 +146,9 @@ export const permissionRules: { >; }; +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". + // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/catalog-backend/report.api.md b/plugins/catalog-backend/report.api.md index dcd0319c49..9294c71377 100644 --- a/plugins/catalog-backend/report.api.md +++ b/plugins/catalog-backend/report.api.md @@ -212,6 +212,10 @@ export type CatalogPermissionRuleInput< TParams extends PermissionRuleParams = PermissionRuleParams, > = PermissionRule; +// @public +const catalogPlugin: BackendFeature; +export default catalogPlugin; + // @public export interface CatalogProcessingEngine { // (undocumented) @@ -350,10 +354,6 @@ export type EntityProviderMutation = EntityProviderMutation_2; // @public @deprecated (undocumented) export type EntityRelationSpec = EntityRelationSpec_2; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; - // @public (undocumented) export class FileReaderProcessor implements CatalogProcessor_2 { // (undocumented) @@ -521,7 +521,6 @@ export class UrlReaderProcessor implements CatalogProcessor_2 { // src/deprecated.d.ts:207:22 - (ae-undocumented) Missing documentation for "defaultCatalogCollatorEntityTransformer". // src/deprecated.d.ts:212:1 - (ae-undocumented) Missing documentation for "DefaultCatalogCollatorFactoryOptions". // src/deprecated.d.ts:217:1 - (ae-undocumented) Missing documentation for "CatalogCollatorEntityTransformer". -// src/index.d.ts:14:15 - (ae-undocumented) Missing documentation for "_feature". // src/processing/types.d.ts:31:5 - (ae-undocumented) Missing documentation for "start". // src/processing/types.d.ts:32:5 - (ae-undocumented) Missing documentation for "stop". // src/processors/AnnotateLocationEntityProcessor.d.ts:6:1 - (ae-undocumented) Missing documentation for "AnnotateLocationEntityProcessor". diff --git a/plugins/catalog-backend/src/alpha.ts b/plugins/catalog-backend/src/alpha.ts index f85ef02c80..4d40b8733e 100644 --- a/plugins/catalog-backend/src/alpha.ts +++ b/plugins/catalog-backend/src/alpha.ts @@ -14,5 +14,10 @@ * limitations under the License. */ +import { catalogPlugin } from './service/CatalogPlugin'; + +/** @alpha */ +const _feature = catalogPlugin; +export default _feature; + export * from './permissions'; -export { catalogPlugin as default } from './service/CatalogPlugin'; diff --git a/plugins/catalog-backend/src/index.ts b/plugins/catalog-backend/src/index.ts index a55a5eb687..3de6cea22e 100644 --- a/plugins/catalog-backend/src/index.ts +++ b/plugins/catalog-backend/src/index.ts @@ -14,14 +14,13 @@ * limitations under the License. */ -import { catalogPlugin as feature } from './service/CatalogPlugin'; - /** * The Backstage backend plugin that provides the Backstage catalog * * @packageDocumentation */ +export { catalogPlugin as default } from './service/CatalogPlugin'; export * from './processors'; export * from './processing'; export * from './search'; @@ -29,7 +28,3 @@ export * from './service'; export * from './deprecated'; export * from './constants'; export * from './util'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/catalog-backend/src/service/CatalogPlugin.ts b/plugins/catalog-backend/src/service/CatalogPlugin.ts index 269100e586..e36e4e1333 100644 --- a/plugins/catalog-backend/src/service/CatalogPlugin.ts +++ b/plugins/catalog-backend/src/service/CatalogPlugin.ts @@ -170,7 +170,7 @@ class CatalogModelExtensionPointImpl implements CatalogModelExtensionPoint { /** * Catalog plugin - * @alpha + * @public */ export const catalogPlugin = createBackendPlugin({ pluginId: 'catalog', diff --git a/plugins/events-backend/report-alpha.api.md b/plugins/events-backend/report-alpha.api.md index ef881006e4..c9f56bd226 100644 --- a/plugins/events-backend/report-alpha.api.md +++ b/plugins/events-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const eventsPlugin: BackendFeature; -export default eventsPlugin; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/events-backend/report.api.md b/plugins/events-backend/report.api.md index 8d39a28774..e7a33deb07 100644 --- a/plugins/events-backend/report.api.md +++ b/plugins/events-backend/report.api.md @@ -43,9 +43,9 @@ export class EventsBackend { start(): Promise; } -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; +// @public +const eventsPlugin: BackendFeature; +export default eventsPlugin; // @public export class HttpPostIngressEventPublisher { @@ -64,7 +64,6 @@ export class HttpPostIngressEventPublisher { // Warnings were encountered during analysis: // -// src/index.d.ts:9:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/DefaultEventBroker.d.ts:21:5 - (ae-undocumented) Missing documentation for "publish". // src/service/DefaultEventBroker.d.ts:22:5 - (ae-undocumented) Missing documentation for "subscribe". // src/service/EventsBackend.d.ts:14:5 - (ae-undocumented) Missing documentation for "setEventBroker". diff --git a/plugins/events-backend/src/alpha.ts b/plugins/events-backend/src/alpha.ts index 2d40694987..8e55d4e134 100644 --- a/plugins/events-backend/src/alpha.ts +++ b/plugins/events-backend/src/alpha.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export { eventsPlugin as default } from './service/EventsPlugin'; +import { eventsPlugin } from './service/EventsPlugin'; + +/** @alpha */ +const _feature = eventsPlugin; +export default _feature; diff --git a/plugins/events-backend/src/index.ts b/plugins/events-backend/src/index.ts index 425de752fd..6663f59393 100644 --- a/plugins/events-backend/src/index.ts +++ b/plugins/events-backend/src/index.ts @@ -14,17 +14,12 @@ * limitations under the License. */ -import { eventsPlugin as feature } from './service/EventsPlugin'; - /** * The Backstage backend plugin "events" that provides the event management. * * @packageDocumentation */ +export { eventsPlugin as default } from './service/EventsPlugin'; export * from './deprecated'; export { HttpPostIngressEventPublisher } from './service/http'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/events-backend/src/service/EventsPlugin.ts b/plugins/events-backend/src/service/EventsPlugin.ts index 1369ee98ca..10af3798ec 100644 --- a/plugins/events-backend/src/service/EventsPlugin.ts +++ b/plugins/events-backend/src/service/EventsPlugin.ts @@ -63,7 +63,7 @@ class EventsExtensionPointImpl implements EventsExtensionPoint { /** * Events plugin * - * @alpha + * @public */ export const eventsPlugin = createBackendPlugin({ pluginId: 'events', diff --git a/plugins/kubernetes-backend/report-alpha.api.md b/plugins/kubernetes-backend/report-alpha.api.md index f6da905f30..b4c4df2287 100644 --- a/plugins/kubernetes-backend/report-alpha.api.md +++ b/plugins/kubernetes-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const kubernetesPlugin: BackendFeature; -export default kubernetesPlugin; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/kubernetes-backend/report.api.md b/plugins/kubernetes-backend/report.api.md index 694d0b2695..9bcef16843 100644 --- a/plugins/kubernetes-backend/report.api.md +++ b/plugins/kubernetes-backend/report.api.md @@ -122,10 +122,6 @@ export type DispatchStrategyOptions = { }; }; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; - // @public @deprecated (undocumented) export type FetchResponseWrapper = k8sAuthTypes.FetchResponseWrapper; @@ -337,6 +333,10 @@ export interface KubernetesObjectsProviderOptions { // @public @deprecated (undocumented) export type KubernetesObjectTypes = k8sAuthTypes.KubernetesObjectTypes; +// @public +const kubernetesPlugin: BackendFeature; +export default kubernetesPlugin; + // @public export class KubernetesProxy { constructor(options: KubernetesProxyOptions); @@ -472,7 +472,6 @@ export type SigningCreds = { // src/auth/ServiceAccountStrategy.d.ts:9:5 - (ae-undocumented) Missing documentation for "presentAuthMetadata". // src/auth/types.d.ts:5:1 - (ae-undocumented) Missing documentation for "AuthenticationStrategy". // src/auth/types.d.ts:9:1 - (ae-undocumented) Missing documentation for "KubernetesCredential". -// src/index.d.ts:10:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/KubernetesBuilder.d.ts:14:1 - (ae-undocumented) Missing documentation for "KubernetesEnvironment". // src/service/KubernetesBuilder.d.ts:15:5 - (ae-undocumented) Missing documentation for "logger". // src/service/KubernetesBuilder.d.ts:16:5 - (ae-undocumented) Missing documentation for "config". diff --git a/plugins/kubernetes-backend/src/alpha.ts b/plugins/kubernetes-backend/src/alpha.ts index 9171964f7c..90e0a819ac 100644 --- a/plugins/kubernetes-backend/src/alpha.ts +++ b/plugins/kubernetes-backend/src/alpha.ts @@ -13,4 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { kubernetesPlugin as default } from './plugin'; + +import { kubernetesPlugin as feature } from './plugin'; + +/** @alpha */ +const _feature = feature; +export default _feature; diff --git a/plugins/kubernetes-backend/src/index.ts b/plugins/kubernetes-backend/src/index.ts index 186337cb81..87e77cac32 100644 --- a/plugins/kubernetes-backend/src/index.ts +++ b/plugins/kubernetes-backend/src/index.ts @@ -14,18 +14,13 @@ * limitations under the License. */ -import { kubernetesPlugin as feature } from './plugin'; - /** * A Backstage backend plugin that integrates towards Kubernetes * * @packageDocumentation */ +export { kubernetesPlugin as default } from './plugin'; export * from './auth'; export * from './service'; export * from './types'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/kubernetes-backend/src/plugin.ts b/plugins/kubernetes-backend/src/plugin.ts index 284fa2e5e2..83b2c66b5c 100644 --- a/plugins/kubernetes-backend/src/plugin.ts +++ b/plugins/kubernetes-backend/src/plugin.ts @@ -139,9 +139,8 @@ class AuthStrategy implements KubernetesAuthStrategyExtensionPoint { /** * This is the backend plugin that provides the Kubernetes integration. - * @alpha + * @public */ - export const kubernetesPlugin = createBackendPlugin({ pluginId: 'kubernetes', register(env) { diff --git a/plugins/permission-backend/report-alpha.api.md b/plugins/permission-backend/report-alpha.api.md index d0a10b6b3a..e2d43b0195 100644 --- a/plugins/permission-backend/report-alpha.api.md +++ b/plugins/permission-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const permissionPlugin: BackendFeature; -export default permissionPlugin; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/permission-backend/report.api.md b/plugins/permission-backend/report.api.md index 78e08d9873..fd559c4a6a 100644 --- a/plugins/permission-backend/report.api.md +++ b/plugins/permission-backend/report.api.md @@ -17,9 +17,9 @@ import { UserInfoService } from '@backstage/backend-plugin-api'; // @public @deprecated export function createRouter(options: RouterOptions): Promise; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; +// @public +const permissionPlugin: BackendFeature; +export default permissionPlugin; // @public @deprecated export interface RouterOptions { @@ -43,7 +43,6 @@ export interface RouterOptions { // Warnings were encountered during analysis: // -// src/index.d.ts:7:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/router.d.ts:13:5 - (ae-undocumented) Missing documentation for "logger". // src/service/router.d.ts:14:5 - (ae-undocumented) Missing documentation for "discovery". // src/service/router.d.ts:15:5 - (ae-undocumented) Missing documentation for "policy". diff --git a/plugins/permission-backend/src/alpha.ts b/plugins/permission-backend/src/alpha.ts index c0283c6fd0..519482333d 100644 --- a/plugins/permission-backend/src/alpha.ts +++ b/plugins/permission-backend/src/alpha.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export { permissionPlugin as default } from './plugin'; +import { permissionPlugin as feature } from './plugin'; + +/** @alpha */ +const _feature = feature; +export default _feature; diff --git a/plugins/permission-backend/src/index.ts b/plugins/permission-backend/src/index.ts index 29fca17cf3..b6d3366d37 100644 --- a/plugins/permission-backend/src/index.ts +++ b/plugins/permission-backend/src/index.ts @@ -14,14 +14,9 @@ * limitations under the License. */ -import { permissionPlugin as feature } from './plugin'; - /** * Backend for Backstage authorization and permissions. * @packageDocumentation */ +export { permissionPlugin as default } from './plugin'; export * from './service'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/permission-backend/src/plugin.ts b/plugins/permission-backend/src/plugin.ts index f0130e4812..6a3fb35fd3 100644 --- a/plugins/permission-backend/src/plugin.ts +++ b/plugins/permission-backend/src/plugin.ts @@ -39,7 +39,7 @@ class PolicyExtensionPointImpl implements PolicyExtensionPoint { /** * Permission plugin * - * @alpha + * @public */ export const permissionPlugin = createBackendPlugin({ pluginId: 'permission', diff --git a/plugins/proxy-backend/report-alpha.api.md b/plugins/proxy-backend/report-alpha.api.md index e6d161655d..a32524352e 100644 --- a/plugins/proxy-backend/report-alpha.api.md +++ b/plugins/proxy-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const _default: BackendFeature; -export default _default; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/proxy-backend/report.api.md b/plugins/proxy-backend/report.api.md index f299986239..0a68a03cfe 100644 --- a/plugins/proxy-backend/report.api.md +++ b/plugins/proxy-backend/report.api.md @@ -12,9 +12,9 @@ import { RootConfigService } from '@backstage/backend-plugin-api'; // @public @deprecated export function createRouter(options: RouterOptions): Promise; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; +// @public +const proxyPlugin: BackendFeature; +export default proxyPlugin; // @public @deprecated (undocumented) export interface RouterOptions { @@ -32,7 +32,6 @@ export interface RouterOptions { // Warnings were encountered during analysis: // -// src/index.d.ts:8:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/router.d.ts:9:1 - (ae-undocumented) Missing documentation for "RouterOptions". // src/service/router.d.ts:10:5 - (ae-undocumented) Missing documentation for "logger". // src/service/router.d.ts:11:5 - (ae-undocumented) Missing documentation for "config". diff --git a/plugins/proxy-backend/src/alpha.ts b/plugins/proxy-backend/src/alpha.ts index 339e42cd94..6efe450ac3 100644 --- a/plugins/proxy-backend/src/alpha.ts +++ b/plugins/proxy-backend/src/alpha.ts @@ -14,36 +14,8 @@ * limitations under the License. */ -import { loggerToWinstonLogger } from '@backstage/backend-common'; -import { - createBackendPlugin, - coreServices, -} from '@backstage/backend-plugin-api'; -import { createRouterInternal } from './service/router'; +import { proxyPlugin } from './plugin'; -/** - * The proxy backend plugin. - * - * @alpha - */ -export default createBackendPlugin({ - pluginId: 'proxy', - register(env) { - env.registerInit({ - deps: { - config: coreServices.rootConfig, - discovery: coreServices.discovery, - logger: coreServices.logger, - httpRouter: coreServices.httpRouter, - }, - async init({ config, discovery, logger, httpRouter }) { - await createRouterInternal({ - config, - discovery, - logger: loggerToWinstonLogger(logger), - httpRouterService: httpRouter, - }); - }, - }); - }, -}); +/** @alpha */ +const _feature = proxyPlugin; +export default _feature; diff --git a/plugins/proxy-backend/src/index.ts b/plugins/proxy-backend/src/index.ts index 4da38f069c..ae0b6235f9 100644 --- a/plugins/proxy-backend/src/index.ts +++ b/plugins/proxy-backend/src/index.ts @@ -14,16 +14,11 @@ * limitations under the License. */ -import { default as feature } from './alpha'; - /** * A Backstage backend plugin that helps you set up proxy endpoints in the backend * * @packageDocumentation */ +export { proxyPlugin as default } from './plugin'; export * from './service'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/proxy-backend/src/plugin.ts b/plugins/proxy-backend/src/plugin.ts new file mode 100644 index 0000000000..1039a6a3e8 --- /dev/null +++ b/plugins/proxy-backend/src/plugin.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { loggerToWinstonLogger } from '@backstage/backend-common'; +import { + createBackendPlugin, + coreServices, +} from '@backstage/backend-plugin-api'; +import { createRouterInternal } from './service/router'; + +/** + * The proxy backend plugin. + * + * @public + */ +export const proxyPlugin = createBackendPlugin({ + pluginId: 'proxy', + register(env) { + env.registerInit({ + deps: { + config: coreServices.rootConfig, + discovery: coreServices.discovery, + logger: coreServices.logger, + httpRouter: coreServices.httpRouter, + }, + async init({ config, discovery, logger, httpRouter }) { + await createRouterInternal({ + config, + discovery, + logger: loggerToWinstonLogger(logger), + httpRouterService: httpRouter, + }); + }, + }); + }, +}); diff --git a/plugins/scaffolder-backend/report-alpha.api.md b/plugins/scaffolder-backend/report-alpha.api.md index d53ce7a4e4..89d4fecd8c 100644 --- a/plugins/scaffolder-backend/report-alpha.api.md +++ b/plugins/scaffolder-backend/report-alpha.api.md @@ -26,6 +26,10 @@ export const createScaffolderTemplateConditionalDecision: ( conditions: PermissionCriteria>, ) => ConditionalPolicyDecision; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + // @alpha export const scaffolderActionConditions: Conditions<{ hasActionId: PermissionRule< @@ -77,10 +81,6 @@ export const scaffolderActionConditions: Conditions<{ >; }>; -// @alpha -const scaffolderPlugin: BackendFeature; -export default scaffolderPlugin; - // @alpha export const scaffolderTemplateConditions: Conditions<{ hasTag: PermissionRule< @@ -95,6 +95,7 @@ export const scaffolderTemplateConditions: Conditions<{ // Warnings were encountered during analysis: // +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/conditionExports.d.ts:48:22 - (ae-undocumented) Missing documentation for "createScaffolderActionConditionalDecision". // (No @packageDocumentation comment for this package) diff --git a/plugins/scaffolder-backend/report.api.md b/plugins/scaffolder-backend/report.api.md index 979c8ddad3..d3dddc21e9 100644 --- a/plugins/scaffolder-backend/report.api.md +++ b/plugins/scaffolder-backend/report.api.md @@ -505,10 +505,6 @@ export type DatabaseTaskStoreOptions = { // @public @deprecated export const executeShellCommand: typeof executeShellCommand_2; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; - // @public @deprecated export const fetchContents: typeof fetchContents_2; @@ -565,6 +561,10 @@ export type RunCommandOptions = ExecuteShellCommandOptions; // @public @deprecated export const ScaffolderEntitiesProcessor: typeof ScaffolderEntitiesProcessor_2; +// @public +const scaffolderPlugin: BackendFeature; +export default scaffolderPlugin; + // @public @deprecated export type SerializedTask = SerializedTask_2; @@ -851,7 +851,6 @@ export type TemplatePermissionRuleInput< // src/deprecated.d.ts:13:22 - (ae-undocumented) Missing documentation for "createTemplateAction". // src/deprecated.d.ts:18:1 - (ae-undocumented) Missing documentation for "TaskSecrets". // src/deprecated.d.ts:23:1 - (ae-undocumented) Missing documentation for "TemplateAction". -// src/index.d.ts:10:15 - (ae-undocumented) Missing documentation for "_feature". // src/lib/templating/SecureTemplater.d.ts:6:1 - (ae-undocumented) Missing documentation for "TemplateFilter". // src/lib/templating/SecureTemplater.d.ts:11:1 - (ae-undocumented) Missing documentation for "TemplateGlobal". // src/scaffolder/actions/TemplateActionRegistry.d.ts:8:5 - (ae-undocumented) Missing documentation for "register". diff --git a/plugins/scaffolder-backend/src/ScaffolderPlugin.ts b/plugins/scaffolder-backend/src/ScaffolderPlugin.ts index cf0f557639..17f7480a7d 100644 --- a/plugins/scaffolder-backend/src/ScaffolderPlugin.ts +++ b/plugins/scaffolder-backend/src/ScaffolderPlugin.ts @@ -54,7 +54,7 @@ import { createRouter } from './service/router'; /** * Scaffolder plugin * - * @alpha + * @public */ export const scaffolderPlugin = createBackendPlugin({ pluginId: 'scaffolder', diff --git a/plugins/scaffolder-backend/src/alpha.ts b/plugins/scaffolder-backend/src/alpha.ts index 4c4885413b..7d1d8fe0ef 100644 --- a/plugins/scaffolder-backend/src/alpha.ts +++ b/plugins/scaffolder-backend/src/alpha.ts @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { scaffolderPlugin } from './ScaffolderPlugin'; + +/** @alpha */ +const _feature = scaffolderPlugin; +export default _feature; export * from './service'; -export { scaffolderPlugin as default } from './ScaffolderPlugin'; diff --git a/plugins/scaffolder-backend/src/index.ts b/plugins/scaffolder-backend/src/index.ts index e53a9a9044..dddd42d83f 100644 --- a/plugins/scaffolder-backend/src/index.ts +++ b/plugins/scaffolder-backend/src/index.ts @@ -14,20 +14,15 @@ * limitations under the License. */ -import { scaffolderPlugin as feature } from './ScaffolderPlugin'; - /** * The Backstage backend plugin that helps you create new things * * @packageDocumentation */ +export { scaffolderPlugin as default } from './ScaffolderPlugin'; export * from './scaffolder'; export * from './service/router'; export * from './lib'; -/** @public */ -const _feature = feature; -export default _feature; - export * from './deprecated'; diff --git a/plugins/search-backend/dev/index.ts b/plugins/search-backend/dev/index.ts index 9c108c0de1..f03689d63c 100644 --- a/plugins/search-backend/dev/index.ts +++ b/plugins/search-backend/dev/index.ts @@ -17,5 +17,5 @@ import { createBackend } from '@backstage/backend-defaults'; const backend = createBackend(); -backend.add(import('../src/alpha')); +backend.add(import('../src/plugin')); backend.start(); diff --git a/plugins/search-backend/report-alpha.api.md b/plugins/search-backend/report-alpha.api.md index 8221359a36..9cae91f291 100644 --- a/plugins/search-backend/report-alpha.api.md +++ b/plugins/search-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const _default: BackendFeature; -export default _default; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/search-backend/report.api.md b/plugins/search-backend/report.api.md index e770c0276e..e1cf271dc9 100644 --- a/plugins/search-backend/report.api.md +++ b/plugins/search-backend/report.api.md @@ -18,9 +18,9 @@ import { SearchEngine } from '@backstage/plugin-search-backend-node'; // @public @deprecated (undocumented) export function createRouter(options: RouterOptions): Promise; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; +// @public +const _default: BackendFeature; +export default _default; // @public @deprecated (undocumented) export type RouterOptions = { @@ -36,7 +36,6 @@ export type RouterOptions = { // Warnings were encountered during analysis: // -// src/index.d.ts:8:15 - (ae-undocumented) Missing documentation for "_feature". // src/service/router.d.ts:11:1 - (ae-undocumented) Missing documentation for "RouterOptions". // src/service/router.d.ts:25:1 - (ae-undocumented) Missing documentation for "createRouter". ``` diff --git a/plugins/search-backend/src/alpha.ts b/plugins/search-backend/src/alpha.ts index 3a3ba82c3e..a8c814004b 100644 --- a/plugins/search-backend/src/alpha.ts +++ b/plugins/search-backend/src/alpha.ts @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Backstage Authors + * Copyright 2024 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,140 +14,8 @@ * limitations under the License. */ -import { - coreServices, - createBackendPlugin, -} from '@backstage/backend-plugin-api'; -import { - LunrSearchEngine, - RegisterCollatorParameters, - RegisterDecoratorParameters, - SearchEngine, -} from '@backstage/plugin-search-backend-node'; -import { - SearchEngineRegistryExtensionPoint, - searchEngineRegistryExtensionPoint, - searchIndexRegistryExtensionPoint, - SearchIndexRegistryExtensionPoint, - searchIndexServiceRef, -} from '@backstage/plugin-search-backend-node/alpha'; +import { default as feature } from './plugin'; -import { createRouter } from './service/router'; - -class SearchIndexRegistry implements SearchIndexRegistryExtensionPoint { - private collators: RegisterCollatorParameters[] = []; - private decorators: RegisterDecoratorParameters[] = []; - - public addCollator(options: RegisterCollatorParameters): void { - this.collators.push(options); - } - - public addDecorator(options: RegisterDecoratorParameters): void { - this.decorators.push(options); - } - - public getCollators(): RegisterCollatorParameters[] { - return this.collators; - } - - public getDecorators(): RegisterDecoratorParameters[] { - return this.decorators; - } -} - -class SearchEngineRegistry implements SearchEngineRegistryExtensionPoint { - private searchEngine: SearchEngine | null = null; - - public setSearchEngine(searchEngine: SearchEngine): void { - if (this.searchEngine) { - throw new Error('Multiple Search engines is not supported at this time'); - } - this.searchEngine = searchEngine; - } - - public getSearchEngine(): SearchEngine | null { - return this.searchEngine; - } -} - -/** - * The Search plugin is responsible for starting search indexing processes and return search results. - * @alpha - */ -export default createBackendPlugin({ - pluginId: 'search', - register(env) { - const searchIndexRegistry = new SearchIndexRegistry(); - env.registerExtensionPoint( - searchIndexRegistryExtensionPoint, - searchIndexRegistry, - ); - - const searchEngineRegistry = new SearchEngineRegistry(); - env.registerExtensionPoint( - searchEngineRegistryExtensionPoint, - searchEngineRegistry, - ); - - env.registerInit({ - deps: { - logger: coreServices.logger, - config: coreServices.rootConfig, - discovery: coreServices.discovery, - permissions: coreServices.permissions, - auth: coreServices.auth, - http: coreServices.httpRouter, - httpAuth: coreServices.httpAuth, - lifecycle: coreServices.rootLifecycle, - searchIndexService: searchIndexServiceRef, - }, - async init({ - config, - logger, - discovery, - permissions, - auth, - http, - httpAuth, - lifecycle, - searchIndexService, - }) { - let searchEngine = searchEngineRegistry.getSearchEngine(); - if (!searchEngine) { - searchEngine = new LunrSearchEngine({ - logger, - }); - } - - const collators = searchIndexRegistry.getCollators(); - const decorators = searchIndexRegistry.getDecorators(); - searchIndexService.init({ - searchEngine: searchEngine!, - collators, - decorators, - }); - - lifecycle.addStartupHook(async () => { - await searchIndexService.start(); - }); - - lifecycle.addShutdownHook(async () => { - await searchIndexService.stop(); - }); - - const router = await createRouter({ - config, - discovery, - permissions, - auth, - httpAuth, - logger, - engine: searchEngine, - types: searchIndexService.getDocumentTypes(), - }); - - http.use(router); - }, - }); - }, -}); +/** @alpha */ +const _feature = feature; +export default _feature; diff --git a/plugins/search-backend/src/index.ts b/plugins/search-backend/src/index.ts index 69c2b1483d..2bd58730b1 100644 --- a/plugins/search-backend/src/index.ts +++ b/plugins/search-backend/src/index.ts @@ -14,16 +14,11 @@ * limitations under the License. */ -import { default as feature } from './alpha'; - /** * The Backstage backend plugin that provides your backstage app with search * * @packageDocumentation */ +export { default } from './plugin'; export * from './service/router'; - -/** @public */ -const _feature = feature; -export default _feature; diff --git a/plugins/search-backend/src/alpha.test.ts b/plugins/search-backend/src/plugin.test.ts similarity index 96% rename from plugins/search-backend/src/alpha.test.ts rename to plugins/search-backend/src/plugin.test.ts index dfe80987d4..905d384bb1 100644 --- a/plugins/search-backend/src/alpha.test.ts +++ b/plugins/search-backend/src/plugin.test.ts @@ -16,7 +16,7 @@ import { startTestBackend } from '@backstage/backend-test-utils'; import request from 'supertest'; -import searchPlugin from './alpha'; +import searchPlugin from './plugin'; describe('searchPlugin', () => { it('should serve search results on query endpoint', async () => { diff --git a/plugins/search-backend/src/plugin.ts b/plugins/search-backend/src/plugin.ts new file mode 100644 index 0000000000..6f4f0dc4cb --- /dev/null +++ b/plugins/search-backend/src/plugin.ts @@ -0,0 +1,153 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + coreServices, + createBackendPlugin, +} from '@backstage/backend-plugin-api'; +import { + LunrSearchEngine, + RegisterCollatorParameters, + RegisterDecoratorParameters, + SearchEngine, +} from '@backstage/plugin-search-backend-node'; +import { + SearchEngineRegistryExtensionPoint, + searchEngineRegistryExtensionPoint, + searchIndexRegistryExtensionPoint, + SearchIndexRegistryExtensionPoint, + searchIndexServiceRef, +} from '@backstage/plugin-search-backend-node/alpha'; + +import { createRouter } from './service/router'; + +class SearchIndexRegistry implements SearchIndexRegistryExtensionPoint { + private collators: RegisterCollatorParameters[] = []; + private decorators: RegisterDecoratorParameters[] = []; + + public addCollator(options: RegisterCollatorParameters): void { + this.collators.push(options); + } + + public addDecorator(options: RegisterDecoratorParameters): void { + this.decorators.push(options); + } + + public getCollators(): RegisterCollatorParameters[] { + return this.collators; + } + + public getDecorators(): RegisterDecoratorParameters[] { + return this.decorators; + } +} + +class SearchEngineRegistry implements SearchEngineRegistryExtensionPoint { + private searchEngine: SearchEngine | null = null; + + public setSearchEngine(searchEngine: SearchEngine): void { + if (this.searchEngine) { + throw new Error('Multiple Search engines is not supported at this time'); + } + this.searchEngine = searchEngine; + } + + public getSearchEngine(): SearchEngine | null { + return this.searchEngine; + } +} + +/** + * The Search plugin is responsible for starting search indexing processes and return search results. + * @public + */ +export default createBackendPlugin({ + pluginId: 'search', + register(env) { + const searchIndexRegistry = new SearchIndexRegistry(); + env.registerExtensionPoint( + searchIndexRegistryExtensionPoint, + searchIndexRegistry, + ); + + const searchEngineRegistry = new SearchEngineRegistry(); + env.registerExtensionPoint( + searchEngineRegistryExtensionPoint, + searchEngineRegistry, + ); + + env.registerInit({ + deps: { + logger: coreServices.logger, + config: coreServices.rootConfig, + discovery: coreServices.discovery, + permissions: coreServices.permissions, + auth: coreServices.auth, + http: coreServices.httpRouter, + httpAuth: coreServices.httpAuth, + lifecycle: coreServices.rootLifecycle, + searchIndexService: searchIndexServiceRef, + }, + async init({ + config, + logger, + discovery, + permissions, + auth, + http, + httpAuth, + lifecycle, + searchIndexService, + }) { + let searchEngine = searchEngineRegistry.getSearchEngine(); + if (!searchEngine) { + searchEngine = new LunrSearchEngine({ + logger, + }); + } + + const collators = searchIndexRegistry.getCollators(); + const decorators = searchIndexRegistry.getDecorators(); + searchIndexService.init({ + searchEngine: searchEngine!, + collators, + decorators, + }); + + lifecycle.addStartupHook(async () => { + await searchIndexService.start(); + }); + + lifecycle.addShutdownHook(async () => { + await searchIndexService.stop(); + }); + + const router = await createRouter({ + config, + discovery, + permissions, + auth, + httpAuth, + logger, + engine: searchEngine, + types: searchIndexService.getDocumentTypes(), + }); + + http.use(router); + }, + }); + }, +}); diff --git a/plugins/techdocs-backend/report-alpha.api.md b/plugins/techdocs-backend/report-alpha.api.md index 9074c87138..d97dc13982 100644 --- a/plugins/techdocs-backend/report-alpha.api.md +++ b/plugins/techdocs-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const techdocsPlugin: BackendFeature; -export default techdocsPlugin; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/techdocs-backend/report.api.md b/plugins/techdocs-backend/report.api.md index f61518b587..569df8ee7c 100644 --- a/plugins/techdocs-backend/report.api.md +++ b/plugins/techdocs-backend/report.api.md @@ -54,10 +54,6 @@ export const DefaultTechDocsCollatorFactory: typeof DefaultTechDocsCollatorFacto // @public @deprecated (undocumented) export type DocsBuildStrategy = DocsBuildStrategy_2; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; - // @public export type OutOfTheBoxDeploymentOptions = { preparers: PreparerBuilder; @@ -116,14 +112,17 @@ export type TechDocsCollatorOptions = { // @public @deprecated (undocumented) export type TechDocsDocument = TechDocsDocument_2; +// @public +const techdocsPlugin: BackendFeature; +export default techdocsPlugin; + export * from '@backstage/plugin-techdocs-node'; // Warnings were encountered during analysis: // -// src/index.d.ts:13:15 - (ae-undocumented) Missing documentation for "_feature". -// src/index.d.ts:19:1 - (ae-undocumented) Missing documentation for "DocsBuildStrategy". -// src/index.d.ts:24:1 - (ae-undocumented) Missing documentation for "ShouldBuildParameters". -// src/index.d.ts:31:1 - (ae-undocumented) Missing documentation for "TechDocsDocument". +// src/index.d.ts:17:1 - (ae-undocumented) Missing documentation for "DocsBuildStrategy". +// src/index.d.ts:22:1 - (ae-undocumented) Missing documentation for "ShouldBuildParameters". +// src/index.d.ts:29:1 - (ae-undocumented) Missing documentation for "TechDocsDocument". // src/search/DefaultTechDocsCollator.d.ts:32:5 - (ae-undocumented) Missing documentation for "type". // src/search/DefaultTechDocsCollator.d.ts:33:5 - (ae-undocumented) Missing documentation for "visibilityPermission". // src/search/DefaultTechDocsCollator.d.ts:35:5 - (ae-undocumented) Missing documentation for "fromConfig". diff --git a/plugins/techdocs-backend/src/alpha.ts b/plugins/techdocs-backend/src/alpha.ts index 7ac39bde91..2c69426759 100644 --- a/plugins/techdocs-backend/src/alpha.ts +++ b/plugins/techdocs-backend/src/alpha.ts @@ -14,4 +14,8 @@ * limitations under the License. */ -export { techdocsPlugin as default } from './plugin'; +import { techdocsPlugin } from './plugin'; + +/** @alpha */ +const _feature = techdocsPlugin; +export default _feature; diff --git a/plugins/techdocs-backend/src/index.ts b/plugins/techdocs-backend/src/index.ts index eb047ec4f0..c5fbf10c60 100644 --- a/plugins/techdocs-backend/src/index.ts +++ b/plugins/techdocs-backend/src/index.ts @@ -25,8 +25,8 @@ import { DocsBuildStrategy as _DocsBuildStrategy, TechDocsDocument as _TechDocsDocument, } from '@backstage/plugin-techdocs-node'; -import { techdocsPlugin as feature } from './plugin'; +export { techdocsPlugin as default } from './plugin'; export { createRouter } from './service'; export type { RouterOptions, @@ -43,10 +43,6 @@ export type { TechDocsCollatorOptions, } from './search'; -/** @public */ -const _feature = feature; -export default _feature; - /** * @public * @deprecated import from `@backstage/plugin-techdocs-node` instead diff --git a/plugins/techdocs-backend/src/plugin.ts b/plugins/techdocs-backend/src/plugin.ts index 9b5ae21a52..13b2e73563 100644 --- a/plugins/techdocs-backend/src/plugin.ts +++ b/plugins/techdocs-backend/src/plugin.ts @@ -44,7 +44,7 @@ import * as winston from 'winston'; /** * The TechDocs plugin is responsible for serving and building documentation for any entity. - * @alpha + * @public */ export const techdocsPlugin = createBackendPlugin({ pluginId: 'techdocs', diff --git a/plugins/user-settings-backend/dev/index.ts b/plugins/user-settings-backend/dev/index.ts index 43c75d24df..7180ff5baa 100644 --- a/plugins/user-settings-backend/dev/index.ts +++ b/plugins/user-settings-backend/dev/index.ts @@ -17,5 +17,5 @@ import { createBackend } from '@backstage/backend-defaults'; const backend = createBackend(); -backend.add(import('../src/alpha')); +backend.add(import('../src/plugin')); backend.start(); diff --git a/plugins/user-settings-backend/report-alpha.api.md b/plugins/user-settings-backend/report-alpha.api.md index 6fe4f10fe7..02c93f9aee 100644 --- a/plugins/user-settings-backend/report-alpha.api.md +++ b/plugins/user-settings-backend/report-alpha.api.md @@ -5,9 +5,13 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -// @alpha -const _default: BackendFeature; -export default _default; +// @alpha (undocumented) +const _feature: BackendFeature; +export default _feature; + +// Warnings were encountered during analysis: +// +// src/alpha.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/user-settings-backend/report.api.md b/plugins/user-settings-backend/report.api.md index df35f0cd82..cbbd8d5d6d 100644 --- a/plugins/user-settings-backend/report.api.md +++ b/plugins/user-settings-backend/report.api.md @@ -12,9 +12,9 @@ import { SignalsService } from '@backstage/plugin-signals-node'; // @public @deprecated export function createRouter(options: RouterOptions): Promise; -// @public (undocumented) -const _feature: BackendFeature; -export default _feature; +// @public +const _default: BackendFeature; +export default _default; // @public @deprecated export type RouterOptions = { @@ -23,9 +23,5 @@ export type RouterOptions = { signals?: SignalsService; }; -// Warnings were encountered during analysis: -// -// src/index.d.ts:2:15 - (ae-undocumented) Missing documentation for "_feature". - // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/user-settings-backend/src/alpha.ts b/plugins/user-settings-backend/src/alpha.ts index ea24389e46..a8c814004b 100644 --- a/plugins/user-settings-backend/src/alpha.ts +++ b/plugins/user-settings-backend/src/alpha.ts @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Backstage Authors + * Copyright 2024 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,37 +14,8 @@ * limitations under the License. */ -import { - coreServices, - createBackendPlugin, -} from '@backstage/backend-plugin-api'; -import { createRouterInternal } from './service/router'; -import { signalsServiceRef } from '@backstage/plugin-signals-node'; -import { DatabaseUserSettingsStore } from './database/DatabaseUserSettingsStore'; +import { default as feature } from './plugin'; -/** - * The user settings backend plugin. - * - * @alpha - */ -export default createBackendPlugin({ - pluginId: 'user-settings', - register(env) { - env.registerInit({ - deps: { - database: coreServices.database, - httpAuth: coreServices.httpAuth, - httpRouter: coreServices.httpRouter, - signals: signalsServiceRef, - }, - async init({ database, httpAuth, httpRouter, signals }) { - const userSettingsStore = await DatabaseUserSettingsStore.create({ - database, - }); - httpRouter.use( - await createRouterInternal({ userSettingsStore, httpAuth, signals }), - ); - }, - }); - }, -}); +/** @alpha */ +const _feature = feature; +export default _feature; diff --git a/plugins/user-settings-backend/src/index.ts b/plugins/user-settings-backend/src/index.ts index 3728c573ed..daf59c47e0 100644 --- a/plugins/user-settings-backend/src/index.ts +++ b/plugins/user-settings-backend/src/index.ts @@ -14,11 +14,6 @@ * limitations under the License. */ -import { default as feature } from './alpha'; - -/** @public */ -const _feature = feature; -export default _feature; - +export { default } from './plugin'; export * from './deprecated'; export * from './database'; diff --git a/plugins/user-settings-backend/src/plugin.ts b/plugins/user-settings-backend/src/plugin.ts new file mode 100644 index 0000000000..26fd3de908 --- /dev/null +++ b/plugins/user-settings-backend/src/plugin.ts @@ -0,0 +1,50 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + coreServices, + createBackendPlugin, +} from '@backstage/backend-plugin-api'; +import { createRouterInternal } from './service/router'; +import { signalsServiceRef } from '@backstage/plugin-signals-node'; +import { DatabaseUserSettingsStore } from './database/DatabaseUserSettingsStore'; + +/** + * The user settings backend plugin. + * + * @public + */ +export default createBackendPlugin({ + pluginId: 'user-settings', + register(env) { + env.registerInit({ + deps: { + database: coreServices.database, + httpAuth: coreServices.httpAuth, + httpRouter: coreServices.httpRouter, + signals: signalsServiceRef, + }, + async init({ database, httpAuth, httpRouter, signals }) { + const userSettingsStore = await DatabaseUserSettingsStore.create({ + database, + }); + httpRouter.use( + await createRouterInternal({ userSettingsStore, httpAuth, signals }), + ); + }, + }); + }, +});