remove deprecated exports

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-08-30 13:20:18 +02:00
parent b78a19fd4a
commit 055b75b39f
6 changed files with 15 additions and 71 deletions
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/backend-common': minor
'@backstage/backend-defaults': minor
---
**BREAKING**: Simplifications and cleanup as part of the Backend System 1.0 work.
- The deprecated `dropDatabase` function has now been removed, without replacement.
- The deprecated `LegacyRootDatabaseService` type has now been removed. The implication is that you now need to pass deps to a `DatabaseManager` when constructing one.
- The return type from `DatabaseManager.forPlugin` is now directly a `DatabaseService`, as arguably expected.
+1 -11
View File
@@ -143,7 +143,7 @@ export function createStatusCheckRouter(options: {
}): Promise<express.Router>;
// @public @deprecated (undocumented)
export class DatabaseManager implements LegacyRootDatabaseService {
export class DatabaseManager {
// (undocumented)
forPlugin(
pluginId: string,
@@ -173,11 +173,6 @@ export class DockerContainerRunner implements ContainerRunner {
runContainer(options: RunContainerOptions): Promise<void>;
}
// Warning: (ae-forgotten-export) The symbol "dropDatabase_2" needs to be exported by the entry point index.d.ts
//
// @public @deprecated (undocumented)
export const dropDatabase: typeof dropDatabase_2;
// @public @deprecated
export function errorHandler(
options?: ErrorHandlerOptions,
@@ -367,11 +362,6 @@ export const legacyPlugin: (
}>,
) => BackendFeature;
// Warning: (ae-forgotten-export) The symbol "LegacyRootDatabaseService_2" needs to be exported by the entry point index.d.ts
//
// @public @deprecated (undocumented)
export type LegacyRootDatabaseService = LegacyRootDatabaseService_2;
// @public @deprecated
export function loadBackendConfig(options: {
logger: LoggerService;
@@ -30,10 +30,8 @@ import {
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
import {
dropDatabase as _dropDatabase,
DatabaseManager as _DatabaseManager,
type DatabaseManagerOptions as _DatabaseManagerOptions,
type LegacyRootDatabaseService as _LegacyRootDatabaseService,
} from '../../../backend-defaults/src/entrypoints/database/DatabaseManager';
import {
@@ -169,7 +167,7 @@ export type CacheClientOptions = CacheServiceOptions;
* @public
* @deprecated Use `DatabaseManager` from the `@backstage/backend-defaults` package instead
*/
export class DatabaseManager implements LegacyRootDatabaseService {
export class DatabaseManager {
private constructor(private readonly _databaseManager: _DatabaseManager) {}
static fromConfig(
@@ -202,18 +200,6 @@ export type DatabaseManagerOptions = _DatabaseManagerOptions;
*/
export type PluginDatabaseManager = _PluginDatabaseManager;
/**
* @public
* @deprecated Use `LegacyRootDatabaseService` from the `@backstage/backend-defaults` package instead
*/
export type LegacyRootDatabaseService = _LegacyRootDatabaseService;
/**
* @public
* @deprecated Use `dropDatabase` from the `@backstage/backend-defaults` package instead
*/
export const dropDatabase = _dropDatabase;
/**
* @public
* @deprecated This function is deprecated and will be removed in a future release, see https://github.com/backstage/backstage/issues/24493.
@@ -3,7 +3,6 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Config } from '@backstage/config';
import { DatabaseService } from '@backstage/backend-plugin-api';
import { LifecycleService } from '@backstage/backend-plugin-api';
import { LoggerService } from '@backstage/backend-plugin-api';
@@ -12,7 +11,7 @@ import { RootConfigService } from '@backstage/backend-plugin-api';
import { ServiceFactory } from '@backstage/backend-plugin-api';
// @public
export class DatabaseManager implements LegacyRootDatabaseService {
export class DatabaseManager {
forPlugin(
pluginId: string,
deps?: {
@@ -39,16 +38,5 @@ export const databaseServiceFactory: ServiceFactory<
'singleton'
>;
// @public @deprecated
export function dropDatabase(
dbConfig: Config,
...databaseNames: string[]
): Promise<void>;
// @public
export type LegacyRootDatabaseService = {
forPlugin(pluginId: string): DatabaseService;
};
// (No @packageDocumentation comment for this package)
```
@@ -46,18 +46,10 @@ export type DatabaseManagerOptions = {
logger?: LoggerService;
};
/**
* An interface that represents the legacy global DatabaseManager implementation.
* @public
*/
export type LegacyRootDatabaseService = {
forPlugin(pluginId: string): DatabaseService;
};
/**
* Testable implementation class for {@link DatabaseManager} below.
*/
export class DatabaseManagerImpl implements LegacyRootDatabaseService {
export class DatabaseManagerImpl {
constructor(
private readonly config: Config,
private readonly connectors: Record<string, Connector>,
@@ -193,7 +185,7 @@ export class DatabaseManagerImpl implements LegacyRootDatabaseService {
* set `prefix` which is used to prefix generated database names if config is
* not provided.
*/
export class DatabaseManager implements LegacyRootDatabaseService {
export class DatabaseManager {
/**
* Creates a {@link DatabaseManager} from `backend.database` config.
*
@@ -241,23 +233,3 @@ export class DatabaseManager implements LegacyRootDatabaseService {
return this.impl.forPlugin(pluginId, deps);
}
}
/**
* Helper for deleting databases.
*
* @public
* @deprecated Will be removed in a future release.
*/
export async function dropDatabase(
dbConfig: Config,
...databaseNames: string[]
): Promise<void> {
const client = dbConfig.getString('client');
const prefix = dbConfig.getOptionalString('prefix') || 'backstage_plugin_';
if (client === 'pg') {
await new PgConnector(dbConfig, prefix).dropDatabase(...databaseNames);
} else if (client === 'mysql' || client === 'mysql2') {
await new MysqlConnector(dbConfig, prefix).dropDatabase(...databaseNames);
}
}
@@ -18,6 +18,4 @@ export { databaseServiceFactory } from './databaseServiceFactory';
export {
DatabaseManager,
type DatabaseManagerOptions,
type LegacyRootDatabaseService,
dropDatabase,
} from './DatabaseManager';