@@ -4,8 +4,9 @@
|
||||
|
||||
```ts
|
||||
import { AnyServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { BackendRegistrable } from '@backstage/backend-plugin-api';
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { HttpRouterService } from '@backstage/backend-plugin-api';
|
||||
import { Logger } from '@backstage/backend-plugin-api';
|
||||
import { PermissionAuthorizer } from '@backstage/plugin-permission-common';
|
||||
@@ -15,13 +16,14 @@ import { PluginDatabaseManager } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { ServiceRef } from '@backstage/backend-plugin-api';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
|
||||
// @public (undocumented)
|
||||
export interface Backend {
|
||||
// (undocumented)
|
||||
add(extension: BackendRegistrable): void;
|
||||
add(feature: BackendFeature): void;
|
||||
// (undocumented)
|
||||
start(): Promise<void>;
|
||||
}
|
||||
@@ -85,6 +87,11 @@ export const schedulerFactory: ServiceFactory<
|
||||
{}
|
||||
>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type ServiceOrExtensionPoint<T = unknown> =
|
||||
| ExtensionPoint<T>
|
||||
| ServiceRef<T>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const tokenManagerFactory: ServiceFactory<
|
||||
TokenManager,
|
||||
|
||||
@@ -26,23 +26,11 @@ export type AnyServiceFactory = ServiceFactory<
|
||||
>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface BackendInitRegistry {
|
||||
export interface BackendFeature {
|
||||
// (undocumented)
|
||||
registerExtensionPoint<TExtensionPoint>(
|
||||
ref: ServiceRef<TExtensionPoint>,
|
||||
impl: TExtensionPoint,
|
||||
): void;
|
||||
id: string;
|
||||
// (undocumented)
|
||||
registerInit<
|
||||
Deps extends {
|
||||
[name in string]: unknown;
|
||||
},
|
||||
>(options: {
|
||||
deps: {
|
||||
[name in keyof Deps]: ServiceRef<Deps[name]>;
|
||||
};
|
||||
init: (deps: Deps) => Promise<void>;
|
||||
}): void;
|
||||
register(reg: BackendRegistrationPoints): void;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -53,7 +41,7 @@ export interface BackendModuleConfig<TOptions> {
|
||||
pluginId: string;
|
||||
// (undocumented)
|
||||
register(
|
||||
reg: Omit<BackendInitRegistry, 'registerExtensionPoint'>,
|
||||
reg: Omit<BackendRegistrationPoints, 'registerExtensionPoint'>,
|
||||
options: TOptions,
|
||||
): void;
|
||||
}
|
||||
@@ -63,15 +51,27 @@ export interface BackendPluginConfig<TOptions> {
|
||||
// (undocumented)
|
||||
id: string;
|
||||
// (undocumented)
|
||||
register(reg: BackendInitRegistry, options: TOptions): void;
|
||||
register(reg: BackendRegistrationPoints, options: TOptions): void;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface BackendRegistrable {
|
||||
export interface BackendRegistrationPoints {
|
||||
// (undocumented)
|
||||
id: string;
|
||||
registerExtensionPoint<TExtensionPoint>(
|
||||
ref: ExtensionPoint<TExtensionPoint>,
|
||||
impl: TExtensionPoint,
|
||||
): void;
|
||||
// (undocumented)
|
||||
register(reg: BackendInitRegistry): void;
|
||||
registerInit<
|
||||
Deps extends {
|
||||
[name in string]: unknown;
|
||||
},
|
||||
>(options: {
|
||||
deps: {
|
||||
[name in keyof Deps]: ServiceRef<Deps[name]> | ExtensionPoint<Deps[name]>;
|
||||
};
|
||||
init(deps: Deps): Promise<void>;
|
||||
}): void;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -84,15 +84,15 @@ export const configServiceRef: ServiceRef<Config>;
|
||||
export function createBackendModule<TOptions>(
|
||||
config: BackendModuleConfig<TOptions>,
|
||||
): undefined extends TOptions
|
||||
? (options?: TOptions) => BackendRegistrable
|
||||
: (options: TOptions) => BackendRegistrable;
|
||||
? (options?: TOptions) => BackendFeature
|
||||
: (options: TOptions) => BackendFeature;
|
||||
|
||||
// @public (undocumented)
|
||||
export function createBackendPlugin<TOptions>(
|
||||
config: BackendPluginConfig<TOptions>,
|
||||
): undefined extends TOptions
|
||||
? (options?: TOptions) => BackendRegistrable
|
||||
: (options: TOptions) => BackendRegistrable;
|
||||
? (options?: TOptions) => BackendFeature
|
||||
: (options: TOptions) => BackendFeature;
|
||||
|
||||
// @public (undocumented)
|
||||
export function createExtensionPoint<T>(options: {
|
||||
|
||||
@@ -4,16 +4,11 @@
|
||||
|
||||
```ts
|
||||
import { AnyServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { Backend } from '@backstage/backend-app-api';
|
||||
import { BackendRegistrable } from '@backstage/backend-plugin-api';
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { Knex } from 'knex';
|
||||
import { ServiceRef } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @alpha (undocumented)
|
||||
export function createTestBackend<TServices extends any[]>(
|
||||
options: TestBackendOptions<TServices>,
|
||||
): Backend;
|
||||
|
||||
// @public (undocumented)
|
||||
export function isDockerDisabledForTests(): boolean;
|
||||
|
||||
@@ -25,16 +20,29 @@ export function setupRequestMockHandlers(worker: {
|
||||
}): void;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export function startTestBackend<TServices extends any[]>(
|
||||
options: TestBackendOptions<TServices> & {
|
||||
registrables?: BackendRegistrable[];
|
||||
},
|
||||
): Promise<void>;
|
||||
export function startTestBackend<
|
||||
TServices extends any[],
|
||||
TExtensionPoints extends any[],
|
||||
>(options: TestBackendOptions<TServices, TExtensionPoints>): Promise<void>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export interface TestBackendOptions<TServices extends any[]> {
|
||||
export interface TestBackendOptions<
|
||||
TServices extends any[],
|
||||
TExtensionPoints extends any[],
|
||||
> {
|
||||
// (undocumented)
|
||||
services: readonly [
|
||||
extensionPoints?: readonly [
|
||||
...{
|
||||
[index in keyof TExtensionPoints]: [
|
||||
ExtensionPoint<TExtensionPoints[index]>,
|
||||
Partial<TExtensionPoints[index]>,
|
||||
];
|
||||
},
|
||||
];
|
||||
// (undocumented)
|
||||
features?: BackendFeature[];
|
||||
// (undocumented)
|
||||
services?: readonly [
|
||||
...{
|
||||
[index in keyof TServices]:
|
||||
| AnyServiceFactory
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import { BackendRegistrable } from '@backstage/backend-plugin-api';
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { CatalogEntityDocument } from '@backstage/plugin-catalog-common';
|
||||
import { CatalogProcessor } from '@backstage/plugin-catalog-node';
|
||||
@@ -224,7 +224,7 @@ export type CatalogPermissionRule<TParams extends unknown[] = unknown[]> =
|
||||
PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
|
||||
|
||||
// @alpha
|
||||
export const catalogPlugin: (options?: unknown) => BackendRegistrable;
|
||||
export const catalogPlugin: (options?: unknown) => BackendFeature;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface CatalogProcessingEngine {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
import { CompoundEntityRef } from '@backstage/catalog-model';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { ServiceRef } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @alpha (undocumented)
|
||||
export interface CatalogProcessingExtensionPoint {
|
||||
@@ -19,7 +19,7 @@ export interface CatalogProcessingExtensionPoint {
|
||||
}
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const catalogProcessingExtensionPoint: ServiceRef<CatalogProcessingExtensionPoint>;
|
||||
export const catalogProcessingExtensionPoint: ExtensionPoint<CatalogProcessingExtensionPoint>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type CatalogProcessor = {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
```ts
|
||||
/// <reference types="node" />
|
||||
|
||||
import { BackendRegistrable } from '@backstage/backend-plugin-api';
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
|
||||
import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
|
||||
@@ -566,7 +566,7 @@ export type RunCommandOptions = {
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export const scaffolderCatalogModule: (options?: unknown) => BackendRegistrable;
|
||||
export const scaffolderCatalogModule: (options?: unknown) => BackendFeature;
|
||||
|
||||
// @public (undocumented)
|
||||
export class ScaffolderEntitiesProcessor implements CatalogProcessor {
|
||||
|
||||
Reference in New Issue
Block a user