backend-plugin-api: move BackendFactory to common types

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-08-15 00:57:22 +02:00
committed by Patrik Oldsberg
parent fa9028b680
commit c37c19cc37
6 changed files with 35 additions and 20 deletions
+1
View File
@@ -21,4 +21,5 @@
*/
export * from './services';
export type { BackendFeature } from './types';
export * from './wiring';
@@ -15,7 +15,6 @@
*/
export type {
BackendFeature,
ServiceRef,
ServiceRefConfig,
ServiceFactory,
@@ -14,6 +14,8 @@
* limitations under the License.
*/
import { BackendFeature } from '../../types';
/**
* TODO
*
@@ -85,20 +87,6 @@ export interface ServiceRefConfig<TService, TScope extends 'root' | 'plugin'> {
) => Promise<ServiceFactoryOrFunction>;
}
/** @internal */
export interface BackendFeatureFactory<
TOptions extends [options?: object] = [],
> {
(...options: TOptions): BackendFeature;
$$type: '@backstage/BackendFeatureFactory';
}
/** @public */
export interface BackendFeature {
// NOTE: This type is opaque in order to simplify future API evolution.
$$type: '@backstage/BackendFeature';
}
/**
* Creates a new service definition. This overload is used to create plugin scoped services.
*
+29
View File
@@ -0,0 +1,29 @@
/*
* Copyright 2023 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.
*/
/** @internal */
export interface BackendFeatureFactory<
TOptions extends [options?: object] = [],
> {
(...options: TOptions): BackendFeature;
$$type: '@backstage/BackendFeatureFactory';
}
/** @public */
export interface BackendFeature {
// NOTE: This type is opaque in order to simplify future API evolution.
$$type: '@backstage/BackendFeature';
}
@@ -14,10 +14,7 @@
* limitations under the License.
*/
import {
BackendFeature,
BackendFeatureFactory,
} from '../services/system/types';
import { BackendFeature, BackendFeatureFactory } from '../types';
import {
BackendModuleRegistrationPoints,
BackendPluginRegistrationPoints,
@@ -14,7 +14,8 @@
* limitations under the License.
*/
import { BackendFeature, ServiceRef } from '../services/system/types';
import { ServiceRef } from '../services/system/types';
import { BackendFeature } from '../types';
/**
* TODO