remove experimental service from core services

Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
aramissennyeydd
2024-11-28 20:46:34 -05:00
parent a927312812
commit 2f8c58b11b
5 changed files with 40 additions and 26 deletions
@@ -35,7 +35,11 @@ import type {
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
import type { InternalServiceFactory } from '../../../backend-plugin-api/src/services/system/types';
import { ForwardedError, ConflictError } from '@backstage/errors';
import { featureDiscoveryServiceRef } from '@backstage/backend-plugin-api/alpha';
import {
experimentalServices,
featureDiscoveryServiceRef,
BackendFeatureMeta,
} from '@backstage/backend-plugin-api/alpha';
import { DependencyGraph } from '../lib/DependencyGraph';
import { ServiceRegistry } from './ServiceRegistry';
import { createInitializationLogger } from './createInitializationLogger';
@@ -97,18 +101,6 @@ const instanceRegistry = new (class InstanceRegistry {
};
})();
// Duplicating from `@backstage/backend-plugin-api` to avoid a deep import.
type BackendFeatureMeta =
| {
type: 'plugin';
pluginId: string;
}
| {
type: 'module';
pluginId: string;
moduleId: string;
};
function createInstanceMetadataServiceFactory(
registrations: InternalBackendRegistrations[],
) {
@@ -136,7 +128,7 @@ function createInstanceMetadataServiceFactory(
})
.flat();
return createServiceFactory({
service: coreServices.EXPERIMENTAL_instanceMetadata,
service: experimentalServices.EXPERIMENTAL_instanceMetadata,
deps: {},
factory: async () => ({ getInstalledFeatures: () => installedFeatures }),
});
+3
View File
@@ -34,3 +34,6 @@ export const featureDiscoveryServiceRef =
id: 'core.featureDiscovery',
scope: 'root',
});
export { experimentalServices } from './services/definitions/experimentalServices';
export type { BackendFeatureMeta } from './services/definitions/InstanceMetadataService';
@@ -251,15 +251,4 @@ export namespace coreServices {
export const urlReader = createServiceRef<
import('./UrlReaderService').UrlReaderService
>({ id: 'core.urlReader' });
/**
* EXPERIMENTAL: Instance metadata service.
*
* @public
*/
export const EXPERIMENTAL_instanceMetadata = createServiceRef<
import('./InstanceMetadataService').InstanceMetadataService
>({
id: 'core.instanceMetadata',
});
}
@@ -0,0 +1,29 @@
/*
* 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.
* 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';
export namespace experimentalServices {
/**
* EXPERIMENTAL: Instance metadata service.
*
* @public
*/
export const EXPERIMENTAL_instanceMetadata = createServiceRef<
import('./InstanceMetadataService').InstanceMetadataService
>({
id: 'core.instanceMetadata',
});
}
+2 -1
View File
@@ -17,6 +17,7 @@ import {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
import { experimentalServices } from '@backstage/backend-plugin-api/alpha';
// Example usage of the instance metadata service to log the installed features.
export default createBackendPlugin({
@@ -24,7 +25,7 @@ export default createBackendPlugin({
register(env) {
env.registerInit({
deps: {
instanceMetadata: coreServices.EXPERIMENTAL_instanceMetadata,
instanceMetadata: experimentalServices.EXPERIMENTAL_instanceMetadata,
logger: coreServices.logger,
},
async init({ instanceMetadata, logger }) {