backend-plugin-api: export service refs via single coreServices object

Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-12-02 14:29:50 +01:00
parent 51ccd0bbc1
commit 5cad431d0c
3 changed files with 64 additions and 26 deletions
+32 -13
View File
@@ -76,10 +76,29 @@ export interface BackendRegistrationPoints {
}
// @public (undocumented)
export const cacheServiceRef: ServiceRef<PluginCacheManager, 'plugin'>;
const cacheServiceRef: ServiceRef<PluginCacheManager, 'plugin'>;
// @public (undocumented)
export const configServiceRef: ServiceRef<Config, 'root'>;
const configServiceRef: ServiceRef<Config, 'root'>;
declare namespace coreServices {
export {
configServiceRef as config,
httpRouterServiceRef as httpRouter,
loggerServiceRef as logger,
urlReaderServiceRef as urlReader,
cacheServiceRef as cache,
databaseServiceRef as database,
discoveryServiceRef as discovery,
tokenManagerServiceRef as tokenManager,
permissionsServiceRef as permissions,
schedulerServiceRef as scheduler,
rootLoggerServiceRef as rootLogger,
pluginMetadataServiceRef as pluginMetadata,
lifecycleServiceRef as lifecycle,
};
}
export { coreServices };
// @public
export function createBackendModule<
@@ -146,10 +165,10 @@ export function createServiceRef<T>(options: {
}): ServiceRef<T, 'root'>;
// @public (undocumented)
export const databaseServiceRef: ServiceRef<PluginDatabaseManager, 'plugin'>;
const databaseServiceRef: ServiceRef<PluginDatabaseManager, 'plugin'>;
// @public (undocumented)
export const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, 'plugin'>;
const discoveryServiceRef: ServiceRef<PluginEndpointDiscovery, 'plugin'>;
// @public
export type ExtensionPoint<T> = {
@@ -166,10 +185,10 @@ export interface HttpRouterService {
}
// @public (undocumented)
export const httpRouterServiceRef: ServiceRef<HttpRouterService, 'plugin'>;
const httpRouterServiceRef: ServiceRef<HttpRouterService, 'plugin'>;
// @public (undocumented)
export const lifecycleServiceRef: ServiceRef<BackendLifecycle, 'plugin'>;
const lifecycleServiceRef: ServiceRef<BackendLifecycle, 'plugin'>;
// @public (undocumented)
export interface Logger {
@@ -180,7 +199,7 @@ export interface Logger {
}
// @public (undocumented)
export const loggerServiceRef: ServiceRef<Logger, 'plugin'>;
const loggerServiceRef: ServiceRef<Logger, 'plugin'>;
// @public (undocumented)
export function loggerToWinstonLogger(
@@ -189,7 +208,7 @@ export function loggerToWinstonLogger(
): Logger_2;
// @public (undocumented)
export const permissionsServiceRef: ServiceRef<
const permissionsServiceRef: ServiceRef<
PermissionAuthorizer | PermissionEvaluator,
'plugin'
>;
@@ -201,13 +220,13 @@ export interface PluginMetadata {
}
// @public (undocumented)
export const pluginMetadataServiceRef: ServiceRef<PluginMetadata, 'plugin'>;
const pluginMetadataServiceRef: ServiceRef<PluginMetadata, 'plugin'>;
// @public (undocumented)
export const rootLoggerServiceRef: ServiceRef<Logger, 'root'>;
const rootLoggerServiceRef: ServiceRef<Logger, 'root'>;
// @public (undocumented)
export const schedulerServiceRef: ServiceRef<PluginTaskScheduler, 'plugin'>;
const schedulerServiceRef: ServiceRef<PluginTaskScheduler, 'plugin'>;
// @public (undocumented)
export type ServiceFactory<TService = unknown> =
@@ -249,7 +268,7 @@ export type ServiceRef<
};
// @public (undocumented)
export const tokenManagerServiceRef: ServiceRef<TokenManager, 'plugin'>;
const tokenManagerServiceRef: ServiceRef<TokenManager, 'plugin'>;
// @public (undocumented)
export type TypesToServiceRef<T> = {
@@ -257,5 +276,5 @@ export type TypesToServiceRef<T> = {
};
// @public (undocumented)
export const urlReaderServiceRef: ServiceRef<UrlReader, 'plugin'>;
const urlReaderServiceRef: ServiceRef<UrlReader, 'plugin'>;
```
@@ -0,0 +1,29 @@
/*
* Copyright 2022 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.
*/
export { configServiceRef as config } from './configServiceRef';
export { httpRouterServiceRef as httpRouter } from './httpRouterServiceRef';
export { loggerServiceRef as logger } from './loggerServiceRef';
export { urlReaderServiceRef as urlReader } from './urlReaderServiceRef';
export { cacheServiceRef as cache } from './cacheServiceRef';
export { databaseServiceRef as database } from './databaseServiceRef';
export { discoveryServiceRef as discovery } from './discoveryServiceRef';
export { tokenManagerServiceRef as tokenManager } from './tokenManagerServiceRef';
export { permissionsServiceRef as permissions } from './permissionsServiceRef';
export { schedulerServiceRef as scheduler } from './schedulerServiceRef';
export { rootLoggerServiceRef as rootLogger } from './rootLoggerServiceRef';
export { pluginMetadataServiceRef as pluginMetadata } from './pluginMetadataServiceRef';
export { lifecycleServiceRef as lifecycle } from './lifecycleServiceRef';
@@ -14,21 +14,11 @@
* limitations under the License.
*/
export { configServiceRef } from './configServiceRef';
export { httpRouterServiceRef } from './httpRouterServiceRef';
import * as coreServices from './coreServices';
export { coreServices };
export type { HttpRouterService } from './httpRouterServiceRef';
export { loggerServiceRef } from './loggerServiceRef';
export type { Logger } from './loggerServiceRef';
export { urlReaderServiceRef } from './urlReaderServiceRef';
export { cacheServiceRef } from './cacheServiceRef';
export { databaseServiceRef } from './databaseServiceRef';
export { discoveryServiceRef } from './discoveryServiceRef';
export { tokenManagerServiceRef } from './tokenManagerServiceRef';
export { permissionsServiceRef } from './permissionsServiceRef';
export { schedulerServiceRef } from './schedulerServiceRef';
export { rootLoggerServiceRef } from './rootLoggerServiceRef';
export { pluginMetadataServiceRef } from './pluginMetadataServiceRef';
export { lifecycleServiceRef } from './lifecycleServiceRef';
export type {
BackendLifecycle,
BackendLifecycleShutdownHook,