address PR feedback and fix api reports
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
a17d9df2ee
commit
0102b3e5a1
@@ -41,7 +41,7 @@ import { ServiceRegistry } from './ServiceRegistry';
|
||||
import { createInitializationLogger } from './createInitializationLogger';
|
||||
import { unwrapFeature } from './helpers';
|
||||
// eslint-disable-next-line @backstage/no-relative-monorepo-imports
|
||||
import type { BackendPlugin } from '../../../backend-plugin-api/src/services/definitions/InstanceMetadataService';
|
||||
import type { InstanceMetadataServicePluginInfo } from '../../../backend-plugin-api/src/services/definitions/InstanceMetadataService';
|
||||
import Router from 'express-promise-router';
|
||||
|
||||
export interface BackendRegisterInit {
|
||||
@@ -103,7 +103,9 @@ const instanceRegistry = new (class InstanceRegistry {
|
||||
function createInstanceMetadataServiceFactory(
|
||||
registrations: InternalBackendRegistrations[],
|
||||
) {
|
||||
const installedPlugins: { [pluginId: string]: BackendPlugin } = {};
|
||||
const installedPlugins: {
|
||||
[pluginId: string]: InstanceMetadataServicePluginInfo;
|
||||
} = {};
|
||||
for (const registration of registrations) {
|
||||
if (registration.featureType === 'registrations') {
|
||||
for (const feature of registration.getRegistrations()) {
|
||||
|
||||
@@ -103,30 +103,5 @@ export const actionsServiceRef: ServiceRef<
|
||||
'singleton'
|
||||
>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type BackendFeatureMeta =
|
||||
| {
|
||||
type: 'plugin';
|
||||
pluginId: string;
|
||||
}
|
||||
| {
|
||||
type: 'module';
|
||||
pluginId: string;
|
||||
moduleId: string;
|
||||
};
|
||||
|
||||
// @alpha (undocumented)
|
||||
export interface InstanceMetadataService {
|
||||
// (undocumented)
|
||||
getInstalledFeatures: () => BackendFeatureMeta[];
|
||||
}
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const instanceMetadataServiceRef: ServiceRef<
|
||||
InstanceMetadataService,
|
||||
'plugin',
|
||||
'singleton'
|
||||
>;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -232,6 +232,11 @@ export namespace coreServices {
|
||||
const rootLogger: ServiceRef<RootLoggerService, 'root', 'singleton'>;
|
||||
const scheduler: ServiceRef<SchedulerService, 'plugin', 'singleton'>;
|
||||
const urlReader: ServiceRef<UrlReaderService, 'plugin', 'singleton'>;
|
||||
const instanceMetadata: ServiceRef<
|
||||
InstanceMetadataService,
|
||||
'plugin',
|
||||
'singleton'
|
||||
>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -416,6 +421,22 @@ export interface HttpRouterServiceAuthPolicy {
|
||||
path: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface InstanceMetadataService {
|
||||
// (undocumented)
|
||||
getInstalledPlugins: () => readonly InstanceMetadataServicePluginInfo[];
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface InstanceMetadataServicePluginInfo {
|
||||
// (undocumented)
|
||||
modules: {
|
||||
moduleId: string;
|
||||
}[];
|
||||
// (undocumented)
|
||||
pluginId: string;
|
||||
}
|
||||
|
||||
export { isChildPath };
|
||||
|
||||
// @public
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface BackendPlugin {
|
||||
/** @public */
|
||||
export interface InstanceMetadataServicePluginInfo {
|
||||
pluginId: string;
|
||||
modules: {
|
||||
moduleId: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
/** @alpha */
|
||||
/** @public */
|
||||
export interface InstanceMetadataService {
|
||||
getInstalledPlugins: () => readonly BackendPlugin[];
|
||||
getInstalledPlugins: () => readonly InstanceMetadataServicePluginInfo[];
|
||||
}
|
||||
|
||||
@@ -87,6 +87,6 @@ export type {
|
||||
export type { BackstageUserInfo, UserInfoService } from './UserInfoService';
|
||||
export type {
|
||||
InstanceMetadataService,
|
||||
BackendPlugin,
|
||||
InstanceMetadataServicePluginInfo,
|
||||
} from './InstanceMetadataService';
|
||||
export { coreServices } from './coreServices';
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
DatabaseService,
|
||||
DiscoveryService,
|
||||
HttpAuthService,
|
||||
InstanceMetadataService,
|
||||
LoggerService,
|
||||
PermissionsService,
|
||||
RootConfigService,
|
||||
@@ -556,4 +557,15 @@ export namespace mockServices {
|
||||
subscribe: jest.fn(),
|
||||
}));
|
||||
}
|
||||
|
||||
export function instanceMetadata(): InstanceMetadataService {
|
||||
return {
|
||||
getInstalledPlugins: () => [],
|
||||
};
|
||||
}
|
||||
export namespace instanceMetadata {
|
||||
export const mock = simpleMock(coreServices.instanceMetadata, () => ({
|
||||
getInstalledPlugins: jest.fn(),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user