plugins/*-backend: flip around alpha exports to stable

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-10-13 13:11:11 +02:00
parent b071eec7d7
commit 7cfc0c1902
53 changed files with 430 additions and 363 deletions
+7 -3
View File
@@ -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)
```
+4 -5
View File
@@ -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<express.Router>;
// @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".
+5 -1
View File
@@ -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;
+1 -6
View File
@@ -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;
+1 -1
View File
@@ -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',
+8 -4
View File
@@ -74,10 +74,6 @@ export type CatalogPermissionRule<
TParams extends PermissionRuleParams = PermissionRuleParams,
> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
// @alpha
const catalogPlugin: BackendFeature;
export default catalogPlugin;
// @alpha
export const createCatalogConditionalDecision: (
permission: ResourcePermission<'catalog-entity'>,
@@ -91,6 +87,10 @@ export const createCatalogPermissionRule: <
rule: PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>,
) => PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
// @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)
```
+4 -5
View File
@@ -212,6 +212,10 @@ export type CatalogPermissionRuleInput<
TParams extends PermissionRuleParams = PermissionRuleParams,
> = PermissionRule<Entity, EntitiesSearchFilter_2, 'catalog-entity', TParams>;
// @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".
+6 -1
View File
@@ -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';
+1 -6
View File
@@ -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;
@@ -170,7 +170,7 @@ class CatalogModelExtensionPointImpl implements CatalogModelExtensionPoint {
/**
* Catalog plugin
* @alpha
* @public
*/
export const catalogPlugin = createBackendPlugin({
pluginId: 'catalog',
+7 -3
View File
@@ -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)
```
+3 -4
View File
@@ -43,9 +43,9 @@ export class EventsBackend {
start(): Promise<void>;
}
// @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".
+5 -1
View File
@@ -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;
+1 -6
View File
@@ -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;
@@ -63,7 +63,7 @@ class EventsExtensionPointImpl implements EventsExtensionPoint {
/**
* Events plugin
*
* @alpha
* @public
*/
export const eventsPlugin = createBackendPlugin({
pluginId: 'events',
@@ -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)
```
+4 -5
View File
@@ -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".
+6 -1
View File
@@ -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;
+1 -6
View File
@@ -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;
+1 -2
View File
@@ -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) {
@@ -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)
```
+3 -4
View File
@@ -17,9 +17,9 @@ import { UserInfoService } from '@backstage/backend-plugin-api';
// @public @deprecated
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @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".
+5 -1
View File
@@ -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;
+1 -6
View File
@@ -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;
+1 -1
View File
@@ -39,7 +39,7 @@ class PolicyExtensionPointImpl implements PolicyExtensionPoint {
/**
* Permission plugin
*
* @alpha
* @public
*/
export const permissionPlugin = createBackendPlugin({
pluginId: 'permission',
+7 -3
View File
@@ -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)
```
+3 -4
View File
@@ -12,9 +12,9 @@ import { RootConfigService } from '@backstage/backend-plugin-api';
// @public @deprecated
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @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".
+4 -32
View File
@@ -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;
+1 -6
View File
@@ -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;
+49
View File
@@ -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,
});
},
});
},
});
@@ -26,6 +26,10 @@ export const createScaffolderTemplateConditionalDecision: (
conditions: PermissionCriteria<PermissionCondition<'scaffolder-template'>>,
) => 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)
+4 -5
View File
@@ -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".
@@ -54,7 +54,7 @@ import { createRouter } from './service/router';
/**
* Scaffolder plugin
*
* @alpha
* @public
*/
export const scaffolderPlugin = createBackendPlugin({
pluginId: 'scaffolder',
+5 -1
View File
@@ -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';
+1 -6
View File
@@ -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';
+1 -1
View File
@@ -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();
+7 -3
View File
@@ -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)
```
+3 -4
View File
@@ -18,9 +18,9 @@ import { SearchEngine } from '@backstage/plugin-search-backend-node';
// @public @deprecated (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @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".
```
+5 -137
View File
@@ -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;
+1 -6
View File
@@ -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;
@@ -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 () => {
+153
View File
@@ -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);
},
});
},
});
+7 -3
View File
@@ -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)
```
+7 -8
View File
@@ -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".
+5 -1
View File
@@ -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;
+1 -5
View File
@@ -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
+1 -1
View File
@@ -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',
+1 -1
View File
@@ -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();
@@ -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)
```
+3 -7
View File
@@ -12,9 +12,9 @@ import { SignalsService } from '@backstage/plugin-signals-node';
// @public @deprecated
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @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)
```
+5 -34
View File
@@ -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;
+1 -6
View File
@@ -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';
@@ -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 }),
);
},
});
},
});