backend-plugin-api: add new root lifecycle service + impl

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-02 15:56:50 +01:00
parent 32eb67eb75
commit 6cfd4d7073
16 changed files with 157 additions and 71 deletions
@@ -24,6 +24,7 @@ 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 { rootLifecycleServiceRef as rootLifecycle } from './rootLifecycleServiceRef';
export { rootLoggerServiceRef as rootLogger } from './rootLoggerServiceRef';
export { pluginMetadataServiceRef as pluginMetadata } from './pluginMetadataServiceRef';
export { lifecycleServiceRef as lifecycle } from './lifecycleServiceRef';
@@ -29,6 +29,7 @@ export type {
export type { LoggerService, LogMeta } from './loggerServiceRef';
export type { PermissionsService } from './permissionsServiceRef';
export type { PluginMetadataService } from './pluginMetadataServiceRef';
export type { RootLifecycleService } from './rootLifecycleServiceRef';
export type { RootLoggerService } from './rootLoggerServiceRef';
export type { SchedulerService } from './schedulerServiceRef';
export type { TokenManagerService } from './tokenManagerServiceRef';
@@ -21,6 +21,9 @@ import { createServiceRef } from '../system/types';
**/
export type LifecycleServiceShutdownHook = {
fn: () => void | Promise<void>;
/** Labels to help identify the shutdown hook */
labels?: Record<string, string>;
};
/**
@@ -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.
*/
import { createServiceRef } from '../system/types';
import { LifecycleService } from './lifecycleServiceRef';
/** @public */
export type RootLifecycleService = LifecycleService;
/**
* @public
*/
export const rootLifecycleServiceRef = createServiceRef<RootLifecycleService>({
id: 'core.rootLifecycle',
scope: 'root',
});